KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::WindowsInput Class Reference
Inheritance diagram for Karma::WindowsInput:
Collaboration diagram for Karma::WindowsInput:

Public Member Functions

void SetEventCallback (const EventCallbackFn &callback, Window *window) override
 Set the event callback for the Input.
 
- Public Member Functions inherited from Karma::Input
 Input (InputData &inputDatRef)
 A constructor for initializing the Input class.
 
 ~Input ()
 Destructor.
 
void SetGamepadMapping ()
 Set the gamepad mapping based on a database (../Resources/Misc/GameControllerDB.txt) The mapping is done by taking XBox controller as a reference. For the need of such mapping please see https://www.glfw.org/docs/3.3/input_guide.html#gamepad_mapping.
 

Protected Member Functions

virtual bool IsKeyPressedImpl (int keycode) override
 Declaration of IsKeyPressed function to be implemented.
 
virtual bool IsMouseButtonPressedImpl (int button) override
 Declaration of IsMouseButtonPressed function to be implemeted.
 
virtual bool IsMouseButtonReleasedImpl (int button) override
 Declaration of IsMouseButtonReleased function to be implemented.
 
virtual bool IsControllerButtonPressedImpl (int button, int cID) override
 Declaration of IsControllerButtonPressed function to be implemented.
 
virtual float ControllerAxisPivotValImpl (int axis, int cID) override
 Declaration of ControllerAxisPivotVal function to be implemented.
 
virtual std::pair< float, float > GetMousePositionImpl () override
 Declaration of GetMousePosition function to be implemented.
 
virtual float GetMouseXImpl () override
 Declaration of GetMouseX function to be implemented.
 
virtual float GetMouseYImpl () override
 Declaration of GetMouseY function to be implemented.
 
void OnControllerDeviceConnected (ControllerDeviceConnectedEvent &e)
 
void OnControllerDeviceDisconnected (ControllerDeviceDisconnectedEvent &e)
 
- Protected Member Functions inherited from Karma::Input
const std::list< std::shared_ptr< ControllerDevice > > & GetControllerDevices () const
 Getter for connected controller devices.
 
void AddControllerDevice (std::shared_ptr< ControllerDevice > device)
 Add to the cache supplied device.
 

Protected Attributes

WindowsInputData m_Data
 

Additional Inherited Members

- Public Types inherited from Karma::Input
using EventCallbackFn = std::function<void(Event&)>
 
- Static Public Member Functions inherited from Karma::Input
static bool IsKeyPressed (int keycode)
 Polling function for inquiry of key press.
 
static bool IsMouseButtonPressed (int button)
 Polling function for inquiry of mouse button press.
 
static bool IsMouseButtonReleased (int button)
 Polling function for the inquiry of mouse button release.
 
static bool IsControllerButtonPressed (int button, int cID)
 Polling function for the inquiry of game controller button pressed action.
 
static float ControllerAxisPivotVal (int axis, int cID)
 Polling function for the inquiry of the Axis pivot value (analog stick deflection for instance)
 
static std::pair< float, float > GetMousePosition ()
 Polling function for the inquiry of mouse position (abscissa, ordinate)
 
static float GetMouseX ()
 Polling function for the inquiry of abscissa.
 
static float GetMouseY ()
 Polling function for the inquiry of ordinate.
 
static InputRegisteringAPI GetAPI ()
 Getter for API (enum) in use for input.
 
static void DeInit ()
 Deinitialize the Input system.
 
static void Init ()
 Initialize the Input system for Karma.
 
static std::shared_ptr< InputGetInputInstance ()
 Getter for the Input instance.
 
static void DisplayControllerDevices ()
 For debugging purposes, a function to print out the number of connected devices.
 
- Static Protected Member Functions inherited from Karma::Input
static void SetConnectedJoySticks ()
 Create a list of connected joysticks (gamepads)
 
- Static Protected Attributes inherited from Karma::Input
static std::list< std::shared_ptr< ControllerDevice > > m_ControllerDevices
 

Member Function Documentation

◆ ControllerAxisPivotValImpl()

float Karma::WindowsInput::ControllerAxisPivotValImpl ( int axis,
int cID )
overrideprotectedvirtual

Declaration of ControllerAxisPivotVal function to be implemented.

Parameters
axisThe horizontal/vertical directional deflection of the axis (GLFW axes). GLFW_GAMEPAD_AXIS_LEFT_Y is an example.
cIDThe ID of the attached controller, defined in GLFW
Since
Karma 1.0.0

Implements Karma::Input.

◆ GetMousePositionImpl()

std::pair< float, float > Karma::WindowsInput::GetMousePositionImpl ( )
overrideprotectedvirtual

Declaration of GetMousePosition function to be implemented.

Since
Karma 1.0.0

Implements Karma::Input.

◆ GetMouseXImpl()

float Karma::WindowsInput::GetMouseXImpl ( )
overrideprotectedvirtual

Declaration of GetMouseX function to be implemented.

Since
Karma 1.0.0

Implements Karma::Input.

◆ GetMouseYImpl()

float Karma::WindowsInput::GetMouseYImpl ( )
overrideprotectedvirtual

Declaration of GetMouseY function to be implemented.

Since
Karma 1.0.0

Implements Karma::Input.

◆ IsControllerButtonPressedImpl()

bool Karma::WindowsInput::IsControllerButtonPressedImpl ( int button,
int cID )
overrideprotectedvirtual

Declaration of IsControllerButtonPressed function to be implemented.

Parameters
buttonThe integer corresponding to gamepad controller button. For instance GLFW_GAMEPAD_BUTTON_A macro.
cIDThe controller device ID, defined in GLFW
Since
Karma 1.0.0

Implements Karma::Input.

◆ IsKeyPressedImpl()

bool Karma::WindowsInput::IsKeyPressedImpl ( int keycode)
overrideprotectedvirtual

Declaration of IsKeyPressed function to be implemented.

Parameters
keycodeGLFW defined code for keys, for instance GLFW_KEY_SPACE macro https://www.glfw.org/docs/3.3/group__keys.html
Since
Karma 1.0.0

Implements Karma::Input.

◆ IsMouseButtonPressedImpl()

bool Karma::WindowsInput::IsMouseButtonPressedImpl ( int button)
overrideprotectedvirtual

Declaration of IsMouseButtonPressed function to be implemeted.

Parameters
buttonThe integer corresponding to mouse button. For instance GLFW_MOUSE_BUTTON_1 macro.
Since
Karma 1.0.0

Implements Karma::Input.

◆ IsMouseButtonReleasedImpl()

bool Karma::WindowsInput::IsMouseButtonReleasedImpl ( int button)
overrideprotectedvirtual

Declaration of IsMouseButtonReleased function to be implemented.

Parameters
buttonThe integer corresponding to mouse button. For instance GLFW_MOUSE_BUTTON_1 macro.
Since
Karma 1.0.0

Implements Karma::Input.

◆ SetEventCallback()

void Karma::WindowsInput::SetEventCallback ( const EventCallbackFn & callback,
Window * window )
overridevirtual

Set the event callback for the Input.

Parameters
callbackThe function to be called when Input event is receieved from GLFW. Usually Application::OnEvent(), which dispatches the Events, is fed into as lambda for instance in glfwSetJoystickCallback.
windowThe handle of GLFW window
Since
Karma 1.0.0

Implements Karma::Input.


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