libstd/window
A real window on the screen, the same on Linux (Xlib, through libstd/xlib) and on Windows (user32), with a fixed size: open it, handle its events, close it. The two handles it returns are what vk_create_window_surface (libstd/vulkan) needs to draw into it.
#include <libstd/window>
Same functions and constant names on Linux and Windows: the system-specific part is in wrapper/linux/syswindow and wrapper/windows/syswindow (see Linux and Windows). Links the shared library user32.dll (FFI).
Example
#include <libstd/window>
#include <libstd/time>
display, window = window_open("TryC window", 400, 300)
i = 0
while i < 30 and window_poll(display, window) != 0: // about 3 seconds
sleep_ms(100 as long)
i++
window_close(display, window)
Functions
Opens a visible window titled title whose drawable area is width x height pixels and returns (display, window): the X display and window on Linux, the program's HINSTANCE and the window's HWND on Windows. Exits with an error message if the window cannot be created.
Handles the pending events of the window and returns 0 once the user has closed it, 1 otherwise. Call it often, for example once per frame: on Windows a window that does not is marked as not responding. On Linux the close button arrives as WM_DELETE_WINDOW (xlib_catch_close): window_poll destroys the window and from then on returns 0, as on Windows.
Closes the window and releases what window_open created.