Browse Source

Prepare for Windows support

Thomas Buck 10 years ago
parent
commit
7642114acd
4 changed files with 51 additions and 26 deletions
  1. 7
    0
      ChangeLog
  2. 30
    20
      src/CMakeLists.txt
  3. 0
    6
      src/OpenRaider.cpp
  4. 14
    0
      src/main.cpp

+ 7
- 0
ChangeLog View File

@@ -2,6 +2,13 @@
2 2
 
3 3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4 4
 
5
+	[ 20140501 ]
6
+	* Fix compiling with gcc on Arch Linux
7
+	- carstene1ns <dev@f4ke.de>
8
+
9
+	[ 20140418 ]
10
+	* Moved command code into own file
11
+
5 12
 	[ 20140416 ]
6 13
 	* Map list now stored in Menu
7 14
 

+ 30
- 20
src/CMakeLists.txt View File

@@ -1,33 +1,41 @@
1
-# Add SDL2 Library
2
-find_package (SDL2)
3
-include_directories (SYSTEM ${SDL2_INCLUDE_DIR})
4
-set (LIBS ${LIBS} ${SDL2_LIBRARY})
5
-
6
-# Add SDL2_ttf Library
7
-find_package (SDL2TTF)
8
-include_directories (SYSTEM ${SDL2TTF_INCLUDE_DIR})
9
-set (LIBS ${LIBS} ${SDL2TTF_LIBRARY})
10
-
11 1
 # Add OpenGL Library
12 2
 find_package (OpenGL REQUIRED)
13 3
 include_directories (SYSTEM ${OPENGL_INCLUDE_DIRS})
14 4
 set (LIBS ${LIBS} ${OPENGL_LIBRARIES})
15 5
 
16
-# Add OpenAL Library
17
-find_package (OpenAL)
18
-include_directories (SYSTEM ${OPENAL_INCLUDE_DIRS})
19
-set (LIBS ${LIBS} ${OPENAL_LIBRARIES})
20
-
21
-# Add ALUT Library
22
-find_package (ALUT)
23
-include_directories (SYSTEM ${ALUT_INCLUDE_DIRS})
24
-set (LIBS ${LIBS} ${ALUT_LIBRARIES})
25
-
26 6
 # Add Z Library
27 7
 find_package (ZLIB REQUIRED)
28 8
 include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
29 9
 set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
30 10
 
11
+# Add SDL2 Library
12
+find_package (SDL2)
13
+if (SDL2_FOUND)
14
+    include_directories (SYSTEM ${SDL2_INCLUDE_DIR})
15
+    set (LIBS ${LIBS} ${SDL2_LIBRARY})
16
+
17
+    # Add SDL2_ttf Library
18
+    find_package (SDL2TTF)
19
+    if (SDL2TTF_FOUND)
20
+        include_directories (SYSTEM ${SDL2TTF_INCLUDE_DIR})
21
+        set (LIBS ${LIBS} ${SDL2TTF_LIBRARY})
22
+    endif (SDL2TTF_FOUND)
23
+endif (SDL2_FOUND)
24
+
25
+# Add OpenAL Library
26
+find_package (OpenAL)
27
+if (OPENAL_FOUND)
28
+    include_directories (SYSTEM ${OPENAL_INCLUDE_DIRS})
29
+    set (LIBS ${LIBS} ${OPENAL_LIBRARIES})
30
+
31
+    # Add ALUT Library
32
+    find_package (ALUT)
33
+    if (ALUT_FOUND)
34
+        include_directories (SYSTEM ${ALUT_INCLUDE_DIRS})
35
+        set (LIBS ${LIBS} ${ALUT_LIBRARIES})
36
+    endif (ALUT_FOUND)
37
+endif (OPENAL_FOUND)
38
+
31 39
 #################################################################
32 40
 
33 41
 # Set Source files
@@ -51,6 +59,7 @@ set (SRCS ${SRCS} "World.cpp")
51 59
 # Select available Sound library
52 60
 if (OPENAL_FOUND AND ALUT_FOUND)
53 61
     set (SRCS ${SRCS} "SoundAL.cpp")
62
+    set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_AL")
54 63
 else (OPENAL_FOUND AND ALUT_FOUND)
55 64
     # Currently only OpenAL support
56 65
     message (FATAL_ERROR "OpenAL and ALUT are required!")
@@ -59,6 +68,7 @@ endif (OPENAL_FOUND AND ALUT_FOUND)
59 68
 # Select available Windowing library
60 69
 if (SDL2_FOUND AND SDL2TTF_FOUND)
61 70
     set (SRCS ${SRCS} "WindowSDL.cpp")
71
+    set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_SDL")
62 72
 else (SDL2_FOUND AND SDL2TTF_FOUND)
63 73
     # Currently only SDL2 support
64 74
     message (FATAL_ERROR "SDL2 and SDL2-TTF are required!")

+ 0
- 6
src/OpenRaider.cpp View File

@@ -9,8 +9,6 @@
9 9
 #include <cstring>
10 10
 #include <assert.h>
11 11
 
12
-#include "WindowSDL.h"
13
-
14 12
 #include "config.h"
15 13
 #include "Console.h"
16 14
 #include "Game.h"
@@ -478,10 +476,6 @@ void OpenRaider::frame() {
478 476
     // Get keyboard and mouse input
479 477
     getWindow().eventHandling();
480 478
 
481
-    // Clear screen
482
-    glClearColor(0.00f, 0.00f, 0.00f, 1.0f);
483
-    glClear(GL_COLOR_BUFFER_BIT);
484
-
485 479
     // Draw game scene
486 480
     getRender().display();
487 481
 

+ 14
- 0
src/main.cpp View File

@@ -14,8 +14,17 @@
14 14
 #include "main.h"
15 15
 #include "utils/time.h"
16 16
 
17
+#ifdef USING_AL
17 18
 #include "SoundAL.h"
19
+#else
20
+#error No Sound Library selected!
21
+#endif
22
+
23
+#ifdef USING_SDL
18 24
 #include "WindowSDL.h"
25
+#else
26
+#error No Windowing Library selected!
27
+#endif
19 28
 
20 29
 Camera gCamera;
21 30
 Console gConsole;
@@ -25,8 +34,13 @@ OpenRaider gOpenRaider;
25 34
 Render gRender;
26 35
 World gWorld;
27 36
 
37
+#ifdef USING_AL
28 38
 SoundAL gSound;
39
+#endif
40
+
41
+#ifdef USING_SDL
29 42
 WindowSDL gWindow;
43
+#endif
30 44
 
31 45
 Camera &getCamera() {
32 46
     return gCamera;

Loading…
Cancel
Save