Class InputSystem
Defined in File input-system.h
Inheritance Relationships
Base Types
public CE::Input::System(Class System)public CE::State::Singleton< InputSystem >(Template Class Singleton)
Class Documentation
-
class InputSystem : public CE::Input::System, public CE::State::Singleton<InputSystem>
Declaration:
finalGLFW/Gainput input adapter on the platform owner, available only with CHERYL_NATIVE_INPUT.
Retains device identities across detachment; borrowed windows survive callback removal. Completed snapshots can cross to simulation without querying live native state.
See also
Public Functions
-
InputSystem()
Create an unattached adapter and semantic mapper; native device admission occurs during attachment.
Allocation/native setup may fail.
-
~InputSystem() override
Detach callbacks while the borrowed window is alive, then retire retained Gainput devices/manager state.
Destructor reports cleanup failures without throwing; input users must have quiesced.
-
virtual void initialize(CE::Platform::Window &window) override
Attach a compatible GLFW window before game init on platform.
Foreign windows, conflicting adapters or another attachment reject. One adapter owns Gainput from first attachment through destruction; Windows reattachment requires the same live notification window. Partial native/setup errors propagate.
-
virtual void poll() override
On platform, begin_poll(), pump glfwPollEvents(), then update() and publish.
Requires initialization; callback/device/evaluation failures propagate at the native-to-engine boundary.
-
void begin_poll()
Latch routing/capture/action-context changes before a host-owned GLFW pump and reset wheel pulse buttons.
Requires attachment; do not call from simulation or in the middle of another pump.
-
void update()
After the host pumps GLFW, process queued native reports and Gainput using elapsed seconds since attached polls, then publish complete State/records.
Requires attachment; captured callback failure is rethrown before normal update. Pair with begin_poll() for host event-loop integration.
-
virtual void deinitialize() override
Detach callbacks before the borrowed window dies and clear per-window staging/focus/mappings.
Device objects remain retained for possible reattachment. Final State release publication can allocate/fail after callbacks have already detached; existing snapshots remain valid.
-
void set_gamepad_diagnostics(bool enabled) noexcept
Opt into gamepad value/ID diagnostics at TRACE.
Call on platform before startup or between polls; no logging-level availability or native-device acceptance is implied.
-
virtual CE::Input::Actions::Bindings &bindings() override
Declaration:
[[nodiscard]]Borrow the native adapter’s mutable mapper on platform only; acquire action_contexts there for producer-side runtime binding.
-
virtual CE::Input::DeviceId keyboard_id() const override
Declaration:
[[nodiscard]]Return the retained adapter keyboard token; cache on platform during game init.
-
virtual CE::Input::DeviceId mouse_id() const override
Declaration:
[[nodiscard]]Return the retained adapter mouse token on platform.
-
virtual CE::Input::DeviceId gamepad_id() const override
Declaration:
[[nodiscard]]Return the adapter’s convenience gamepad token; this API is not native pad enumeration.
-
DeviceSnapshot device(CE::Input::DeviceId id) const
Declaration:
[[nodiscard]]Copy opaque identity and availability on the platform/input owner.
Unknown IDs return identity 0/false; identities remain stable while this adapter retains each device, not across process runs.
-
std::uint64_t backend_time_ms() const
Declaration:
[[nodiscard]]Return Gainput manager time in milliseconds on its platform owner, not simulation elapsed time.
-
inline virtual bool supports_focus() const override
Declaration:
[[nodiscard]]Return true: this adapter implements poll-latched keyboard focus routing.
-
InputSystem()