Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::SceneInput Class Referencefinal

#include <SceneInput.h>

+ Inheritance diagram for Divide::SceneInput:

Classes

struct  KeyLogState
 
struct  MouseLogState
 

Public Types

using KeyMapCache = hashMap< Input::KeyCode, PressReleaseActionCbks >
 
using MouseMapCache = hashMap< Input::MouseButton, PressReleaseActionCbks >
 
using JoystickMapCacheEntry = ska::bytell_hash_map< JoystickMapKey, PressReleaseActionCbks, JoystickMapKeyHash >
 
using JoystickMapCache = ska::bytell_hash_map< BaseType< Input::Joystick >, JoystickMapCacheEntry >
 
using KeyMap = hashMap< Input::KeyCode, PressReleaseActions >
 
using MouseMap = hashMap< Input::MouseButton, PressReleaseActions >
 
using JoystickMapEntry = ska::bytell_hash_map< JoystickMapKey, PressReleaseActions, JoystickMapKeyHash >
 
using JoystickMap = ska::bytell_hash_map< BaseType< Input::Joystick >, JoystickMapEntry >
 
using KeyLog = vector< KeyLogState >
 
using MouseBtnLog = vector< MouseLogState >
 

Public Member Functions

 SceneInput (Scene &parentScene)
 
bool onKeyDown (const Input::KeyEvent &arg) override
 Keyboard: return true if input was consumed.
 
bool onKeyUp (const Input::KeyEvent &arg) override
 
bool joystickButtonPressed (const Input::JoystickEvent &arg) override
 Joystick or Gamepad: return true if input was consumed.
 
bool joystickButtonReleased (const Input::JoystickEvent &arg) override
 
bool joystickAxisMoved (const Input::JoystickEvent &arg) override
 
bool joystickPovMoved (const Input::JoystickEvent &arg) override
 
bool joystickBallMoved (const Input::JoystickEvent &arg) override
 
bool joystickAddRemove (const Input::JoystickEvent &arg) override
 
bool joystickRemap (const Input::JoystickEvent &arg) override
 
bool mouseMoved (const Input::MouseMoveEvent &arg) override
 Mouse: return true if input was consumed.
 
bool mouseButtonPressed (const Input::MouseButtonEvent &arg) override
 
bool mouseButtonReleased (const Input::MouseButtonEvent &arg) override
 
bool onTextEvent (const Input::TextEvent &arg) override
 
bool addKeyMapping (Input::KeyCode key, const PressReleaseActions::Entry &keyCbks)
 
bool removeKeyMapping (Input::KeyCode key)
 Returns false if the key wasn't previously assigned.
 
bool getKeyMapping (Input::KeyCode key, PressReleaseActionCbks &keyCbksOut)
 
bool addMouseMapping (Input::MouseButton button, const PressReleaseActions::Entry &btnCbks)
 
bool removeMouseMapping (Input::MouseButton button)
 Returns false if the button wasn't previously assigned.
 
bool getMouseMapping (Input::MouseButton button, PressReleaseActionCbks &btnCbksOut)
 
bool addJoystickMapping (Input::Joystick device, Input::JoystickElementType elementType, U32 id, const PressReleaseActions::Entry &btnCbks)
 
bool removeJoystickMapping (Input::Joystick device, Input::JoystickElementType elementType, U32 id)
 Returns false if the button wasn't previously assigned.
 
bool getJoystickMapping (Input::Joystick device, Input::JoystickElementType elementType, U32 id, PressReleaseActionCbks &btnCbksOut)
 
InputActionListactionList () noexcept
 
U8 getPlayerIndexForDevice (U8 deviceIndex) const
 
void flushCache ()
 
void onPlayerAdd (U8 index)
 
void onPlayerRemove (U8 index)
 
void onSetActive ()
 
void onRemoveActive ()
 
- Public Member Functions inherited from Divide::Input::InputAggregatorInterface
virtual ~InputAggregatorInterface ()=default
 
virtual bool onKeyDown (const KeyEvent &arg)=0
 Keyboard: return true if input was consumed.
 
virtual bool onKeyUp (const KeyEvent &arg)=0
 
virtual bool mouseMoved (const MouseMoveEvent &arg)=0
 Mouse: return true if input was consumed.
 
virtual bool mouseButtonPressed (const MouseButtonEvent &arg)=0
 
virtual bool mouseButtonReleased (const MouseButtonEvent &arg)=0
 
virtual bool joystickButtonPressed (const JoystickEvent &arg)=0
 Joystick or Gamepad: return true if input was consumed.
 
