Skip to content

Window Configuration

The Window() function is a Lifecycle Callback. The engine calls this Lua function exactly once during the initialization phase to configure the operating system window.

If this function is missing or returns invalid data, the engine falls back to a default 800x600 window.

Syntax

lua
function Window()
    return {
        title = "My App",
        w = 1280,
        h = 720,
        -- ... other options
    }
end

Configuration Properties

The following keys are recognized by the engine:

PropertyTypeDefaultDescription
titlestring"Vulpis window"The text displayed in the window title bar.
wnumber800The initial width of the client area in logical pixels.
hnumber600The initial height of the client area in logical pixels.
resizablebooleanfalseIf true, the user can resize the window manually.
modestring""Sets the display mode (see Window Modes below).

> Note: The engine automatically enables High-DPI support (SDL_WINDOW_ALLOW_HIGHDPI). Dimensions provided in w and h are logical units, not necessarily physical pixels.

Window Modes

The appearance of the window is controlled by the mode string.

1. Windowed (Default)

If mode is set to "windowed", "", or nil, the application runs in a standard floating window.

lua
mode = "windowed"

2. Maximized ("full")

Starts the window in a maximized state, filling the desktop but keeping the title bar and OS taskbar visible.

  • Behavior: Automatically forces resizable = true to allow the window to be restored/un-maximized.
lua
mode = "full"

3. Borderless Fullscreen ("whole screen")

Sets the window to "Fullscreen Desktop" mode. The application covers the entire monitor (hiding the taskbar and title bar) at the current desktop resolution.

  • Behavior: Uses SDL_WINDOW_FULLSCREEN_DESKTOP. Fast alt-tabbing is usually supported in this mode.
lua
mode = "whole screen"

Example

Resizable Editor

A window that starts at a specific size but lets the user adjust it.

lua
function Window()
    return {
        title = "Code Editor",
        w = 1024,
        h = 768,
        resizable = true
    }
end