Update window api, add content scale for glfw window

This commit is contained in:
Georg Hagen
2024-12-12 23:28:12 +01:00
parent 955bf6570d
commit c2993ae56c
3 changed files with 36 additions and 27 deletions

View File

@@ -32,12 +32,14 @@ namespace OpenVulkano
Math::Vector2i position{0, 0};
std::string title = "Window Title";
WindowMode windowMode = WINDOWED;
bool transparentFrameBuffer = false;
bool resizeable = true;
};
class IWindow : public ICloseable
{
public:
virtual ~IWindow() = default;
~IWindow() override = default;
virtual void Init(RenderAPI::RenderApi renderApi) = 0;
@@ -48,22 +50,22 @@ namespace OpenVulkano
virtual const std::string& GetTitle() = 0;
virtual void SetTitle(const std::string& title) = 0;
virtual WindowMode GetWindowMode() = 0;
[[nodiscard]] virtual WindowMode GetWindowMode() = 0;
virtual void SetWindowMode(WindowMode) = 0;
inline void SetFullscreen() { SetWindowMode(FULLSCREEN); }
inline void SetWindowed() { SetWindowMode(WINDOWED); }
void SetFullscreen() { SetWindowMode(FULLSCREEN); }
void SetWindowed() { SetWindowMode(WINDOWED); }
virtual const WindowConfiguration& GetWindowConfiguration() = 0;
inline uint32_t GetWidth() { return GetSize().x; }
inline uint32_t GetHeight() { return GetSize().y; }
virtual Math::Vector2ui GetSize() = 0;
[[nodiscard]] virtual const WindowConfiguration& GetWindowConfiguration() = 0;
[[nodiscard]] uint32_t GetWidth() { return GetSize().x; }
[[nodiscard]] uint32_t GetHeight() { return GetSize().y; }
[[nodiscard]] virtual Math::Vector2ui GetSize() = 0;
virtual void SetSize(uint32_t width, uint32_t height) = 0;
inline void SetSize(Math::Vector2ui size) { SetSize(size.x, size.y); }
void SetSize(const Math::Vector2ui& size) { SetSize(size.x, size.y); }
virtual void SetSizeLimits(int minWidth, int minHeight, int maxWidth, int maxHeight) = 0;
virtual Math::Vector2i GetPosition() = 0;
[[nodiscard]] virtual Math::Vector2i GetPosition() = 0;
virtual void SetPosition(int posX, int posY) = 0;
inline void SetPosition(Math::Vector2i pos) { SetPosition(pos.x, pos.y); };
void SetPosition(Math::Vector2i pos) { SetPosition(pos.x, pos.y); };
virtual void SetMouseVisibility(bool hideMouse) {};
@@ -71,15 +73,15 @@ namespace OpenVulkano
virtual void Hide() = 0;
virtual void Show(bool show) = 0;
virtual IWindowHandler* GetWindowHandler() = 0;
[[nodiscard]] virtual IWindowHandler* GetWindowHandler() = 0;
virtual void SetWindowHandler(IWindowHandler* handler) = 0;
/**
* \brief Gets the vulkan window implementation of the window.
* \return The IVulkanWindow reference of the window. nullptr if the current Window dose not implement IVulkanWindow
*/
virtual IVulkanWindow* GetVulkanWindow() = 0;
virtual IOpenGlWindow* GetOpenGlWindow() = 0;
[[nodiscard]] virtual IVulkanWindow* GetVulkanWindow() = 0;
[[nodiscard]] virtual IOpenGlWindow* GetOpenGlWindow() = 0;
[[nodiscard]] virtual uint32_t GetWindowId() const = 0;