Table of Contents

Input polling refers to the process of querying the input system to check if user interacted with a input device in some way. This may include checking if the user pressed a keyboard, mouse or a gamepad button or moved the mouse or an analog axis.

All the input in bs::f is handled though the Input class, which can be globally accessed through the gInput() method.

Button presses

Use the following methods to check if a button has been pressed, released or is currently being held down:

Analog input

Moving the mouse, gamepad sticks or triggers results in an analog input. While buttons can only be toggled on or off, analog input is received in a specific range (for example, anywhere between -1 and 1). This allows more precise input for applications that require it.

In bs::f analog input is represented through the concept of axes. Use Input::getAxisValue() to get a value for a specific axis. Check InputAxis for a list of all supported axes.

Vector3 position(BsZero);

// Move forward or backwards depending on how much does the user move the left gamepad stick forward or backwards

Most axes report their input in range [-1, 1], with the exception of mouse axes, which are unbound.

Mouse input

Often it is useful to receive mouse position directly, rather than dealing with raw mouse axis data. Use Input::getPointerPosition() to retrieve the current position of the mouse cursor, in coordinates relative to the screen.

Use Input::getPointerDelta() to get the difference in coordinates between the position of the mouse on the previous and current frame.