virtual bool joystickButtonReleased (const JoystickEvent &arg)=0
 
virtual bool joystickAxisMoved (const JoystickEvent &arg)=0
 
virtual bool joystickPovMoved (const JoystickEvent &arg)=0
 
virtual bool joystickBallMoved (const JoystickEvent &arg)=0
 
virtual bool joystickAddRemove (const JoystickEvent &arg)=0
 
virtual bool joystickRemap (const JoystickEvent &arg)=0
 
virtual bool onTextEvent (const TextEvent &arg)=0
 

Protected Member Functions

bool handleCallbacks (const PressReleaseActionCbks &cbks, const InputParams &params, bool onPress)
 

Private Attributes

Scene_parentScene
 
KeyMap _keyMap
 
MouseMap _mouseMap
 
JoystickMap _joystickMap
 
KeyMapCache _keyMapCache
 
MouseMapCache _mouseMapCache
 
JoystickMapCache _joystickMapCache
 
InputActionList _actionList
 
hashMap< U8, KeyLog_keyLog
 
hashMap< U8, MouseBtnLog_mouseBtnLog
 

Detailed Description

Definition at line 74 of file SceneInput.h.

Member Typedef Documentation

◆ JoystickMap

Definition at line 85 of file SceneInput.h.

◆ JoystickMapCache

Definition at line 80 of file SceneInput.h.

◆ JoystickMapCacheEntry

◆ JoystickMapEntry

◆ KeyLog

Definition at line 100 of file SceneInput.h.

◆ KeyMap

◆ KeyMapCache

◆ MouseBtnLog

◆ MouseMap

◆ MouseMapCache

Constructor & Destructor Documentation

◆ SceneInput()

Divide::SceneInput::SceneInput ( Scene parentScene)
explicit

Definition at line 38 of file SceneInput.cpp.

Member Function Documentation

◆ actionList()

InputActionList & Divide::SceneInput::actionList ( )
noexcept

Definition at line 539 of file SceneInput.cpp.

◆ addJoystickMapping()

bool Divide::SceneInput::addJoystickMapping ( Input::Joystick  device,
Input::JoystickElementType  elementType,
U32  id,
const PressReleaseActions::Entry btnCbks 
)

Returns false if the button is already assigned. Call removeJoystickMapping for the specified key first

Definition at line 478 of file SceneInput.cpp.

◆ addKeyMapping()

bool Divide::SceneInput::addKeyMapping ( Input::KeyCode  key,
const PressReleaseActions::Entry keyCbks 
)

Returns false if the key is already assigned and couldn't be merged Call removeKeyMapping for the specified key first

Definition at line 400 of file SceneInput.cpp.

◆ addMouseMapping()

bool Divide::SceneInput::addMouseMapping ( Input::MouseButton  button,
const PressReleaseActions::Entry btnCbks 
)

Returns false if the button is already assigned. Call removeButtonMapping for the specified key first

Definition at line 439 of file SceneInput.cpp.

◆ flushCache()

void Divide::SceneInput::flushCache ( )

Definition at line 544 of file SceneInput.cpp.

◆ getJoystickMapping()

bool Divide::SceneInput::getJoystickMapping ( Input::Joystick  device,
Input::JoystickElementType  elementType,
U32  id,
PressReleaseActionCbks btnCbksOut 
)

Returns true if the button has a valid mapping and sets the callback output to the mapping's function

Definition at line 507 of file SceneInput.cpp.

◆ getKeyMapping()

bool Divide::SceneInput::getKeyMapping ( Input::KeyCode  key,
PressReleaseActionCbks keyCbksOut 
)

Returns true if the key has a valid mapping and sets the callback output to the mapping's function

Definition at line 417 of file SceneInput.cpp.

◆ getMouseMapping()

bool Divide::SceneInput::getMouseMapping ( Input::MouseButton  button,
PressReleaseActionCbks btnCbksOut 
)

Returns true if the button has a valid mapping and sets the callback output to the mapping's function

Definition at line 456 of file SceneInput.cpp.

◆ getPlayerIndexForDevice()

U8 Divide::SceneInput::getPlayerIndexForDevice ( U8  deviceIndex) const

Definition at line 66 of file SceneInput.cpp.

◆ handleCallbacks()

bool Divide::SceneInput::handleCallbacks ( const PressReleaseActionCbks cbks,
const InputParams params,
bool  onPress 
)
protected

Definition at line 71 of file SceneInput.cpp.

◆ joystickAddRemove()

bool Divide::SceneInput::joystickAddRemove ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 268 of file SceneInput.cpp.

◆ joystickAxisMoved()

