Update window api, add content scale for glfw window
This commit is contained in:
@@ -19,11 +19,11 @@ namespace OpenVulkano::GLFW
|
||||
{
|
||||
class WindowGLFW final : virtual public BaseWindow, virtual public IVulkanWindow, virtual public IOpenGlWindow
|
||||
{
|
||||
private:
|
||||
InputProviderGLFW& inputProvider;
|
||||
GLFWwindow* window = nullptr;
|
||||
IWindowHandler* handler = nullptr;
|
||||
Math::Vector2ui currentSize = {};
|
||||
float contentScale = 1.0f;
|
||||
|
||||
public:
|
||||
WindowGLFW(InputProviderGLFW& inputProvider);
|
||||
@@ -39,9 +39,9 @@ namespace OpenVulkano::GLFW
|
||||
|
||||
void RegisterCallbacks() const;
|
||||
|
||||
static GLFWmonitor* GetPrimaryMonitor();
|
||||
[[nodiscard]] static GLFWmonitor* GetPrimaryMonitor();
|
||||
|
||||
static std::vector<GLFWmonitor*> GetMonitors();
|
||||
[[nodiscard]] static std::vector<GLFWmonitor*> GetMonitors();
|
||||
|
||||
public: // IWindow implementation
|
||||
void Init(RenderAPI::RenderApi renderApi) override;
|
||||
@@ -64,27 +64,29 @@ namespace OpenVulkano::GLFW
|
||||
|
||||
void SetSizeLimits(int minWidth, int minHeight, int maxWidth, int maxHeight) override;
|
||||
|
||||
[[nodiscard]] float GetContentScale() const override { return contentScale; }
|
||||
|
||||
void MakeCurrentThread() override;
|
||||
|
||||
void SetWindowMode(WindowMode windowMode) override;
|
||||
|
||||
void SetWindowHandler(IWindowHandler* handler) override;
|
||||
|
||||
IVulkanWindow* GetVulkanWindow() override { return this; };
|
||||
[[nodiscard]] IVulkanWindow* GetVulkanWindow() override { return this; };
|
||||
|
||||
IOpenGlWindow* GetOpenGlWindow() override { return this; };
|
||||
[[nodiscard]] IOpenGlWindow* GetOpenGlWindow() override { return this; };
|
||||
|
||||
// Status getter
|
||||
Math::Vector2ui GetSize() override;
|
||||
[[nodiscard]] Math::Vector2ui GetSize() override;
|
||||
|
||||
Math::Vector2i GetPosition() override;
|
||||
[[nodiscard]] Math::Vector2i GetPosition() override;
|
||||
|
||||
IWindowHandler* GetWindowHandler() override { return handler; }
|
||||
[[nodiscard]] IWindowHandler* GetWindowHandler() override { return handler; }
|
||||
|
||||
//IVulkanWindow stuff
|
||||
vk::SurfaceKHR CreateSurface(const vk::Instance& instance, const vk::AllocationCallbacks* pAllocator) override;
|
||||
[[nodiscard]] vk::SurfaceKHR CreateSurface(const vk::Instance& instance, const vk::AllocationCallbacks* pAllocator) override;
|
||||
|
||||
std::vector<std::string> GetRequiredInstanceExtensions() override;
|
||||
[[nodiscard]] std::vector<std::string> GetRequiredInstanceExtensions() override;
|
||||
|
||||
void* GetNativeWindowHandle() override { return window; }
|
||||
|
||||
@@ -104,7 +106,7 @@ namespace OpenVulkano::GLFW
|
||||
void OnClose();
|
||||
|
||||
protected:
|
||||
virtual void OnKeyEvent(int key, int scanCode, int action, int mods);
|
||||
void OnKeyEvent(int key, int scanCode, int action, int mods);
|
||||
|
||||
private: // Callbacks
|
||||
static WindowGLFW* GetWindow(GLFWwindow* window);
|
||||
@@ -134,6 +136,6 @@ namespace OpenVulkano::GLFW
|
||||
static void DropCallback(GLFWwindow* window, int count, const char** paths);
|
||||
|
||||
public:
|
||||
static std::vector<std::string> GetVulkanRequiredInstanceExtensions();
|
||||
[[nodiscard]] static std::vector<std::string> GetVulkanRequiredInstanceExtensions();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user