19 _entries.reserve( actions.entries().size() );
27 for (
const U16 id :
entry.pressIDs() )
31 for (
const U16 id :
entry.releaseIDs() )
39 : _parentScene( parentScene )
62 _keyLog.find( index )->second.clear();
89 if ( !actions.empty() )
91 for (
const auto& action : actions )
147 Input::InputState::RELEASED
153 if ( getKeyMapping( arg.
_key, cbks ) )
155 return handleCallbacks( cbks,
209 arg._element._data._gamePad ? 1 : 0,
210 arg._element._data._deadZone,
211 arg._element._data._dataSigned,
216 return handleCallbacks( cbks, params,
true );
232 to_I32(arg._element._data._data),
239 return handleCallbacks( cbks, params,
true );
255 arg._element._data._gamePad ? 1 : 0,
256 arg._element._data._smallDataSigned[0],
257 arg._element._data._smallDataSigned[1],
262 return handleCallbacks( cbks, params,
true );
292 const U8 speed = std::abs(wheel) > 1 ? 255u : 128u;
293 state.
_zoom.
push( { speed, wheel > 0 ? MoveDirection::POSITIVE : MoveDirection::NEGATIVE} );
296 else if ( state.cameraLockedToMouse() )
307 const U8 speed = std::abs(xRel) > 1 ? 255u : 192u;
308 state.
_angleLR.
push( {speed, xRel > 0 ? MoveDirection::POSITIVE : MoveDirection::NEGATIVE} );
317 const U8 speed = std::abs( yRel ) > 1 ? 255u : 192u;
318 state.
_angleUD.
push( {speed, yRel > 0 ? MoveDirection::POSITIVE : MoveDirection::NEGATIVE} );
322 return Attorney::SceneInput::mouseMoved( &_parentScene, arg );
332 ._button = arg.button(),
333 ._state = Input::InputState::PRESSED
339 if ( getMouseMapping( arg.button(), cbks ) )
352 return handleCallbacks( cbks, params,
true );
365 ._button = arg.button(),
366 ._state = Input::InputState::RELEASED
372 if ( getMouseMapping( arg.button(), cbks ) )
384 return handleCallbacks( cbks, params,
false );
402 return _keyMap[key].add( keyCbks );
407 const KeyMap::iterator it = _keyMap.find( key );
408 if ( it != std::end( _keyMap ) )
419 const KeyMapCache::const_iterator itCache = _keyMapCache.find( key );
420 if ( itCache != std::cend(_keyMapCache) )
422 keyCbksOut = itCache->second;
426 const KeyMap::const_iterator it = _keyMap.find( key );
427 if ( it != std::cend( _keyMap ) )
430 keyCbksOut.
from( actions, _actionList );
431 insert( _keyMapCache, key, keyCbksOut );
441 return _mouseMap[button].add( btnCbks );
446 const MouseMap::iterator it = _mouseMap.find( button );
447 if ( it != std::end( _mouseMap ) )
449 _mouseMap.erase( it );
458 const MouseMapCache::const_iterator itCache = _mouseMapCache.find( button );
459 if ( itCache != std::cend( _mouseMapCache ) )
461 btnCbksOut = itCache->second;
466 const MouseMap::const_iterator it = _mouseMap.find( button );
467 if ( it != std::cend( _mouseMap ) )
470 btnCbksOut.
from( actions, _actionList );
471 insert( _mouseMapCache, button, btnCbksOut );
482 ._element = elementType
485 return _joystickMap[
to_base( device )][key].add( btnCbks );
492 const JoystickMapEntry::iterator it =
entry.find(
495 ._element = elementType
498 if ( it != std::end(
entry ) )
511 const JoystickMapCacheEntry::const_iterator itCache =
entry.find(
514 ._element = elementType
516 if ( itCache != std::cend(
entry ) )
518 btnCbksOut = itCache->second;
523 const JoystickMapEntry::const_iterator it = entry2.find(
526 ._element = elementType
528 if ( it != std::cend( entry2 ) )
531 btnCbksOut.
from( actions, _actionList );
544 void SceneInput::flushCache()
546 _keyMapCache.clear();
547 _mouseMapCache.clear();
548 _joystickMapCache.clear();
Handle console commands that start with a forward slash.
void insert(eastl::vector< T, A1 > &target, const eastl::vector< T, A2 > &source)
Project const SceneEntry & entry
constexpr auto to_base(const Type value) -> Type
void push(const MoveDirectionRequest direction) noexcept
std::array< vector< DELEGATE< void, InputParams > >, to_base(PressReleaseActions::Action::COUNT)> _actions
eastl::set< Input::KeyCode > _modifiers
void from(const PressReleaseActions &actions, const InputActionList &actionList)