Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
Input Class Reference

#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< Vector2getMousePosition () 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
 

Detailed Description

Input class

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!

Member Function Documentation

◆ getAxis()

float Input::getAxis ( const std::string &  minAction,
const std::string &  maxAction 
) const

◆ getConnectedControllers()

std::vector< int > Input::getConnectedControllers ( )

◆ getControllerAxis()

float Input::getControllerAxis ( int  device,
ControllerAxis  axis 
) const

◆ getControllerGUID()

std::string Input::getControllerGUID ( int  device) const

◆ getControllerName()

std::string Input::getControllerName ( int  device) const

◆ getMousePosition()

std::optional< Vector2 > Input::getMousePosition ( ) const

◆ getVector()

Vector2 Input::getVector ( const std::string &  minX,
const std::string &  maxX,
const std::string &  minY,
const std::string &  maxY,
float  deadzone = -1.0f 
) const

◆ isActionJustPressed()

bool Input::isActionJustPressed ( const std::string &  name) const

◆ isActionJustReleased()

bool Input::isActionJustReleased ( const std::string &  name) const

◆ isActionPressed()

bool Input::isActionPressed ( const std::string &  name) const

◆ isControllerButtonPressed()

bool Input::isControllerButtonPressed ( int  device,
ControllerButton  button 
) const

◆ isKeyLabelPressed()

bool Input::isKeyLabelPressed ( const char *  label) const

◆ isKeyPressed()

bool Input::isKeyPressed ( Keycode  key) const

◆ isMouseButtonPressed()

bool Input::isMouseButtonPressed ( MouseButton  button) const

◆ startControllerVibration()

void Input::startControllerVibration ( int  device,
float  weakMagnitude,
float  strongMagnitude,
int  durationMs = 0 
) const

◆ update()

void Input::update ( float  deltaTime)

Member Data Documentation

◆ shouldQuit

bool Input::shouldQuit = false

The documentation for this class was generated from the following files: