9
9
#ifndef SIEGE_ENGINE_RENDERER_WINDOW_H
10
10
#define SIEGE_ENGINE_RENDERER_WINDOW_H
11
11
12
- #include " window/platform/glfw/Window.h"
12
+ #include < utils/collections/HeapArray.h>
13
+
14
+ #include " window/utils/Types.h"
13
15
14
16
namespace Siege
15
17
{
@@ -20,112 +22,51 @@ class Window
20
22
21
23
// 'Structors
22
24
23
- Window (char const * name, WindowExtents extents) : extents(extents)
24
- {
25
- Glfw::Initialize ();
25
+ Window (char const * name, WindowExtents extents);
26
26
27
- if (!window) window = Glfw::CreateWindow (name, extents. width , extents. height , this );
27
+ Window () : Window( " Window " , { 800 , 600 }) {}
28
28
29
- Glfw::SetIsMouseMotionRaw (window, true );
29
+ ~Window ( );
30
30
31
- Glfw::SetWindowMinimisedCallback (window, [](Glfw::Window pWindow, int isMinimised) {
32
- reinterpret_cast <Window*>(Glfw::GetUserPtr (pWindow))->isVisible = !isMinimised;
33
- });
31
+ // Public Getters
34
32
35
- Glfw::SetWindowResizedCallback (window, [](Glfw::Window pWindow, int width, int height) {
36
- auto windowContext = reinterpret_cast <Window*>(Glfw::GetUserPtr (pWindow));
37
- windowContext->wasResized = true ;
38
- windowContext->extents = {static_cast <uint32_t >(width), static_cast <uint32_t >(height)};
39
- });
33
+ int GetHeight () const ;
40
34
41
- DPI = Glfw::GetWindowDPI ();
42
- }
35
+ int GetWidth () const ;
43
36
44
- Window () : Window( " Window " , { 800 , 600 }) {}
37
+ bool IsVisible () const ;
45
38
46
- ~Window ()
47
- {
48
- Glfw::FreeWindow (window);
49
- Glfw::FreeGlfw ();
50
- }
39
+ unsigned int GetDPI () const ;
51
40
52
- // Public Getters
41
+ WindowExtents GetExtents () const ;
53
42
54
- const int GetHeight () const
55
- {
56
- return extents.height ;
57
- }
58
-
59
- const int GetWidth () const
60
- {
61
- return extents.width ;
62
- }
63
-
64
- const bool IsVisible () const
65
- {
66
- return isVisible;
67
- }
68
-
69
- const unsigned int GetDPI () const
70
- {
71
- // NOTE(Aryeh): Need to find a better solution when the DPI in different axes are not the
72
- // same
73
- return DPI.width ;
74
- }
75
-
76
- WindowExtents GetExtents () const
77
- {
78
- return extents;
79
- }
80
-
81
- Glfw::Window GetRawWindow ()
82
- {
83
- return window;
84
- }
43
+ void * GetRawWindow ();
85
44
86
45
// Public Functions
87
46
88
47
void Update ();
89
48
90
49
bool WindowShouldClose ();
91
50
92
- bool WasResized () const
93
- {
94
- return wasResized;
95
- }
51
+ bool WasResized () const ;
96
52
97
- void ResetWindowResized ()
98
- {
99
- wasResized = false ;
100
- }
53
+ void ResetWindowResized ();
101
54
102
- void EnableCursor ()
103
- {
104
- Glfw::SetIsCursorVisible (window, true );
105
- }
55
+ void EnableCursor ();
106
56
107
- void DisableCursor ()
108
- {
109
- Glfw::SetIsCursorVisible (window, false );
110
- }
57
+ void DisableCursor ();
111
58
112
59
static MHArray<const char *> GetRequiredExtensions ();
113
60
114
- void ToggleCursor (bool state)
115
- {
116
- state ? DisableCursor () : EnableCursor ();
117
- }
61
+ void ToggleCursor (bool state);
118
62
119
- void WaitEvents ()
120
- {
121
- Glfw::WaitEvents ();
122
- }
63
+ void WaitEvents ();
123
64
124
65
private:
125
66
126
67
// Private variables
127
68
128
- Glfw::Window window {nullptr };
69
+ void * window {nullptr };
129
70
130
71
WindowExtents extents;
131
72
MonitorPixelScale DPI {};
0 commit comments