generic
FreeBodyEngine.core.window.generic
#
FRAMEBUFFER_RESIZE = 'ENGINE_framebuffer_resize'
module-attribute
#
WINDOW_RESIZE = 'ENGINE_window_resize'
module-attribute
#
Cursor
#
Base class for a platform-native cursor handle.
Has no behavior of its own - each backend that supports custom cursors (e.g. Win32Cursor) subclasses this to wrap its own native handle. Also used directly as the dummy cursor object returned by create_cursor() in headless mode, where there is no real window to own a cursor.
Window(size, title)
#
Bases: Service
Abstract base class for the engine's window backends.
Registered as the 'window' service; every platform implementation (GLFWWindow, WaylandWindow, X11Window, Win32Window, HeadlessWindow) subclasses this and fills in the methods marked @abstractmethod below, which together form the contract the rest of the engine (input, rendering, the main loop) relies on regardless of which backend is actually running.
Registers this instance as the 'window' service.
Subclasses call this first via super().init(), then go on to create their actual native window and set self.window_type to their own backend name (e.g. 'glfw', 'x11') - it starts as None here since the base class has no backend of its own.
framebuffer_size
property
#
The size, in pixels, of the actual drawable framebuffer.
Not always equal to size - on displays with fractional/HiDPI
scaling the OS may report the window's logical size while the GPU
surface backing it is allocated at a different pixel density.
size
property
writable
#
The window's client area size, in pixels, as (width, height).
window_type = None
instance-attribute
#
close()
#
Closes the window and releases its native resources, signaling the engine to quit.
create_mouse()
#
Creates and returns this backend's Mouse implementation, wired up to this window's input events.
draw()
#
Presents the completed frame, typically by swapping the window's front/back buffers.
get_clipboard_text()
#
Returns the system clipboard's current text content, or None if it's empty, isn't text, or this backend hasn't implemented real clipboard access yet - see WaylandWindow/GLFWWindow for the backends that actually do. Concrete no-op (with a one-time warning) rather than a crash-on-call abstract, since ui/manager.py calls this unconditionally on Ctrl+V regardless of backend.
is_ready()
#
Whether the window has finished its platform-specific setup and is ready to be drawn to / receive input.
on_destroy()
#
Undoes on_initialize() - unhooks the per-frame update/draw calls and unregisters the window events.
on_initialize()
#
Hooks window update/draw into the engine's per-frame update phases and registers the window resize events.
position(new)
#
Moves the window to new (x, y), in pixels.
set_clipboard_text(text)
#
Sets the system clipboard's text content - see get_clipboard_text just above for why this is a concrete no-op (with the same one-time warning flag) rather than a crash-on-call abstract.
set_title(new_title)
#
Sets the OS-level window title/caption.
update()
#
Pumps the platform's event queue for one frame, dispatching input events and detecting a close request.