File tree Expand file tree Collapse file tree
examples/dreamcast/raylib/texture2d Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,6 +183,27 @@ int main() {
183183 }
184184 }
185185 EndDrawing ();
186+
187+ // Check the inputs for an exit combination of ABXYStart on every controller port
188+ // A more complicated program would likely want to decouple input checks from framerate,
189+ // which this example accomplishes by putting the input check in the same loop as drawing.
190+ for (int i = 0 ; i < 4 ; ++ i ) {
191+ // Assuming gamepad 0 is the primary controller
192+ if (IsGamepadAvailable (i )){
193+ int a_pressed = IsGamepadButtonDown (i , GAMEPAD_BUTTON_RIGHT_FACE_DOWN );
194+ int b_pressed = IsGamepadButtonDown (i , GAMEPAD_BUTTON_RIGHT_FACE_RIGHT );
195+ int x_pressed = IsGamepadButtonDown (i , GAMEPAD_BUTTON_RIGHT_FACE_LEFT );
196+ int y_pressed = IsGamepadButtonDown (i , GAMEPAD_BUTTON_RIGHT_FACE_UP );
197+ int start_pressed = IsGamepadButtonDown (i , GAMEPAD_BUTTON_MIDDLE_RIGHT );
198+
199+ // Now we do the check. We don't really care what controller presses the combo,
200+ // only that some controller presses the combo.
201+ if (a_pressed && b_pressed && x_pressed && y_pressed && start_pressed ) {
202+ // I think this directly closes the window, which should escape the loop
203+ CloseWindow ();
204+ }
205+ }
206+ }
186207 }
187208
188209 // Cleanup. Even thought we shouldn't reach here under normal circumstances.
You can’t perform that action at this time.
0 commit comments