// // Created by darman on 9/24/26. // #pragma once #include #include namespace SiegeDeck::Engine { class SdlContext; struct WindowDesc { string Title { "Siege Deck" }; int32 Width { 1600 }; // logical size; the backbuffer is larger on high-DPI displays int32 Height { 900 }; bool Resizable { true }; bool Fullscreen { false }; // borderless desktop fullscreen, not an exclusive mode change }; // Not movable: a Window that exists always has a live SDL_Window, and the render // device and ImGui backend will hold on to it by reference. class Window { public: // Takes the SdlContext only as proof that SDL is initialized. // Throws std::runtime_error if the window can't be created. Window(const SdlContext& sdl, const WindowDesc& desc); Window(const Window&) = delete; Window& operator=(const Window&) = delete; Window(Window&&) = delete; Window& operator=(Window&&) = delete; [[nodiscard]] SDL_Window* Handle() const { return handle.get(); } [[nodiscard]] SDL_WindowID Id() const; // Logical size, for UI layout and mouse coordinates. [[nodiscard]] glm::ivec2 Size() const; // Backbuffer size, for the swapchain and viewport. [[nodiscard]] glm::ivec2 PixelSize() const; // Content scale of the current display (1.0 = 96 DPI), for sizing UI and fonts. [[nodiscard]] float DisplayScale() const; void SetTitle(const string& title); private: struct Destroy { void operator()(SDL_Window* window) const { SDL_DestroyWindow(window); } }; UniqueRef handle; }; }