XDPXI's Documentation
SDL2

Window Queries

Required version: Sponge >=1.0.4

sdl2.get_window_width()

Returns the current window width in pixels.

Parameters: None

Returns: number - Window width, or null if no window is open

Example:

let width = sdl2.get_window_width();
print("Window width: ");
print(width);

sdl2.get_window_height()

Returns the current window height in pixels.

Parameters: None

Returns: number - Window height, or null if no window is open

Example:

let height = sdl2.get_window_height();
print("Window height: ");
print(height);

sdl2.is_window_open()

Checks if the window is still open and the user hasn't requested it to close.

Parameters: None

Returns: boolean - true if window is open, false if it should close

Example:

while sdl2.is_window_open() {
    # Main game loop
}