Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Window.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include "Engine/api.hpp"
5 #include <ThirdParty/EASTL-master/include/EASTL/string.h>
6 #include <ThirdParty/EASTL-master/include/EASTL/shared_ptr.h>
7 
8 #if _WIN32 || _WIN64
9 #define NOMINMAX
10 #include <windows.h>
11 #define GLFW_EXPOSE_NATIVE_WIN32
12 #define GLFW_EXPOSE_NATIVE_WGL
13 #define GLFW_INCLUDE_NONE
14 #if _WIN64
15 #include <ThirdParty/glfw-3.2.1/x64/include/GLFW/glfw3.h>
16 #include <ThirdParty/glfw-3.2.1/x64/include/GLFW/glfw3native.h>
17 #else
18 #include <ThirdParty/glfw-3.2.1/x86/include/GLFW/glfw3.h>
19 #include <ThirdParty/glfw-3.2.1/x86/include/GLFW/glfw3native.h>
20 #endif
21 #endif
22 
23 namespace Engine
24 {
29  {
30  public:
31 
38  static void OnWindowResized(GLFWwindow* window, int width, int height);
39 
44  bool ShouldClose() const noexcept;
45 
51  void SetShouldClose(bool value) const noexcept;
52 
57  HWND GetWindowHandle() const noexcept;
58 
63  eastl::weak_ptr<GLFWwindow> GetGLFWWindow() const noexcept;
64 
69  eastl::string GetTitle() const;
70 
75  int GetWidth() const noexcept;
76 
81  int GetDisplayWidth() const noexcept;
82 
87  int GetHeight() const noexcept;
88 
93  int GetDisplayHeight() const noexcept;
94 
95  protected:
96  int width, displayWidth;
97  int height, displayHeight;
98  eastl::shared_ptr<GLFWwindow> window;
99  eastl::string title;
100 
101  private:
102  friend class Engine;
103 #ifdef USING_OPENGL
104  friend class OpenGLWindow;
105 #endif
106 #ifdef USING_VULKAN
107  friend class VulkanWindow;
108 #endif
109 
110  Window() = default;
111  Window(int width, int height, const char* title) noexcept;
112  Window(Window const &other) = delete;
113  Window(Window &&other) noexcept = delete;
114  public:
115  virtual ~Window() noexcept;
116  private:
117 
118  Window &operator=(Window const &other) = delete;
119  Window &operator=(Window &&other) noexcept = delete;
120 
125  void Update() const noexcept;
126 
127  friend class Renderer;
128 #ifdef USING_OPENGL
129  friend class OpenGLRenderer;
130 #endif
131 #ifdef USING_VULKAN
132  friend class VulkanRenderer;
133 #endif
134  void SwapBuffers() const noexcept;
139 
144  void SetWidth(int newWidth);
149  void SetHeight(int newHeight);
150  };
151 } //namespace Engine
eastl::shared_ptr< GLFWwindow > window
Definition: Window.hpp:98
This object stores any information regarding the created GLFW window.
Definition: Window.hpp:28
#define ENGINE_API
Definition: api.hpp:25
This is the main renderer parent class which contains the base methods required for a renderer...
Definition: Renderer.hpp:15
eastl::string title
Definition: Window.hpp:99