Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
DesktopWindow.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "FlingWindow.h"
4 
5 #ifndef GLFW_INCLUDE_VULKAN
6 # define GLFW_INCLUDE_VULKAN
7 #endif
8 #include <GLFW/glfw3.h>
9 
10 namespace Fling
11 {
15  class DesktopWindow : public FlingWindow
16  {
17  public:
18 
19  DesktopWindow(const WindowProps& t_Props);
20  virtual ~DesktopWindow();
21 
22  virtual void CreateSurface(void* t_GraphicsInstance, void* t_SurfData) override;
23 
25  virtual void Update() override;
26 
28  virtual void RecreateSwapChain() override;
29 
34  virtual int ShouldClose() override;
35 
37  virtual bool IsMinimized() const override;
38 
39  virtual UINT32 GetWidth() const override;
40 
41  virtual UINT32 GetHeight() const override;
42 
43  virtual float GetAspectRatio() const override;
44 
45  virtual void SetMouseVisible(bool t_IsVisible) override;
46 
47  virtual bool GetMouseVisible() override;
48 
53  void SetWindowIcon(Guid t_ID) override;
54 
56  GLFWwindow* GetGlfwWindow() const { return m_Window; }
57 
58  virtual void SetWindowMode(WindowMode t_WindowMode) override;
59  virtual WindowMode GetWindowMode() override;
60  private:
61 
62  GLFWwindow* m_Window = nullptr;
63 
64  static void FrameBufferResizeCallback(GLFWwindow* t_Window, int t_Width, int t_Height);
65  };
66 } // namespace Fling
Window creation data.
Definition: FlingWindow.h:17
Base class that represents a window to the Fling Engine.
Definition: FlingWindow.h:27
virtual void SetWindowMode(WindowMode t_WindowMode) override
Changes window mode between fullscreen, window, and borderless window.
Definition: DesktopWindow.cpp:133
GLFWwindow * GetGlfwWindow() const
get the current GLFW window
Definition: DesktopWindow.h:56
virtual ~DesktopWindow()
Definition: DesktopWindow.cpp:54
Base class that represents a window to the Fling Engine using GLFW.
Definition: DesktopWindow.h:15
WindowMode
Definition: FlingWindow.h:7
static void FrameBufferResizeCallback(GLFWwindow *t_Window, int t_Width, int t_Height)
Definition: DesktopWindow.cpp:30
virtual UINT32 GetWidth() const override
The current width of this window.
Definition: DesktopWindow.cpp:75
virtual UINT32 GetHeight() const override
The current height of this window.
Definition: DesktopWindow.cpp:83
virtual void CreateSurface(void *t_GraphicsInstance, void *t_SurfData) override
Create the rendering surface for this window.
Definition: DesktopWindow.cpp:34
virtual float GetAspectRatio() const override
The current aspect ratio of this windows.
Definition: DesktopWindow.cpp:91
void SetWindowIcon(Guid t_ID) override
Set this window&#39;s icon.
Definition: DesktopWindow.cpp:117
DesktopWindow(const WindowProps &t_Props)
Definition: DesktopWindow.cpp:15
entt::hashed_string Guid
Definition: FlingTypes.h:26
virtual WindowMode GetWindowMode() override
Gets current window mode.
Definition: DesktopWindow.cpp:165
virtual bool IsMinimized() const override
Is this window currently minimized?
Definition: DesktopWindow.cpp:70
virtual int ShouldClose() override
Check if this window should close.
Definition: DesktopWindow.cpp:65
virtual bool GetMouseVisible() override
Gets current visibility of mouse cursor.
Definition: DesktopWindow.cpp:112
virtual void Update() override
Tick the window (poll input from GLFW)
Definition: DesktopWindow.cpp:60
virtual void SetMouseVisible(bool t_IsVisible) override
Set whether the window hides the mouse cursor.
Definition: DesktopWindow.cpp:99
uint32_t UINT32
Definition: FlingTypes.h:13
GLFWwindow * m_Window
Definition: DesktopWindow.h:62
Definition: Engine.h:29
virtual void RecreateSwapChain() override
Recreate the swap chain based on current window size with GLFW.
Definition: DesktopWindow.cpp:42