Skip to content

Engine → Platform

window.h

The abstract window. One live window per process in v1; created through create_window() for the backend named in window_desc. Every call is main thread only (asserted in Debug and Development); no call at frame time can fail.

Structs

File Description
window_desc

Classes

File Description
window

Enumerations

cursor_mode

enum class cursor_mode : u8 {           // GLFW_CURSOR_* (CAPTURED is 3.4)
    NORMAL = 0,
    HIDDEN,
    DISABLED,
    CAPTURED
};

display_server_hint

enum class display_server_hint : u8 {   // Linux only; the GLFW_PLATFORM init hint
    ANY = 0,
    X11,
    WAYLAND
};

window_flags

enum class window_flags : u8 {
    NONE = 0,
    RESIZABLE = 1 << 0,
    DECORATED = 1 << 1,
    VISIBLE = 1 << 2,
    FLOATING = 1 << 3,
    MAXIMISED = 1 << 4,
    SCALE_TO_MONITOR = 1 << 5,
    SCALE_FRAMEBUFFER = 1 << 6,
    DEFAULT = RESIZABLE | DECORATED | VISIBLE | SCALE_TO_MONITOR | SCALE_FRAMEBUFFER
};

Forward Declarations

null_backend

class null_backend;

Constants

Name Type Value Description
MAX_WINDOW_ICON_DIMENSION inline constexpr u32 256 Largest width or height of one window icon image in pixels: the largest icon Windows draws, and small enough that a full set fits in one X11 window property.
MAX_WINDOW_ICON_IMAGES inline constexpr usize 16 Most images window::set_icon accepts in one call.
MAX_WINDOW_TITLE_BYTES inline constexpr usize 255 Longest title create_window accepts, in bytes.

Macros

CONJURE_ENUM_FLAGS

CONJURE_ENUM_FLAGS(window_flags)

Functions

Public

create_window

[[nodiscard]] CONJURE_API core::result<std::unique_ptr<window>> create_window(
    const window_desc &desc);

Creates the window for desc.backend. Main thread only. Exactly one live window per process in v1: a second call asserts and returns INVALID_DESC. BACKEND_NOT_COMPILED when the glfw backend was not built; INIT_FAILED / WINDOW_CREATE_FAILED / MONITOR_NOT_FOUND from the glfw backend as described in.

live_window_count

[[nodiscard]] CONJURE_API u32 live_window_count() noexcept;

Number of windows alive in this process (0 or 1 in v1).

parse_cursor_mode

[[nodiscard]] CONJURE_API std::optional<cursor_mode> parse_cursor_mode(
    std::string_view name) noexcept;

Parses a cursor mode name case-insensitively; nullopt for anything else.

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    cursor_mode mode) noexcept;

The enumerator name of a cursor mode ("DISABLED"), or "" for unknown values.

validate_window_desc

[[nodiscard]] CONJURE_API core::result<void> validate_window_desc(
    const window_desc &desc);

Checks a description the way create_window does: a non-fullscreen window needs a non-zero size, the title is at most MAX_WINDOW_TITLE_BYTES bytes and the backend is a known kind. Fails with INVALID_DESC naming the field.

validate_window_icon

[[nodiscard]] CONJURE_API core::result<void> validate_window_icon(
    std::span<const core::image> images);

Checks icon images the way window::set_icon does: at most MAX_WINDOW_ICON_IMAGES of them, none empty and none wider or taller than MAX_WINDOW_ICON_DIMENSION. An empty span is valid (the default icon). Fails with INVALID_ARGUMENT naming the first offending image.