@ -10,12 +10,77 @@ using namespace Windows::UI::Core;
usingnamespaceWindows::UI::Input;
usingnamespaceWindows::Foundation;
usingnamespaceWindows::Foundation::Collections;
usingnamespaceWindows::Gaming::Input;
usingnamespaceWindows::Graphics::Display;
usingnamespaceMicrosoft::WRL;
usingnamespacePlatform;
usingnamespaceraylibUWP;
/* GAMEPAD CODE */
// Stand-ins for "core.c" variables
#define MAX_GAMEPADS 4 // Max number of gamepads supported
#define MAX_GAMEPAD_BUTTONS 32 // Max bumber of buttons supported (per gamepad)
#define MAX_GAMEPAD_AXIS 8 // Max number of axis supported (per gamepad)
staticboolgamepadReady[MAX_GAMEPADS]={false};// Flag to know if gamepad is ready
staticfloatgamepadAxisState[MAX_GAMEPADS][MAX_GAMEPAD_AXIS];// Gamepad axis state
staticcharpreviousGamepadState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS];// Previous gamepad buttons state
staticcharcurrentGamepadState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS];// Current gamepad buttons state
voidUWP_PollInput()
{
// Check if gamepads are ready
for(inti=0;i<MAX_GAMEPADS;i++)
{
// HACK: UWP keeps a contiguous list of gamepads. For the interest of time I'm just doing a 1:1 mapping of
// connected gamepads with their spot in the list, but this has serious robustness problems
// e.g. player 1, 2, and 3 are playing a game - if player2 disconnects, p3's controller would now be mapped to p2's character since p3 is now second in the list.