#include "pong.h" /* Checks what button the player is pressing amongst all control inputs. */ int player_controls() { if( IsMouseButtonDown(MOUSE_LEFT_BUTTON) || IsKeyDown(KEY_SPACE) || IsGamepadButtonDown(1, GAMEPAD_BUTTON_RIGHT_FACE_DOWN) ) { return(CONTROLLER_ACTIVATE); } else if( IsKeyDown(KEY_ESCAPE) || IsGamepadButtonDown(1, GAMEPAD_BUTTON_MIDDLE_RIGHT) ) { return(CONTROLLER_PAUSE); } else if( IsKeyDown(KEY_A) || IsGamepadButtonDown(1, GAMEPAD_BUTTON_LEFT_FACE_LEFT) ) { return(CONTROLLER_LEFT); } else if( IsKeyDown(KEY_D) || IsGamepadButtonDown(1, GAMEPAD_BUTTON_LEFT_FACE_RIGHT) ) { return(CONTROLLER_RIGHT); } else if( IsKeyDown(KEY_W) || IsGamepadButtonDown(1, GAMEPAD_BUTTON_LEFT_FACE_UP) ) { return(CONTROLLER_UP); } else if( IsKeyDown(KEY_S) || IsGamepadButtonDown(1, GAMEPAD_BUTTON_LEFT_FACE_DOWN) ) { return(CONTROLLER_DOWN); } return(-1); }