Window_Creation module

create_window

procedure3 overloadsSource

Opens a window and returns it, or a null window when it could not be made.

Example↗
window := create_window(800, 600, "My game");
assert(window != WT.INVALID_WINDOW);

This one is only checked to compile, not run.

create_window :: (
    width: int,
    height: int,
    window_name: string,
    window_x := 0,
    window_y := 0,
    parent: Window_Type = None,
    background_color_rgb := DEFAULT_WINDOW_CREATION_COLOR,
    wanted_msaa: s32 = DEFAULT_MSAA
) -> Window

Opens a window and returns it, or a null window when it could not be made.

Parameters

width: int
in window units.
height: int
in window units.
window_name: string
the title.
window_x := 0
where the top left corner goes, in screen units (or inside parent). Leave it at -1 on macOS to centre the window and on Windows for the top left of the usable screen; Linux has no such default and starts at 0.
window_y := 0
the same for the vertical position.
parent: Window_Type = None
a window to put this one in. Null makes a top-level window.
background_color_rgb := DEFAULT_WINDOW_CREATION_COLOR
red, green and blue from 0 to 1, shown before the first frame is drawn.
wanted_msaa: s32 = DEFAULT_MSAA
samples per pixel for smoothing edges. The default is the module parameter DEFAULT_MSAA.

Returns

Example↗
window := create_window(800, 600, "My game");
assert(window != WT.INVALID_WINDOW);

This one is only checked to compile, not run.

create_window :: (
    width: int,
    height: int,
    window_name: string,
    window_x := -1,
    window_y := -1,
    parent: Window_Type = null,
    background_color_rgb := DEFAULT_WINDOW_CREATION_COLOR,
    wanted_msaa := DEFAULT_MSAA
) -> Windows.HWND

Opens a window and returns it, or a null window when it could not be made.

Parameters

width: int
in window units.
height: int
in window units.
window_name: string
the title.
window_x := -1
where the top left corner goes, in screen units (or inside parent). Leave it at -1 on macOS to centre the window and on Windows for the top left of the usable screen; Linux has no such default and starts at 0.
window_y := -1
the same for the vertical position.
parent: Window_Type = null
a window to put this one in. Null makes a top-level window.
background_color_rgb := DEFAULT_WINDOW_CREATION_COLOR
red, green and blue from 0 to 1, shown before the first frame is drawn.
wanted_msaa := DEFAULT_MSAA
samples per pixel for smoothing edges. The default is the module parameter DEFAULT_MSAA.

Returns

Windows.HWND
Example↗
window := create_window(800, 600, "My game");
assert(window != WT.INVALID_WINDOW);

This one is only checked to compile, not run.

create_window :: (
    width: int,
    height: int,
    window_name: string,
    window_x := -1,
    window_y := -1,
    parent: Window_Type = null,
    background_color_rgb := DEFAULT_WINDOW_CREATION_COLOR,
    wanted_msaa := DEFAULT_MSAA
) -> *ObjC.NSWindow

Opens a window and returns it, or a null window when it could not be made.

Parameters

width: int
in window units.
height: int
in window units.
window_name: string
the title.
window_x := -1
where the top left corner goes, in screen units (or inside parent). Leave it at -1 on macOS to centre the window and on Windows for the top left of the usable screen; Linux has no such default and starts at 0.
window_y := -1
the same for the vertical position.
parent: Window_Type = null
a window to put this one in. Null makes a top-level window.
background_color_rgb := DEFAULT_WINDOW_CREATION_COLOR
red, green and blue from 0 to 1, shown before the first frame is drawn.
wanted_msaa := DEFAULT_MSAA
samples per pixel for smoothing edges. The default is the module parameter DEFAULT_MSAA.

Returns

Example↗
window := create_window(800, 600, "My game");
assert(window != WT.INVALID_WINDOW);

This one is only checked to compile, not run.