From 837db2869277ce4a8015592d1e9f30e2edc08b7e Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Fri, 2 Nov 2018 19:40:59 +0000 Subject: [PATCH 1/3] support compilation on Haiku --- CMakeLists.txt | 6 ++++++ src/ui/interface.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb3681d78..c526599c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -845,6 +845,10 @@ if(BEOS) set(stratagus_SRCS ${stratagus_SRCS} ${beos_SRCS}) endif() +if(HAIKU) + set(stratagus_LIBS ${stratagus_LIBS} -lnetwork) +endif() + # Stratagus needs to have char by default signed # No idea how to tell this to other compilers if(CMAKE_COMPILER_IS_GNUCXX) @@ -976,6 +980,8 @@ elseif(BSD) message("Platform: BSD") elseif(BEOS) message("Platform: BEOS") +elseif(HAIKU) + message("Platform: Haiku") elseif(LINUX) message("Platform: Linux") else() diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 2e39baffe..db2b2c89a 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -732,6 +732,7 @@ static bool CommandKey(int key) case SDLK_SLASH: case SDLK_BACKSLASH: +#ifdef USE_OPENGL if (KeyModifiers & ModifierAlt) { if (GLShaderPipelineSupported) { char shadername[1024] = { '\0' }; @@ -739,6 +740,7 @@ static bool CommandKey(int key) SetMessage("%s", shadername); } } +#endif break; default: From fe82a13889fb4fdc641b2e8740681f09213ac714 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Fri, 2 Nov 2018 19:56:20 +0000 Subject: [PATCH 2/3] guard OPENGL requirement --- src/video/graphic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/graphic.cpp b/src/video/graphic.cpp index d0d169572..ef20ae8c6 100644 --- a/src/video/graphic.cpp +++ b/src/video/graphic.cpp @@ -1648,6 +1648,7 @@ void CFiller::Load() } } +#ifdef USE_OPENGL bool CGraphic::DeleteColorCyclingTextures() { if (!ColorCyclingTextures) return false; for (int i = 0; i < NumColorCycles; i++) { @@ -1658,5 +1659,5 @@ bool CGraphic::DeleteColorCyclingTextures() { ColorCyclingTextures = NULL; return true; } - +#endif //@} From 73daf29e85d09d3e4cd87dac5e46d3c9af06f110 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Fri, 2 Nov 2018 20:06:34 +0000 Subject: [PATCH 3/3] guard two more uses of OpenGL only variables --- src/video/sdl.cpp | 2 ++ src/video/video.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index 5e1983b0b..a00790824 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -639,12 +639,14 @@ void InitVideoSdl() if (TheScreen == NULL) { fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n", Video.Width, Video.Height, Video.Depth, SDL_GetError()); +#if defined(USE_OPENGL) || defined(USE_GLES) if (UseOpenGL) { fprintf(stderr, "Re-trying video without OpenGL\n"); UseOpenGL = false; InitVideoSdl(); return; } +#endif if (Video.FullScreen) { fprintf(stderr, "Re-trying video without fullscreen mode\n"); Video.FullScreen = false; diff --git a/src/video/video.cpp b/src/video/video.cpp index 50f17f91d..d1213a63b 100644 --- a/src/video/video.cpp +++ b/src/video/video.cpp @@ -394,10 +394,12 @@ void AddColorCyclingRange(unsigned int begin, unsigned int end) void SetColorCycleAll(bool value) { +#if defined(USE_OPENGL) || defined(USE_GLES) if (UseOpenGL) { // FIXME: In OpenGL-mode, we can only cycle the tileset graphic return; } +#endif CColorCycling::GetInstance().ColorCycleAll = value; }