KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::MacInput Class Reference

Input class for MacOS. More...

#include <MacInput.h>

Inheritance diagram for Karma::MacInput:
Collaboration diagram for Karma::MacInput:

Public Member Functions

 MacInput ()
 A constructor.
 
void SetEventCallback (const EventCallbackFn &callback, Window *window) override
 Set the event callback for MacOS.
 
- 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
 MacOS implementation of Linux IsKeyPressed function.
 
virtual bool IsMouseButtonPressedImpl (int button) override
 MacOS implementation of Linux IsMouseButtonPressed function.
 
virtual bool IsMouseButtonReleasedImpl (int button) override
 MacOS implementation of IsMouseButtonReleased function.
 
virtual bool IsControllerButtonPressedImpl (int button, int cID) override
 MacOS implementation of IsControllerButtonPressed function.
 
virtual float ControllerAxisPivotValImpl (int axis, int cID) override
 MacOS implementation of ControllerAxisPivotVal function.
 
virtual std::pair< float, float > GetMousePositionImpl () override
 MacOS implementation of GetMousePosition function.
 
virtual float GetMouseXImpl () override
 MacOS implementation of GetMouseX function.
 
virtual float GetMouseYImpl () override
 MacOS implementation of GetMouseY function.
 
- 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

MacInputData 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
 

Detailed Description

Input class for MacOS.

Constructor & Destructor Documentation

◆ MacInput()

Karma::MacInput::MacInput ( )

A constructor.

Since
Karma 1.0.0

Member Function Documentation

◆ ControllerAxisPivotValImpl()

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

MacOS implementation of ControllerAxisPivotVal function.

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::MacInput::GetMousePositionImpl ( )
overrideprotectedvirtual

MacOS implementation of GetMousePosition function.

Since
Karma 1.0.0

Implements Karma::Input.

◆ GetMouseXImpl()

float Karma::MacInput::GetMouseXImpl ( )
overrideprotectedvirtual

MacOS implementation of GetMouseX function.

Since
Karma 1.0.0

Implements Karma::Input.

◆ GetMouseYImpl()

float Karma::MacInput::GetMouseYImpl ( )
overrideprotectedvirtual

MacOS implementation of GetMouseY function.

Since
Karma 1.0.0

Implements Karma::Input.

◆ IsControllerButtonPressedImpl()

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

MacOS implementation of IsControllerButtonPressed function.

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::MacInput::IsKeyPressedImpl ( int keycode)
overrideprotectedvirtual

MacOS implementation of Linux IsKeyPressed function.

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::MacInput::IsMouseButtonPressedImpl ( int button)
overrideprotectedvirtual

MacOS implementation of Linux IsMouseButtonPressed function.

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::MacInput::IsMouseButtonReleasedImpl ( int button)
overrideprotectedvirtual

MacOS implementation of IsMouseButtonReleased function.

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::MacInput::SetEventCallback ( const EventCallbackFn & callback,
Window * window )
overridevirtual

Set the event callback for MacOS.

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: