Window

Functions for creating and managing an application window.


Create

create(title: str, resolution: Vec2, scaled: bool = False) None

Create a new application window.

Parameters

  • title : The title of the window.
  • resolution : The initial resolution of the window.
  • scaled : Whether the window should be automatically scaled up to fit into the display.

Is Open

is_open() bool

Check if the window is currently open.

Returns

bool : True if the window is open, False otherwise.

Close

close() None

Close the application window.

Get Size

get_size() Vec2

Get the current size of the window. If scaled, the size will be adjusted to fit the display.

Returns

Vec2 : The current size of the window.

Set Fullscreen

set_fullscreen(fullscreen: bool) None

Set the window to a fullscreen mode.

Parameters

  • fullscreen : Whether to enable or disable fullscreen mode.

Is Fullscreen

is_fullscreen() bool

Check if the window is currently in fullscreen mode.

Returns

bool : True if the window is in fullscreen mode, False otherwise.

Set Title

set_title(title: str) None

Set the title of the window.

Parameters

  • title : The new title of the window.

Get Title

get_title() str

Get the current title of the window.

Returns

str : The current title of the window.

Get Scale

get_scale() int

Get the scale of the window relative to the renderer resolution.

Returns

int : The current scale factor of the window.

Save Screenshot

save_screenshot(path: str) None

Save a screenshot of the current window content to a file.

Parameters

  • path : The file path where the screenshot will be saved.