Jazz2::Editor::EditorInputRouter class

Takes the keyboard, the mouse, the touch screen and the gamepad in the level editor.

Gives the input to the interface, to the active tool and to the view of the level, and while the level is played to the game, except the keys of the actions of playing. The side buttons of a mouse are pressed as keys of their own, past the last key the game knows, so they never reach it. Knows what the editor was used with last (see InputModality), moves the cursor of a gamepad and knows whether the pointer holds a stroke of a tool, so the changes made meanwhile from elsewhere end it first, see CancelInteractions().

Constructors, destructors, conversion operators

EditorInputRouter(IEditorContext& context, IInputRouterHost& host, PlayTestController& playTest)
Creates the input of an editor, playTest tells whether the level is played.
EditorInputRouter(const EditorInputRouter&) deleted

Public functions

auto operator=(const EditorInputRouter&) -> EditorInputRouter& deleted
void Update(float timeMult)
Reads the gamepad and uses the editor by it, and moves on the gestures of the touch screen, every frame.
void OnKeyPressed(const KeyboardEvent& event)
Called when a key is pressed.
void OnKeyReleased(const KeyboardEvent& event)
Called when a key is released.
void OnTextInput(const TextInputEvent& event)
Called when text is typed.
void OnTouchEvent(const TouchEvent& event)
Called for a touch event.
void OnMouseDown(const MouseEvent& event)
Called when a button of the mouse is pressed.
void OnMouseUp(const MouseEvent& event)
Called when a button of the mouse is released.
void OnMouseMove(const MouseState& state)
Called when the mouse is moved.
void OnMouseWheel(const ScrollEvent& event)
Called when the wheel of the mouse is turned.
void PointerMove(Vector2f pos)
Moves the pointer to a position on the screen.
void SetInputModality(InputModality modality)
Switches what the editor is used with, the hints follow.
void ForgetHeldButtons()
Forgets the mouse buttons pressed, for a press that isn't of the mouse of the system, as from the debug console.
auto GetInputModality() const -> InputModality
Returns what the editor was used with last.
auto GetGamepadCursor() const -> Vector2f
Returns the cursor moved by a gamepad, in pixels of the screen.
void SetGamepadCursor(Vector2f pos)
Places the cursor of a gamepad, the pointer isn't moved with it.
void ShowToolMenu(Vector2f pos)
Shows the menu of tools in a ring around a position on the screen.
auto GetRadialMenu() const -> RadialMenu*
Returns the menu of tools in a ring shown, or nullptr.
auto GetModifiers() const -> std::int32_t
Returns the modifier keys held, as the last key event had them.
auto GetPointerPos(Vector2f& pos) const -> bool
Returns the last position of the pointer, false if it's not known yet.
auto GetHoverPointer(ToolPointer& pointer) -> bool
Returns the pointer over the view, false if it's not over the view.
auto IsToolPointerDown() const -> bool
Returns true while the pointer holds a stroke of the active tool.
auto IsInToolCallback() const -> bool
Returns true while the tool is being told about the pointer, the commands it runs then are its own.
auto IsHandlingShortcut() const -> bool
Returns true while an action is run by its key, not chosen from a menu or by a button.
void CancelInteractions(bool releasePointer)
Ends what the pointer is in the middle of, see EditorSession::CancelInteractions().
void ReleasePointer(bool panning)
Forgets that the pointer holds a stroke of the tool, and with panning that it moves the view.

Function documentation

void Jazz2::Editor::EditorInputRouter::CancelInteractions(bool releasePointer)

Ends what the pointer is in the middle of, see EditorSession::CancelInteractions().

The stroke of a tool that follows the pointer is cancelled, as by Esc, and with releasePointer also what the interface holds by the pointer.