simvx.graphics.platform._glfw

GLFW windowing backend.

Module Contents

Classes

GlfwBackend

WindowBackend implementation using GLFW.

Data

API

simvx.graphics.platform._glfw.log

‘getLogger(…)’

simvx.graphics.platform._glfw.__all__

[‘GlfwBackend’]

class simvx.graphics.platform._glfw.GlfwBackend

WindowBackend implementation using GLFW.

GLFW delivers an event through a callback and tells it nothing about when the event happened: there is no timestamp on the callback and no clock to read one from afterwards. Events are therefore reported untimed and the router times them as it receives them. This backend declares no event_timestamps capability when it opens its window, where SDL3 and Qt declare one, so the flag keeps its conservative default and says so. The same goes for which device an event came from: GLFW aggregates every keyboard and every mouse into one stream.

What GLFW does have is the character a key prints under the player’s layout, which is the half of a key event that a rebind screen shows.

Initialization

supports_controllers

True

supports_rumble

False

create_window(width: int, height: int, title: str, *, visible: bool = True) → None
create_graphics_surface(instance: Any) → Any
get_required_instance_extensions() → list[str]
poll_events() → None
should_close() → bool
get_framebuffer_size() → tuple[int, int]
get_window_size() → tuple[int, int]
set_title(title: str) → None
get_content_scale() → tuple[float, float]
set_key_callback(callback: simvx.graphics.platform._base.KeyCallback | None) → None
set_mouse_button_callback(callback: simvx.graphics.platform._base.MouseButtonCallback | None) → None
set_cursor_pos_callback(callback: simvx.graphics.platform._base.CursorPosCallback | None) → None
set_scroll_callback(callback: simvx.graphics.platform._base.ScrollCallback | None) → None
set_char_callback(callback: simvx.graphics.platform._base.CharCallback | None) → None
set_resize_callback(callback: collections.abc.Callable[[int, int], None] | None) → None
set_focus_callback(callback: collections.abc.Callable[[bool], None] | None) → None
set_cursor_shape(shape: simvx.core.input.enums.CursorShape) → None

Show shape. A shape this GLFW cannot make (the diagonals, move and not-allowed arrived in 3.4) shows the arrow.

set_mouse_capture(mode: int) → None

Apply a MouseCaptureMode int (0=visible, 1=hidden, 2=captured, 3=confined) to the OS cursor.

CURSOR_DISABLED (captured) keeps reporting growing virtual cursor positions, so the existing position-diff mouse_delta path stays correct without any delta change.

get_cursor_pos() → tuple[float, float]
poll_controllers() → list[simvx.graphics.platform._base.PadReport]

Poll all connected controllers, one entry per pad found.

GLFW reports both sticks and both triggers as -1..1, so a resting trigger arrives as -1.0; :func:controller.normalise_axes maps that onto the engine’s 0..1.

set_window_size(width: int, height: int) → None
request_close() → None

Signal the window to close at the next poll_events cycle.

set_fullscreen(fullscreen: bool) → None

Toggle fullscreen mode. Stores windowed position/size for restore.

is_fullscreen() → bool
destroy() → None