23#include "guillaume/systems/keyboard_control.hpp"
53 if (!keyboardEvent->getIsDownEvent()) {
57 const auto keycode = keyboardEvent->getKeycode();
61 case utility::event::KeyboardEvent::KeyCode::Left:
62 text.moveCursorLeft();
65 case utility::event::KeyboardEvent::KeyCode::Right:
66 text.moveCursorRight();
69 case utility::event::KeyboardEvent::KeyCode::Home:
70 text.setCursorPosition(0);
73 case utility::event::KeyboardEvent::KeyCode::End:
74 text.setCursorPosition(text.getContent().size());
77 case utility::event::KeyboardEvent::KeyCode::Delete:
78 if (text.deleteCharacterAfter()) {
79 getLogger().debug() <<
"Deleted character after cursor";
83 case utility::event::KeyboardEvent::KeyCode::Backspace:
84 if (text.deleteCharacterBefore()) {
85 getLogger().debug() <<
"Deleted character before cursor";
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
SystemFiller(Phase phase)
ComponentType & getComponent(const ecs::Entity::Identifier &entityIdentifier)
Get a component of an entity from the bound registry, to read or modify it.
Hands each engine event to the listeners subscribed to its type.
void consumeNextEvent(void)
EventManager(EventBus &eventBus)
std::shared_ptr< EventType > getLastEvent(void)
Decides which single entity has the keyboard focus.
void prepare(void) override
Take the next pending keyboard event, once per frame.
virtual void update(const ecs::Entity::Identifier &entityIdentifier) override
Apply the current keyboard event to the text of one entity.
KeyboardControl(event::EventBus &eventBus)
Create the system, in the Event phase, and subscribe it to keyboard events.
void cleanup(void) override
Does nothing.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Delivery of engine events to the systems that subscribed to them.
Rules. Every class here runs each frame on the entities that have the components it declares.