Pārlūkot izejas kodu

Started with Window and WindowSDL

Thomas Buck 10 gadus atpakaļ
vecāks
revīzija
ac30fd8388
6 mainītis faili ar 119 papildinājumiem un 1 dzēšanām
  1. 1
    1
      CMakeLists.txt
  2. 3
    0
      include/OpenRaider.h
  3. 31
    0
      include/Window.h
  4. 44
    0
      include/WindowSDL.h
  5. 1
    0
      src/CMakeLists.txt
  6. 39
    0
      src/WindowSDL.cpp

+ 1
- 1
CMakeLists.txt Parādīt failu

@@ -36,7 +36,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
36 36
 #################################################################
37 37
 
38 38
 # Build warnings
39
-set (WARNINGS "${WARNINGS} -Weverything -Wno-padded -Wno-packed")
39
+set (WARNINGS "${WARNINGS} -Weverything -Wno-padded -Wno-packed -Wno-weak-vtables")
40 40
 set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
41 41
 set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
42 42
 set (WARNINGS "${WARNINGS} -Wno-missing-prototypes -Wno-missing-variable-declarations")

+ 3
- 0
include/OpenRaider.h Parādīt failu

@@ -8,6 +8,8 @@
8 8
 #ifndef _OPENRAIDER_H_
9 9
 #define _OPENRAIDER_H_
10 10
 
11
+#include "Window.h"
12
+
11 13
 /*!
12 14
  * \brief Main Game Singleton
13 15
  */
@@ -31,6 +33,7 @@ public:
31 33
     int loadConfig(const char *config);
32 34
 
33 35
 private:
36
+    Window *mWindow;
34 37
 };
35 38
 
36 39
 #endif

+ 31
- 0
include/Window.h Parādīt failu

@@ -0,0 +1,31 @@
1
+/*!
2
+ * \file include/Window.h
3
+ * \brief Windowing interface
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#ifndef _WINDOW_H_
9
+#define _WINDOW_H_
10
+
11
+/*!
12
+ * \brief Windowing interface
13
+ */
14
+class Window {
15
+public:
16
+
17
+    /*!
18
+     * \brief Deconstructs an object of Window
19
+     */
20
+    virtual ~Window() {}
21
+
22
+    virtual void setSize(unsigned int width, unsigned int height) = 0;
23
+
24
+    virtual void setFullscreen(bool fullscreen) = 0;
25
+
26
+    virtual void setMousegrab(bool grab) = 0;
27
+
28
+    virtual int initialize() = 0;
29
+};
30
+
31
+#endif

+ 44
- 0
include/WindowSDL.h Parādīt failu

@@ -0,0 +1,44 @@
1
+/*!
2
+ * \file include/WindowSDL.h
3
+ * \brief SDL windowing implementation
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#ifndef _WINDOW_SDL_H_
9
+#define _WINDOW_SDL_H_
10
+
11
+#include "Window.h"
12
+
13
+/*!
14
+ * \brief SDL windowing implementation
15
+ */
16
+class WindowSDL : public Window {
17
+public:
18
+
19
+    /*!
20
+     * \brief Constructs an object of WindowSDL
21
+     */
22
+    WindowSDL();
23
+
24
+    /*!
25
+     * \brief Deconstructs an object of WindowSDL
26
+     */
27
+    virtual ~WindowSDL();
28
+
29
+    virtual void setSize(unsigned int width, unsigned int height);
30
+
31
+    virtual void setFullscreen(bool fullscreen);
32
+
33
+    virtual void setMousegrab(bool grab);
34
+
35
+    virtual int initialize();
36
+
37
+private:
38
+    unsigned int mWidth;
39
+    unsigned int mHeight;
40
+    bool mFullscreen;
41
+    bool mMousegrab;
42
+};
43
+
44
+#endif

+ 1
- 0
src/CMakeLists.txt Parādīt failu

@@ -2,6 +2,7 @@
2 2
 set (SRCS ${SRCS} "main.cpp")
3 3
 set (SRCS ${SRCS} "OpenRaider.cpp")
4 4
 set (SRCS ${SRCS} "Sound.cpp")
5
+set (SRCS ${SRCS} "WindowSDL.cpp")
5 6
 
6 7
 #################################################################
7 8
 

+ 39
- 0
src/WindowSDL.cpp Parādīt failu

@@ -0,0 +1,39 @@
1
+/*!
2
+ * \file src/WindowSDL.cpp
3
+ * \brief SDL windowing implementation
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#include <assert.h>
9
+
10
+#include "WindowSDL.h"
11
+
12
+WindowSDL::WindowSDL() {
13
+
14
+}
15
+
16
+WindowSDL::~WindowSDL() {
17
+
18
+}
19
+
20
+void WindowSDL::setSize(unsigned int width, unsigned int height) {
21
+    assert(width > 0);
22
+    assert(height > 0);
23
+
24
+    mWidth = width;
25
+    mHeight = height;
26
+}
27
+
28
+void WindowSDL::setFullscreen(bool fullscreen) {
29
+    mFullscreen = fullscreen;
30
+}
31
+
32
+void WindowSDL::setMousegrab(bool grab) {
33
+    mMousegrab = grab;
34
+}
35
+
36
+int WindowSDL::initialize() {
37
+    return -1;
38
+}
39
+

Notiek ielāde…
Atcelt
Saglabāt