Skip to content

Engine → Platform → null_backend.h

null_backend

Syntax

class CONJURE_API null_backend final : public window

Inheritance Hierarchy

window → null_backend

Constructors

AccessSignatureDescription
publicexplicit null_backend( const window_desc &desc);

Destructors

AccessSignatureDescription
public~null_backend() override;

Variables

AccessNameTypeDefaultDescription
privatemClipboardstd::string{}
privatemClipboardHasTextboolfalse
privatemContentScalemath::vec2math::vec2(1.0f)
privatemCursorModecursor_modecursor_mode::NORMAL
privatemCursorPositionmath::vec2math::vec2(0.0f)
privatemDeliveredstd::vector<event>{}
privatemDeliveredDropPathsstd::vector<std::string>{}
privatemDeliveredDropRangesstd::vector<drop_range>{}
privatemFocusedbooltrue
privatemFullscreenboolfalse
privatemGamepadConnectedstd::array<bool, MAX_GAMEPADS>{}
privatemGamepadNamesstd::array<std::string, MAX_GAMEPADS>{}
privatemIconsstd::vector<core::image>{}
privatemLogicalSizemath::uvec2math::uvec2(0)
privatemMinimisedboolfalse
privatemMonitorsstd::vector<monitor_info>{}
privatemPendingstd::vector<event>{}
privatemPendingDropPathsstd::vector<std::string>{}
privatemPendingDropRangesstd::vector<drop_range>{}
privatemPendingResizestd::optional<math::uvec2>std::nullopt
privatemPositionmath::ivec2math::ivec2(0)
privatemRawMouseMotionboolfalse
privatemShouldCloseboolfalse
privatemTitlestd::string{}
privatemVideoModesstd::vector<video_mode>{}
privatemVisiblebooltrue
privatemWindowedPositionmath::ivec2math::ivec2(0)
privatemWindowedPositionKnownbooltrue
privatemWindowedSizemath::uvec2math::uvec2(0)
publicVIRTUAL_MONITOR_HEIGHTstatic constexpr u321080
publicVIRTUAL_MONITOR_REFRESH_HZstatic constexpr u3260
publicVIRTUAL_MONITOR_WIDTHstatic constexpr u321920

Functions

Public

as_null

[[nodiscard]] null_backend *as_null() noexcept override;

backend

[[nodiscard]] backend_kind backend() const noexcept override;

cancel_close

void cancel_close() noexcept override;

clipboard_text

[[nodiscard]] core::result<std::string> clipboard_text() const override;

content_scale

[[nodiscard]] math::vec2 content_scale() const noexcept override;

create

[[nodiscard]] static std::unique_ptr<null_backend> create(
    const window_desc &desc);

Builds a null window from a description (what create_window does for NULL_BACKEND). The description is expected to pass validate_window_desc (asserted).

create_vulkan_surface

[[nodiscard]] core::result<void> create_vulkan_surface(
    void *instance,
    void **surface) const override;

current_cursor_mode

[[nodiscard]] cursor_mode current_cursor_mode() const noexcept override;

cursor_position

[[nodiscard]] math::vec2 cursor_position() const noexcept;

Where set_cursor_position() last warped the cursor (logical coordinates).

framebuffer_size

[[nodiscard]] math::uvec2 framebuffer_size() const noexcept override;

gamepad_name

[[nodiscard]] std::string_view gamepad_name(
    u32 index) const noexcept override;

hide

void hide() override;

icons

[[nodiscard]] std::span<const core::image> icons() const noexcept;

Copies of the images the last successful set_icon() received; empty for the default icon.

is_focused

[[nodiscard]] bool is_focused() const noexcept override;

is_fullscreen

[[nodiscard]] bool is_fullscreen() const noexcept override;

is_minimised

[[nodiscard]] bool is_minimised() const noexcept override;

is_visible

[[nodiscard]] bool is_visible() const noexcept override;

monitors

[[nodiscard]] std::span<const monitor_info> monitors() const noexcept override;

native_handle

[[nodiscard]] native_window_handle native_handle() const noexcept override;

pending_event_count

[[nodiscard]] usize pending_event_count() const noexcept;

Events the next pump_events() will deliver, the coalesced resize included.

position

[[nodiscard]] math::ivec2 position() const noexcept override;

pump_events

[[nodiscard]] std::span<const event> pump_events() override;

push_event

void push_event(
    const event &value);

Queues any event verbatim. A gamepad_connection_event also updates gamepad_name() when it is delivered.

raw_mouse_motion

[[nodiscard]] bool raw_mouse_motion() const noexcept;

The raw mouse motion flag set_raw_mouse_motion() stored.

request_close

void request_close() noexcept override;

required_vulkan_instance_extensions

[[nodiscard]] std::span<const char *const> required_vulkan_instance_extensions() const noexcept override;

set_clipboard_text

[[nodiscard]] core::result<void> set_clipboard_text(
    std::string_view text) override;

set_cursor_mode

[[nodiscard]] core::result<void> set_cursor_mode(
    cursor_mode mode) override;

set_cursor_position

void set_cursor_position(
    math::vec2 logicalPosition) override;

set_fullscreen

[[nodiscard]] core::result<void> set_fullscreen(
    bool fullscreen,
    u32 monitorIndex = 0) override;

set_icon

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

set_position

[[nodiscard]] core::result<void> set_position(
    math::ivec2 position) override;

set_raw_mouse_motion

[[nodiscard]] core::result<void> set_raw_mouse_motion(
    bool enabled) override;

set_size

void set_size(
    math::uvec2 logicalSize) override;

set_title

void set_title(
    std::string_view title) override;

should_close

[[nodiscard]] bool should_close() const noexcept override;

show

void show() override;

simulate_close

void simulate_close();

Queues a close_event; should_close() is true immediately.

simulate_content_scale

void simulate_content_scale(
    math::vec2 scale);

Changes the content scale: queues a content_scale_changed_event and, when the framebuffer size changes with it, the coalesced framebuffer_resized_event.

simulate_drop_files

void simulate_drop_files(
    std::span<const std::string> paths);

Copies the paths and queues one drop_files_event spanning them; the span is valid until the pump after the one that delivered it.

simulate_focus

void simulate_focus(
    bool focused);

Changes the focus state and queues a focus_event.

simulate_minimise

void simulate_minimise(
    bool minimised);

Changes the minimised state and queues a minimise_event; the framebuffer becomes 0 x 0 while minimised (delivered as a coalesced resize) and comes back on restore.

simulate_monitor_scale

void simulate_monitor_scale(
    math::vec2 scale);

Changes the virtual monitor's OS UI scale (monitor_info::contentScale) alone: the window's content_scale() and framebuffer stay as they are, as on a Windows or X11 monitor set to 150 %, whose framebuffer is as large as the window. No event is queued (a real Windows window raises none either).

simulate_resize

void simulate_resize(
    u32 width,
    u32 height);

Changes the logical size; the next pump ends with one framebuffer_resized_event carrying round(size * content_scale) in pixels, however many resizes were simulated.

title

[[nodiscard]] std::string_view title() const noexcept override;

video_modes

[[nodiscard]] std::span<const video_mode> video_modes(
    u32 monitorIndex) const noexcept override;

window_size

[[nodiscard]] math::uvec2 window_size() const noexcept override;

Private

centred_position

[[nodiscard]] math::ivec2 centred_position() const noexcept;

compute_framebuffer_size

[[nodiscard]] math::uvec2 compute_framebuffer_size() const noexcept;

queue_resize

void queue_resize() noexcept;