Device pixels per window coordinate unit; window sizes here are already in pixels.
window := create_window(800, 600, "scale");
pixels := cast(int) (800 * get_pixel_scale(window));↗This one is only checked to compile, not run.
#import "Window_Creation";
Opens native windows (Cocoa, Win32 or X11) with an OpenGL surface.
create_window makes one; get_dimensions, get_mouse_pointer_position and toggle_fullscreen
query and change it. Read input with the Input module.
#import "Window_Creation";
#import "Input";
window := create_window(800, 600, "hello");
assert(window != WT.INVALID_WINDOW);
while true {
update_window_events();
for events_this_frame if it.type == .QUIT return;
}This one is only checked to compile, not run.
Device pixels per window coordinate unit; window sizes here are already in pixels.
window := create_window(800, 600, "scale");
pixels := cast(int) (800 * get_pixel_scale(window));↗This one is only checked to compile, not run.
Where the window's drawing area is on the screen and how big it is: x, y, width, height, success.
window := create_window(800, 600, "size");
x, y, width, height, ok := get_dimensions(window, false);
assert(ok && width > 0);↗This one is only checked to compile, not run.
Where the mouse is, in window coordinates: x, y, success.
Switches the window between full screen and its normal size. Returns whether it worked and the new size.
window := create_window(800, 600, "full screen");
saved: Saved_Window_Info;
ok, width, height := toggle_fullscreen(window, true, *saved);
toggle_fullscreen(window, false, *saved);↗This one is only checked to compile, not run.
Opens a window and returns it, or a null window when it could not be made.
window := create_window(800, 600, "My game");
assert(window != WT.INVALID_WINDOW);↗This one is only checked to compile, not run.
Starts the Cocoa application object. create_window calls it.
Shows what was drawn: swaps the window's front and back buffers.
The position and size to restore after leaving full screen; toggle_fullscreen fills it in.
The Win32 window style of a normal window.
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;↗