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
 
2
 
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
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
 	[ 20140416 ]
12
 	[ 20140416 ]
6
 	* Map list now stored in Menu
13
 	* Map list now stored in Menu
7
 
14
 

+ 30
- 20
src/CMakeLists.txt View File

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
 # Add OpenGL Library
1
 # Add OpenGL Library
12
 find_package (OpenGL REQUIRED)
2
 find_package (OpenGL REQUIRED)
13
 include_directories (SYSTEM ${OPENGL_INCLUDE_DIRS})
3
 include_directories (SYSTEM ${OPENGL_INCLUDE_DIRS})
14
 set (LIBS ${LIBS} ${OPENGL_LIBRARIES})
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
 # Add Z Library
6
 # Add Z Library
27
 find_package (ZLIB REQUIRED)
7
 find_package (ZLIB REQUIRED)
28
 include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
8
 include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
29
 set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
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
 # Set Source files
41
 # Set Source files
51
 # Select available Sound library
59
 # Select available Sound library
52
 if (OPENAL_FOUND AND ALUT_FOUND)
60
 if (OPENAL_FOUND AND ALUT_FOUND)
53
     set (SRCS ${SRCS} "SoundAL.cpp")
61
     set (SRCS ${SRCS} "SoundAL.cpp")
62
+    set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_AL")
54
 else (OPENAL_FOUND AND ALUT_FOUND)
63
 else (OPENAL_FOUND AND ALUT_FOUND)
55
     # Currently only OpenAL support
64
     # Currently only OpenAL support
56
     message (FATAL_ERROR "OpenAL and ALUT are required!")
65
     message (FATAL_ERROR "OpenAL and ALUT are required!")
59
 # Select available Windowing library
68
 # Select available Windowing library
60
 if (SDL2_FOUND AND SDL2TTF_FOUND)
69
 if (SDL2_FOUND AND SDL2TTF_FOUND)
61
     set (SRCS ${SRCS} "WindowSDL.cpp")
70
     set (SRCS ${SRCS} "WindowSDL.cpp")
71
+    set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_SDL")
62
 else (SDL2_FOUND AND SDL2TTF_FOUND)
72
 else (SDL2_FOUND AND SDL2TTF_FOUND)
63
     # Currently only SDL2 support
73
     # Currently only SDL2 support
64
     message (FATAL_ERROR "SDL2 and SDL2-TTF are required!")
74
     message (FATAL_ERROR "SDL2 and SDL2-TTF are required!")

+ 0
- 6
src/OpenRaider.cpp View File

9
 #include <cstring>
9
 #include <cstring>
10
 #include <assert.h>
10
 #include <assert.h>
11
 
11
 
12
-#include "WindowSDL.h"
13
-
14
 #include "config.h"
12
 #include "config.h"
15
 #include "Console.h"
13
 #include "Console.h"
16
 #include "Game.h"
14
 #include "Game.h"
478
     // Get keyboard and mouse input
476
     // Get keyboard and mouse input
479
     getWindow().eventHandling();
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
     // Draw game scene
479
     // Draw game scene
486
     getRender().display();
480
     getRender().display();
487
 
481
 

+ 14
- 0
src/main.cpp View File

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

Loading…
Cancel
Save