OpenRaider  0.1.4-dev
Open Source Tomb Raider Game Engine implementation
Window.cpp
Go to the documentation of this file.
1 
8 #include "global.h"
9 #include "Camera.h"
10 #include "UI.h"
11 #include "system/Window.h"
12 
13 #ifdef USING_SDL
14 #include "system/WindowSDL.h"
15 #elif defined(USING_GLFW)
16 #include "system/WindowGLFW.h"
17 #else
18 #error "No windowing library selected!"
19 #endif
20 
22  int res;
23 
24 #ifdef USING_SDL
25  res = WindowSDL::initialize();
26 #elif defined(USING_GLFW)
27  res = WindowGLFW::initialize();
28 #else
29  res = -1;
30 #endif
31 
32  return res;
33 }
34 
36 #ifdef USING_SDL
38 #elif defined(USING_GLFW)
40 #endif
41 }
42 
44 #ifdef USING_SDL
46 #elif defined(USING_GLFW)
48 #endif
49 }
50 
52 #ifdef USING_SDL
54 #elif defined(USING_GLFW)
56 #endif
57 }
58 
59 void Window::setSize(glm::i32vec2 s) {
60 #ifdef USING_SDL
62 #elif defined(USING_GLFW)
64 #endif
65 
66  UI::setSize(s);
67  Camera::setSize(s);
68  glViewport(0, 0, s.x, s.y);
69 }
70 
71 glm::i32vec2 Window::getSize() {
72  glm::i32vec2 ret(-1, -1);
73 
74 #ifdef USING_SDL
75  ret = WindowSDL::getSize();
76 #elif defined(USING_GLFW)
77  ret = WindowGLFW::getSize();
78 #endif
79 
80  return ret;
81 }
82 
83 void Window::setFullscreen(bool f) {
84 #ifdef USING_SDL
86 #elif defined(USING_GLFW)
88 #endif
89 }
90 
92  bool ret;
93 
94 #ifdef USING_SDL
96 #elif defined(USING_GLFW)
98 #else
99  ret = false;
100 #endif
101 
102  return ret;
103 }
104 
105 void Window::setMousegrab(bool g) {
106 #ifdef USING_SDL
108 #elif defined(USING_GLFW)
110 #endif
111 }
112 
114  bool ret;
115 
116 #ifdef USING_SDL
117  ret = WindowSDL::getMousegrab();
118 #elif defined(USING_GLFW)
119  ret = WindowGLFW::getMousegrab();
120 #else
121  ret = false;
122 #endif
123 
124  return ret;
125 }
126 
127 void Window::setTextInput(bool t) {
128 #ifdef USING_SDL
130 #elif defined(USING_GLFW)
132 #endif
133 }
134 
136  bool ret;
137 
138 #ifdef USING_SDL
139  ret = WindowSDL::getTextInput();
140 #elif defined(USING_GLFW)
141  ret = WindowGLFW::getTextInput();
142 #else
143  ret = false;
144 #endif
145 
146  return ret;
147 }
148 
149 void Window::setClipboard(const char* s) {
150 #ifdef USING_SDL
152 #elif defined(USING_GLFW)
154 #endif
155 }
156 
157 const char* Window::getClipboard() {
158  const char* ret;
159 
160 #ifdef USING_SDL
161  ret = WindowSDL::getClipboard();
162 #elif defined(USING_GLFW)
163  ret = WindowGLFW::getClipboard();
164 #else
165  ret = nullptr;
166 #endif
167 
168  return ret;
169 }
170 
171 void Window::inputPositionCallback(int x, int y) {
172 #ifdef USING_SDL
174 #elif defined(USING_GLFW)
176 #endif
177 }
178 
static void swapBuffers()
Definition: WindowGLFW.cpp:72
static void setFullscreen(bool f)
Definition: WindowGLFW.cpp:94
static void eventHandling()
Definition: WindowGLFW.cpp:62
GLFW Windowing Implementation.
static bool getFullscreen()
Definition: WindowGLFW.h:26
SDL2 Windowing Implementation.
static int initialize()
Definition: WindowSDL.cpp:25
static void setClipboard(const char *s)
Definition: Window.cpp:149
static bool getFullscreen()
Definition: Window.cpp:91
static void swapBuffers()
Definition: WindowSDL.cpp:493
static void setMousegrab(bool g)
Definition: WindowSDL.cpp:537
static bool getTextInput()
Definition: WindowSDL.h:32
static void setClipboard(const char *s)
Definition: WindowGLFW.cpp:114
static bool getFullscreen()
Definition: WindowSDL.h:26
static void setClipboard(const char *s)
Definition: WindowSDL.cpp:557
static void setTextInput(bool t)
Definition: WindowSDL.cpp:549
Included everywhere.
static void inputPositionCallback(int x, int y)
Definition: WindowSDL.cpp:578
static void setFullscreen(bool f)
Definition: Window.cpp:83
static const char * getClipboard()
Definition: Window.cpp:157
static bool getTextInput()
Definition: Window.cpp:135
static void setMousegrab(bool g)
Definition: WindowGLFW.cpp:99
static void setTextInput(bool t)
Definition: Window.cpp:127
static void setFullscreen(bool f)
Definition: WindowSDL.cpp:526
Windowing Interface.
static bool getMousegrab()
Definition: Window.cpp:113
static int initialize()
Definition: WindowGLFW.cpp:27
static void shutdown()
Definition: WindowSDL.cpp:497
static void eventHandling()
Definition: Window.cpp:35
static glm::i32vec2 getSize()
Definition: WindowSDL.h:23
static bool getTextInput()
Definition: WindowGLFW.h:32
static void shutdown()
Definition: Window.cpp:51
static const char * getClipboard()
Definition: WindowGLFW.cpp:119
static bool getMousegrab()
Definition: WindowGLFW.h:29
static void inputPositionCallback(int x, int y)
Definition: Window.cpp:171
static void swapBuffers()
Definition: Window.cpp:43
UI/Event Manager.
static bool getMousegrab()
Definition: WindowSDL.h:29
Camera, View Frustum.
static void setMousegrab(bool g)
Definition: Window.cpp:105
static void setTextInput(bool t)
Definition: WindowGLFW.cpp:110
static void setSize(glm::i32vec2 s)
Definition: WindowSDL.cpp:516
static void setSize(glm::i32vec2 s)
Definition: Window.cpp:59
static void inputPositionCallback(int x, int y)
Definition: WindowGLFW.cpp:126
static void setSize(glm::i32vec2 s)
Definition: UI.cpp:39
static int initialize()
Definition: Window.cpp:21
static void eventHandling()
Definition: WindowSDL.cpp:112
static glm::i32vec2 getSize()
Definition: WindowGLFW.h:23
static void shutdown()
Definition: WindowGLFW.cpp:76
static void setSize(glm::i32vec2 s)
Definition: Camera.cpp:80
static glm::i32vec2 getSize()
Definition: Window.cpp:71
static void setSize(glm::i32vec2 s)
Definition: WindowGLFW.cpp:84
static const char * getClipboard()
Definition: WindowSDL.cpp:565