Skip to content

Engine → Platform → input.h

input

Syntax

class CONJURE_API input

Constructors

AccessSignatureDescription
publicinput();

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
public~input();

Variables

AccessNameTypeDefaultDescription
privatemFrameCounteru640
privatemPendinginput_state{}
privatemPublishedinput_state{}
privatemSkipNextMouseDeltabooltrue
privatemStatsinput_stats{}

Functions

Public

apply

bool apply(
    const event &value);

Applies one pumped event. Returns true when it was an input event; window events return false (a focus_event with focused == false still triggers release_all()).

end_frame

void end_frame();

Publishes the frame's snapshot (frameIndex incremented) and clears edges, deltas, scroll and text in the accumulating state. Levels persist.

inject

void inject(
    const input_event &value);

Same state machine as apply(); the source for tests and the editor's input.inject.

void inject(
    const event &value);

Convenience overload: injects the event when it is an input event, ignores it otherwise.

template <typename EventType> requires std::constructible_from<input_event, const EventType &> && (!std::same_as<EventType, input_event>) && (!std::same_as<EventType, event>) void inject(
    const EventType &value);

Injects one concrete input alternative (key_event, mouse_move_event, ...) without the caller spelling the variant; both variants convert from the same structs, so this overload is what makes inject(make_key(...)) unambiguous.

release_all

void release_all() noexcept;

Releases every down key, mouse button and gamepad button with a released edge this frame and clears the modifiers (focus loss, the editor's input.clear).

skip_next_mouse_delta

void skip_next_mouse_delta() noexcept;

Makes the next mouse_move_event set the position without adding to mouseDelta. The window owner calls this after a cursor mode change, where the OS repositions the cursor and the first report would otherwise read as a jump.

snapshot

[[nodiscard]] const input_state &snapshot() const noexcept;

The snapshot published by the last end_frame(). Readable from any thread until the next end_frame(); never hold the reference across one.

stats

[[nodiscard]] const input_stats &stats() const noexcept;

Private

apply_cursor_enter

void apply_cursor_enter(
    const cursor_enter_event &value);

apply_gamepad_axis

void apply_gamepad_axis(
    const gamepad_axis_event &value);

apply_gamepad_button

void apply_gamepad_button(
    const gamepad_button_event &value);

apply_gamepad_connection

void apply_gamepad_connection(
    const gamepad_connection_event &value);

apply_input

void apply_input(
    const input_event &value);

apply_key

void apply_key(
    const key_event &value);

apply_mouse_button

void apply_mouse_button(
    const mouse_button_event &value);

apply_mouse_move

void apply_mouse_move(
    const mouse_move_event &value);

apply_mouse_scroll

void apply_mouse_scroll(
    const mouse_scroll_event &value);

apply_text

void apply_text(
    const text_event &value);

gamepad_for

[[nodiscard]] gamepad_state *gamepad_for(
    u8 index);