Overview
FPL supports manual polling of input states for Keyboard/Gamepad/Mouse as well.
Disable Input-Events
If you are only use polling to get your input states, you should disable the input-events entirely.
This is done by simply setting the fplInputSettings::disabledEvents to "1" in your fplSettings structure.
Keyboard
Use fplPollKeyboardState to poll the current keyboard state.
This state contains all the raw/mapped button states and the modifier states.
}
}
@ fplButtonState_Press
Key pressed.
A struct containing the full keyboard state.
fplButtonState buttonStatesMapped[FPL_MAX_KEYBOARD_STATE_COUNT]
Mapped button states.
See fplKeyboardState for more details.
Gamepad
Use fplPollGamepadStates to poll the current states for all connected game controllers.
This state contains all the buttons, digital-pad, the left/right stick position + trigger, etc.
}
}
#define fplArrayCount(arr)
Returns the element count from a static array. This should ideally produce a compile error when passi...
A structure containing the entire gamepad state.
A struct containing the full state for all gamepad devices.
fplGamepadState deviceStates[FPL_MAX_GAMEPAD_STATE_COUNT]
Device states.
See fplGamepadStates for more details.
- Note
- use fplGamepadState::isConnected to check if the gamepad is connected or not.
Mouse
Use fplPollMouseState to poll the current mouse state.
This state contains the state of all the buttons (Left, Right, Middle) and the position in pixels coordinates.
int mousePosX = mouseState.
x;
int mousePosY = mouseState.
y;
}
}
@ fplMouseButtonType_Left
Left mouse button.
A struct containing the full mouse state.
int32_t y
Y-Position in pixels.
fplButtonState buttonStates[fplMouseButtonType_MaxCount]
Mouse button states mapped to fplMouseButtonType.
int32_t x
X-Position in pixels.
See fplMouseState for more details.
Tips
- Note
- You can always use all those polling functions, regardless of the fplInputSettings::disabledEvents field!