headless
FreeBodyEngine.core.window.headless
#
A headless window using SDL.
SDL_KEY_MAP = {Key.A: sdl2.SDLK_a, Key.B: sdl2.SDLK_b, Key.C: sdl2.SDLK_c, Key.D: sdl2.SDLK_d, Key.E: sdl2.SDLK_e, Key.F: sdl2.SDLK_f, Key.G: sdl2.SDLK_g, Key.H: sdl2.SDLK_h, Key.I: sdl2.SDLK_i, Key.J: sdl2.SDLK_j, Key.K: sdl2.SDLK_k, Key.L: sdl2.SDLK_l, Key.M: sdl2.SDLK_m, Key.N: sdl2.SDLK_n, Key.O: sdl2.SDLK_o, Key.P: sdl2.SDLK_p, Key.Q: sdl2.SDLK_q, Key.R: sdl2.SDLK_r, Key.S: sdl2.SDLK_s, Key.T: sdl2.SDLK_t, Key.U: sdl2.SDLK_u, Key.V: sdl2.SDLK_v, Key.W: sdl2.SDLK_w, Key.X: sdl2.SDLK_x, Key.Y: sdl2.SDLK_y, Key.Z: sdl2.SDLK_z, Key.ZERO: sdl2.SDLK_0, Key.ONE: sdl2.SDLK_1, Key.TWO: sdl2.SDLK_2, Key.THREE: sdl2.SDLK_3, Key.FOUR: sdl2.SDLK_4, Key.FIVE: sdl2.SDLK_5, Key.SIX: sdl2.SDLK_6, Key.SEVEN: sdl2.SDLK_7, Key.EIGHT: sdl2.SDLK_8, Key.NINE: sdl2.SDLK_9, Key.MINUS: sdl2.SDLK_MINUS, Key.EQUAL: sdl2.SDLK_EQUALS, Key.LEFT_BRACKET: sdl2.SDLK_LEFTBRACKET, Key.RIGHT_BRACKET: sdl2.SDLK_RIGHTBRACKET, Key.BACKSLASH: sdl2.SDLK_BACKSLASH, Key.SEMICOLON: sdl2.SDLK_SEMICOLON, Key.APOSTROPHE: sdl2.SDLK_QUOTE, Key.TILDE: sdl2.SDLK_BACKQUOTE, Key.COMMA: sdl2.SDLK_COMMA, Key.PERIOD: sdl2.SDLK_PERIOD, Key.SLASH: sdl2.SDLK_SLASH, Key.SPACE: sdl2.SDLK_SPACE, Key.RETURN: sdl2.SDLK_RETURN, Key.BACKSPACE: sdl2.SDLK_BACKSPACE, Key.TAB: sdl2.SDLK_TAB, Key.ESCAPE: sdl2.SDLK_ESCAPE, Key.CAPS_LOCK: sdl2.SDLK_CAPSLOCK, Key.L_CTRL: sdl2.SDLK_LCTRL, Key.R_CTRL: sdl2.SDLK_RCTRL, Key.L_SHIFT: sdl2.SDLK_LSHIFT, Key.R_SHIFT: sdl2.SDLK_RSHIFT, Key.L_ALT: sdl2.SDLK_LALT, Key.R_ALT: sdl2.SDLK_RALT, Key.L_SUPER: sdl2.SDLK_LGUI, Key.R_SUPER: sdl2.SDLK_RGUI, Key.INSERT: sdl2.SDLK_INSERT, Key.DELETE: sdl2.SDLK_DELETE, Key.HOME: sdl2.SDLK_HOME, Key.END: sdl2.SDLK_END, Key.PG_UP: sdl2.SDLK_PAGEUP, Key.PG_DOWN: sdl2.SDLK_PAGEDOWN, Key.UP: sdl2.SDLK_UP, Key.DOWN: sdl2.SDLK_DOWN, Key.LEFT: sdl2.SDLK_LEFT, Key.RIGHT: sdl2.SDLK_RIGHT, Key.F1: sdl2.SDLK_F1, Key.F2: sdl2.SDLK_F2, Key.F3: sdl2.SDLK_F3, Key.F4: sdl2.SDLK_F4, Key.F5: sdl2.SDLK_F5, Key.F6: sdl2.SDLK_F6, Key.F7: sdl2.SDLK_F7, Key.F8: sdl2.SDLK_F8, Key.F9: sdl2.SDLK_F9, Key.F10: sdl2.SDLK_F10, Key.F11: sdl2.SDLK_F11, Key.F12: sdl2.SDLK_F12, Key.F13: sdl2.SDLK_F13, Key.F14: sdl2.SDLK_F14, Key.F15: sdl2.SDLK_F15, Key.F16: sdl2.SDLK_F16, Key.F17: sdl2.SDLK_F17, Key.F18: sdl2.SDLK_F18, Key.F19: sdl2.SDLK_F19, Key.F20: sdl2.SDLK_F20, Key.F21: sdl2.SDLK_F21, Key.F22: sdl2.SDLK_F22, Key.F23: sdl2.SDLK_F23, Key.F24: sdl2.SDLK_F24, Key.NUMPAD_0: sdl2.SDLK_KP_0, Key.NUMPAD_1: sdl2.SDLK_KP_1, Key.NUMPAD_2: sdl2.SDLK_KP_2, Key.NUMPAD_3: sdl2.SDLK_KP_3, Key.NUMPAD_4: sdl2.SDLK_KP_4, Key.NUMPAD_5: sdl2.SDLK_KP_5, Key.NUMPAD_6: sdl2.SDLK_KP_6, Key.NUMPAD_7: sdl2.SDLK_KP_7, Key.NUMPAD_8: sdl2.SDLK_KP_8, Key.NUMPAD_9: sdl2.SDLK_KP_9, Key.NUMPAD_DECIMAL: sdl2.SDLK_KP_PERIOD, Key.NUMPAD_DIVIDE: sdl2.SDLK_KP_DIVIDE, Key.NUMPAD_MULTIPLY: sdl2.SDLK_KP_MULTIPLY, Key.NUMPAD_SUBTRACT: sdl2.SDLK_KP_MINUS, Key.NUMPAD_ADD: sdl2.SDLK_KP_PLUS, Key.NUMPAD_ENTER: sdl2.SDLK_KP_ENTER}
module-attribute
#
HeadlessWindow(size, title='FreeBodyEngine')
#
Bases: Window
Window backend used in headless mode - creates an SDL window with the dummy video driver, so nothing is ever shown.
Exists to give the renderer a real SDL/OpenGL-capable surface to target (e.g. for automated tests or server-side rendering) without needing an actual display; unlike the raw offscreen context in glfw.py, this is still a full Window service (registered, drawable, has a window_type).
Forces SDL's "dummy" video driver, then initializes SDL and creates a hidden window of size.
position
property
writable
#
The window's position, in pixels, as reported by SDL.
size
property
writable
#
The window's size, in pixels, as reported by SDL.
window_type = 'headless'
instance-attribute
#
close()
#
Destroys the SDL window and shuts down SDL.
create_mouse()
#
Always returns None - headless mode has no real input device, so there is no Mouse to create.
draw()
#
No-op - there is nothing to present to in headless mode.
is_ready()
#
True until the window has been told to close.
set_title(new_title)
#
No-op - a headless window is never shown, so it has no visible title to set.
update()
#
Pumps SDL's event queue for this frame, quitting the engine on SDL_QUIT.