bool Divide::SceneInput::joystickAxisMoved ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 199 of file SceneInput.cpp.

◆ joystickBallMoved()

bool Divide::SceneInput::joystickBallMoved ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 245 of file SceneInput.cpp.

◆ joystickButtonPressed()

bool Divide::SceneInput::joystickButtonPressed ( const Input::JoystickEvent arg)
overridevirtual

Joystick or Gamepad: return true if input was consumed.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 172 of file SceneInput.cpp.

◆ joystickButtonReleased()

bool Divide::SceneInput::joystickButtonReleased ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 186 of file SceneInput.cpp.

◆ joystickPovMoved()

bool Divide::SceneInput::joystickPovMoved ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 222 of file SceneInput.cpp.

◆ joystickRemap()

bool Divide::SceneInput::joystickRemap ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 273 of file SceneInput.cpp.

◆ mouseButtonPressed()

bool Divide::SceneInput::mouseButtonPressed ( const Input::MouseButtonEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 325 of file SceneInput.cpp.

◆ mouseButtonReleased()

bool Divide::SceneInput::mouseButtonReleased ( const Input::MouseButtonEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 358 of file SceneInput.cpp.

◆ mouseMoved()

bool Divide::SceneInput::mouseMoved ( const Input::MouseMoveEvent arg)
overridevirtual

Mouse: return true if input was consumed.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 278 of file SceneInput.cpp.

◆ onKeyDown()

bool Divide::SceneInput::onKeyDown ( const Input::KeyEvent arg)
overridevirtual

Keyboard: return true if input was consumed.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 108 of file SceneInput.cpp.

◆ onKeyUp()

bool Divide::SceneInput::onKeyUp ( const Input::KeyEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 140 of file SceneInput.cpp.

◆ onPlayerAdd()

void Divide::SceneInput::onPlayerAdd ( U8  index)

Definition at line 54 of file SceneInput.cpp.

◆ onPlayerRemove()

void Divide::SceneInput::onPlayerRemove ( U8  index)

Definition at line 60 of file SceneInput.cpp.

◆ onRemoveActive()

void Divide::SceneInput::onRemoveActive ( )

Definition at line 49 of file SceneInput.cpp.

◆ onSetActive()

void Divide::SceneInput::onSetActive ( )

Definition at line 44 of file SceneInput.cpp.

◆ onTextEvent()

bool Divide::SceneInput::onTextEvent ( const Input::TextEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 390 of file SceneInput.cpp.

◆ removeJoystickMapping()

bool Divide::SceneInput::removeJoystickMapping ( Input::Joystick  device,
Input::JoystickElementType  elementType,
U32  id 
)

Returns false if the button wasn't previously assigned.

Definition at line 488 of file SceneInput.cpp.

◆ removeKeyMapping()

bool Divide::SceneInput::removeKeyMapping ( Input::KeyCode  key)

Returns false if the key wasn't previously assigned.

Definition at line 405 of file SceneInput.cpp.

◆ removeMouseMapping()

bool Divide::SceneInput::removeMouseMapping ( Input::MouseButton  button)

Returns false if the button wasn't previously assigned.

Definition at line 444 of file SceneInput.cpp.

Member Data Documentation

◆ _actionList

InputActionList Divide::SceneInput::_actionList
private

Definition at line 176 of file SceneInput.h.

◆ _joystickMap

JoystickMap Divide::SceneInput::_joystickMap
private

Definition at line 170 of file SceneInput.h.

◆ _joystickMapCache

JoystickMapCache Divide::SceneInput::_joystickMapCache
private

Definition at line 174 of file SceneInput.h.

◆ _keyLog

hashMap<U8, KeyLog> Divide::SceneInput::_keyLog
private

Definition at line 178 of file SceneInput.h.

◆ _keyMap

KeyMap Divide::SceneInput::_keyMap
private

Definition at line 168 of file SceneInput.h.

◆ _keyMapCache

KeyMapCache Divide::SceneInput::_keyMapCache
private

Definition at line 172 of file SceneInput.h.

◆ _mouseBtnLog

hashMap<U8, MouseBtnLog> Divide::SceneInput::_mouseBtnLog
private

Definition at line 179 of file SceneInput.h.

◆ _mouseMap

MouseMap Divide::SceneInput::_mouseMap
private

Definition at line 169 of file SceneInput.h.

◆ _mouseMapCache

MouseMapCache Divide::SceneInput::_mouseMapCache
private

Definition at line 173 of file SceneInput.h.

◆ _parentScene

Scene& Divide::SceneInput::_parentScene
private

Definition at line 166 of file SceneInput.h.


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