Closed DynamicField closed 1 year ago
Describe the issue: Using the ECS Input system, holding a key while it is in KeyDownHeld mode will switch it to Idle on the next frame.
KeyDownHeld
Idle
Please provide the steps to reproduce if possible:
Copy and paste the following code into samples/InputEcsPipeline/main.c, inside the system's lambda:
samples/InputEcsPipeline/main.c
scheduler.RegisterSystem([&](auto delta, auto catalogue) { ComponentView<NovelRT::Ecs::Input::InputEventComponent> events = catalogue.template GetComponentView<NovelRT::Ecs::Input::InputEventComponent>(); ComponentView<TransformComponent> transforms = catalogue.template GetComponentView<TransformComponent>(); NovelRT::Maths::GeoVector2F scale = NovelRT::Maths::GeoVector2F::Zero(); NovelRT::Maths::GeoVector2F move = NovelRT::Maths::GeoVector2F::Zero(); NovelRT::Ecs::Input::InputEventComponent input; + if (events.TryGetComponent(up, input)) { + switch (input.state) { + case KeyState::Idle: + logger.logInfo("[Up] Idle"); + break; + case KeyState::KeyUp: + logger.logInfo("[Up] KeyUp"); + break; + case KeyState::KeyDown: + logger.logInfo("[Up] KeyDown"); + break; + case KeyState::KeyDownHeld: + logger.logInfo("[Up] KeyDownHeld"); + break; + } + } else { + logger.logInfo("[Up] Idle (TryGetComponent failed!)"); + }
KeyDown
Expected behaviour: While pressed, the key state should stay at KeyDownHeld until the key is released.
Please tell us about your environment:
Describe the issue: Using the ECS Input system, holding a key while it is in
KeyDownHeld
mode will switch it toIdle
on the next frame.Please provide the steps to reproduce if possible:
Copy and paste the following code into
samples/InputEcsPipeline/main.c
, inside the system's lambda:KeyDown
,KeyDownHeld
, andIdle
Expected behaviour: While pressed, the key state should stay at
KeyDownHeld
until the key is released.Please tell us about your environment: