Modules

Window_Creation

moduleSource
macOSLinuxWindows

#import "Window_Creation";

Procedures#

X11 queries#

get_pixel_scale3 overloadssince 0.31.0
(win: Window) -> float

Device pixels per window coordinate unit; window sizes here are already in pixels.

get_dimensions3 overloads
(win: Window, right_handed: bool) -> (x: s32, y: s32, width: s32, height: s32, success := true)

Where the window's drawing area is on the screen and how big it is: x, y, width, height, success.

(dpy: *Display, win: Window, right_handed: bool) -> (x: int, y: int, success: bool)

Where the mouse is, in window coordinates: x, y, success.

(win: Window, desire_fullscreen: bool, saved: *Saved_Window_Info) -> (success: bool, width: s32, height: s32)

Switches the window between full screen and its normal size. Returns whether it worked and the new size.

Cocoa queries#

(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.

Types#

Constants#

:: u64

The native window handle. Its type depends on the target: an X11.Window (an integer) on Linux, an HWND on Windows, and a pointer on macOS (*NSWindow) and Android. So "no window" is 0 in one place and null in another, and window == null does not compile on Linux.

no_window: Window_Type;
assert(no_window == WT.INVALID_WINDOW);

window := no_window;
if window == WT.INVALID_WINDOW window = no_window;

Doesn't run in the browser (skipped on wasm).

:: Windows.WS_OVERLAPPED | Windows.WS_CAPTION | Windows.WS_SYSMENU | Windows.WS_THICKFRAME