![]() |
Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
|
#include <input.hpp>
Public Member Functions | |
| void | update (float deltaTime) |
| bool | isKeyPressed (Keycode key) const |
| bool | isControllerButtonPressed (int device, ControllerButton button) const |
| bool | isKeyLabelPressed (const char *label) const |
| bool | isMouseButtonPressed (MouseButton button) const |
| std::optional< Vector2 > | getMousePosition () const |
| float | getControllerAxis (int device, ControllerAxis axis) const |
| std::string | getControllerGUID (int device) const |
| std::string | getControllerName (int device) const |
| std::vector< int > | getConnectedControllers () |
| void | startControllerVibration (int device, float weakMagnitude, float strongMagnitude, int durationMs=0) const |
| Vector2 | getVector (const std::string &minX, const std::string &maxX, const std::string &minY, const std::string &maxY, float deadzone=-1.0f) const |
| float | getAxis (const std::string &minAction, const std::string &maxAction) const |
| bool | isActionJustPressed (const std::string &name) const |
| bool | isActionJustReleased (const std::string &name) const |
| bool | isActionPressed (const std::string &name) const |
Public Attributes | |
| bool | shouldQuit = false |
The Input service lets you obtain information about Actions, current state of the mouse, current state of controller buttons, keys, etc... It's basically the same thing as the Godot Input class. A lot of the functions are of the same name, and are pretty self explanatory.
Make sure to also check out the input example!
| float Input::getAxis | ( | const std::string & | minAction, |
| const std::string & | maxAction | ||
| ) | const |
| std::vector< int > Input::getConnectedControllers | ( | ) |
| float Input::getControllerAxis | ( | int | device, |
| ControllerAxis | axis | ||
| ) | const |
| std::string Input::getControllerGUID | ( | int | device | ) | const |
| std::string Input::getControllerName | ( | int | device | ) | const |
| std::optional< Vector2 > Input::getMousePosition | ( | ) | const |
| Vector2 Input::getVector | ( | const std::string & | minX, |
| const std::string & | maxX, | ||
| const std::string & | minY, | ||
| const std::string & | maxY, | ||
| float | deadzone = -1.0f |
||
| ) | const |
| bool Input::isActionJustPressed | ( | const std::string & | name | ) | const |
| bool Input::isActionJustReleased | ( | const std::string & | name | ) | const |
| bool Input::isActionPressed | ( | const std::string & | name | ) | const |
| bool Input::isControllerButtonPressed | ( | int | device, |
| ControllerButton | button | ||
| ) | const |
| bool Input::isKeyLabelPressed | ( | const char * | label | ) | const |
| bool Input::isKeyPressed | ( | Keycode | key | ) | const |
| bool Input::isMouseButtonPressed | ( | MouseButton | button | ) | const |
| void Input::startControllerVibration | ( | int | device, |
| float | weakMagnitude, | ||
| float | strongMagnitude, | ||
| int | durationMs = 0 |
||
| ) | const |
| void Input::update | ( | float | deltaTime | ) |
| bool Input::shouldQuit = false |