JNGL
Easy to use cross-platform 2D game library
|
Input related functions. More...
#include "Vec2.hpp"
#include <functional>
#include <memory>
#include <vector>
#include <experimental/optional>
Go to the source code of this file.
Namespaces | |
namespace | jngl |
JNGL's main namespace. | |
Enumerations | |
enum | KeyType : uint8_t { Left , Up , Right , Down , PageUp , PageDown , Home , End , BackSpace , Tab , Clear , Return , Pause , Escape , Delete , ControlL , ControlR , CapsLock , AltL , AltR , SuperL , SuperR , Space , ShiftL , ShiftR , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 , F10 , F11 , F12 , Any } |
Keyboard keys. More... | |
enum | KeyboardType : uint8_t { Default , Numpad } |
Whether a normal or a numbers-only keyboard should appear. More... | |
enum | Button : uint8_t { Left , Middle , Right } |
Mouse buttons. More... | |
enum | Button : uint8_t { LeftStickX , LeftStickXInverse , LeftStickY , LeftStickYInverse , RightStickX , RightStickXInverse , RightStickY , RightStickYInverse , A , B , X , Y , LeftButton , RightButton , LeftTrigger , RightTrigger , Start , Back , DpadUp , DpadDown , DpadLeft , DpadRight , LeftStick , RightStick , Last } |
Gamepad buttons. More... | |
Functions | |
void | setKeyboardVisible (bool) |
Display onscreen keyboard for touch devices. | |
void | setKeyboardType (KeyboardType) |
Type of the onscreen keyboard. | |
KeyboardType | getKeyboardType () |
Currently active type of onscreen keyboard. | |
void | setKeyPressed (const std::string &key, bool) |
Overwrite what keyPressed() should return. | |
void | setKeyPressed (key::KeyType key, bool) |
Overwrite what keyPressed() should return. | |
bool | keyDown (key::KeyType key) |
Whether key is down. | |
bool | keyDown (char key) |
Whether key is down. | |
bool | keyDown (const std::string &key) |
Whether key is down, where key should be exactly one UTF-8 character. | |
bool | keyPressed (key::KeyType key) |
Whether key has been pressed since the next to last call to updateInput() | |
bool | keyPressed (char key) |
Whether key has been pressed since the next to last call to updateInput() | |
bool | keyPressed (const std::string &key) |
Whether key has been pressed since the next to last call to updateInput(), where key should be exactly one UTF-8 character. | |
void | setRelativeMouseMode (bool relative) |
bool | getRelativeMouseMode () |
void | setMouseVisible (bool visible) |
By default the mouse cursor of the OS is visible and can be hidden by passing false. | |
bool | isMouseVisible () |
Returns whether the mouse cursor of the OS is currently visible. | |
bool | isMultitouch () |
Returns true when there's more than one finger touching the screen. | |
std::vector< jngl::Vec2 > | getTouchPositions () |
Returns all positions where a finger touches the screen. | |
Vec2 | getMousePos () |
Mouse position in screen coordinates. | |
optional< Vec2 > | getCursorPos () |
Returns the position of the mouse pointer if a mouse is connected/available. | |
int | getMouseX () |
Retrieve mouse position in pixels. | |
int | getMouseY () |
Retrieve mouse position in pixels. | |
double | getMouseWheel () |
Returns mouse wheel movement between -100 and 100 (0 if the mousewheel doesn't move) | |
bool | mouseDown (mouse::Button button=mouse::Left) |
Returns whether button is currently held down. | |
void | setMouseDown (mouse::Button button, bool) |
Overwrite what mouseDown() should return. | |
bool | mousePressed (mouse::Button button=mouse::Left) |
Whether button has been pressed since the next to last call to updateInput() | |
void | setMousePressed (jngl::mouse::Button, bool) |
Overwrite what mouseDown() should return. | |
void | setMouse (Vec2 position) |
Moves the mouse (does nothing on iOS and Android) | |
std::vector< std::shared_ptr< Controller > > | getConnectedControllers () |
Returns all controllers (gamepads) that are connected. | |
void | onControllerChanged (std::function< void()> callback) |
Specify a function which gets called, whenever a controller gets added or removed. | |
std::string | getTextInput () |
Returns a string of characters that have been pressed since the last call to updateInput() | |
Input related functions.
Definition in file input.hpp.
enum KeyType : uint8_t |
enum Button : uint8_t |
Gamepad buttons.