Skip to content

Commit 18406ad

Browse files
committed
Implemented review comments
1 parent dc83bff commit 18406ad

7 files changed

Lines changed: 26 additions & 23 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ include(RttrCoverageCfg)
241241
include(EnableSanitizers)
242242

243243
option(RTTR_USE_SYSTEM_LIBS "Default to using system-wide installed libs for external dependencies that have known system versions." OFF)
244+
245+
# Eg. Only libraries are able to run on android. The java native interface(jni) will call the SDL_main() function which calls main() in libs25client.so
246+
# https://developer.android.com/studio/projects/add-native-code
244247
option(RTTR_BUILD_LIB "Executables will be build as shared library." OFF)
245248

246249
################################################################################

external/glad/openglCfg.hpp.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
// The OpenGL(ES) major and minor version to be used
99
#define RTTR_OGL_MAJOR @RTTR_OGL_MAJOR@
1010
#define RTTR_OGL_MINOR @RTTR_OGL_MINOR@
11-
// True(thy) if OpenGL ES should be used
12-
#define RTTR_OGL_ES @RTTR_OGL_ES@
13-
// True(thy) if OpenGL compatibility profile should be used
14-
#define RTTR_OGL_COMPAT @RTTR_OGL_COMPAT@
15-
// True(thy) if gl4es should be used
16-
#define RTTR_OGL_GL4ES @RTTR_OGL_GL4ES@
1711

12+
// 1 if OpenGL ES should be used
13+
#cmakedefine01 RTTR_OGL_ES
14+
15+
// 1 if OpenGL compatibility profile should be used
16+
#cmakedefine01 RTTR_OGL_COMPAT
17+
18+
// 1 if gl4es should be used
19+
#cmakedefine01 RTTR_OGL_GL4ES
1820

1921
#endif

extras/videoDrivers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ rttr_set_output_dir(RUNTIME ${RTTR_DRIVERDIR}/video)
66
rttr_set_output_dir(LIBRARY ${RTTR_DRIVERDIR}/video)
77

88
add_subdirectory(WinAPI)
9-
add_subdirectory(SDL2)
9+
add_subdirectory(SDL2)

extras/videoDrivers/SDL2/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ if(SDL2_FOUND)
3939
LIBRARY DESTINATION ${RTTR_DRIVERDIR}/video
4040
)
4141
add_dependencies(drivers videoSDL2)
42-
endif()
42+
endif()

extras/videoDrivers/SDL2/VideoSDL2.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <boost/nowide/iostream.hpp>
1616
#include <SDL.h>
1717
#include <SDL_hints.h>
18+
#include <SDL_video.h>
1819
#include <algorithm>
1920
#include <memory>
2021

@@ -47,14 +48,6 @@ struct SDLMemoryDeleter
4748
void operator()(T* p) const { SDL_free(p); }
4849
};
4950

50-
#if RTTR_OGL_ES || RTTR_OGL_GL4ES
51-
constexpr SDL_GLprofile RTTR_SDL_GL_PROFILE = SDL_GL_CONTEXT_PROFILE_ES;
52-
#elif RTTR_OGL_COMPAT
53-
constexpr SDL_GLprofile RTTR_SDL_GL_PROFILE = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
54-
#else
55-
constexpr SDL_GLprofile RTTR_SDL_GL_PROFILE = SDL_GL_CONTEXT_PROFILE_CORE;
56-
#endif
57-
5851
template<typename T>
5952
using SDL_memory = std::unique_ptr<T, SDLMemoryDeleter<T>>;
6053

@@ -147,7 +140,15 @@ bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode& size, bo
147140
// GL-Attributes
148141
CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RTTR_OGL_MAJOR));
149142
CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RTTR_OGL_MINOR));
150-
CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, RTTR_SDL_GL_PROFILE));
143+
SDL_GLprofile profile;
144+
if(RTTR_OGL_ES || RTTR_OGL_GL4ES)
145+
profile = SDL_GL_CONTEXT_PROFILE_ES;
146+
else if(RTTR_OGL_COMPAT)
147+
profile = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
148+
else
149+
profile = SDL_GL_CONTEXT_PROFILE_CORE;
150+
151+
CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile));
151152

152153
CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8));
153154
CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8));

libs/driver/include/driver/MouseCoords.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ constexpr unsigned DOUBLE_CLICK_INTERVAL = 500;
2727
constexpr unsigned TOUCH_MAX_CLICK_INTERVAL = 250;
2828
constexpr unsigned TOUCH_DOUBLE_CLICK_INTERVAL = 175;
2929
// Max distance between the two clicks to trigger doubleclick
30-
constexpr unsigned TOUCH_MAX_DOUBLE_CLICK_DISTANCE = 30;
30+
constexpr unsigned TOUCH_MAX_DOUBLE_CLICK_DISTANCE = 30;

libs/rttrConfig/src/RttrConfig.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ bool RttrConfig::Init()
144144
bfs::path RttrConfig::getEnvOverride(const std::string& id, const bfs::path& defaultPath)
145145
{
146146
bfs::path path = System::getPathFromEnvVar("RTTR_" + id + "_DIR");
147-
if(!path.empty())
148-
{
149-
LOG.write("Note: %1% path manually set to %2%\n", LogTarget::Stdout) % id % path;
150-
} else
147+
if(path.empty())
151148
return defaultPath;
152-
149+
LOG.write("Note: %1% path manually set to %2%\n", LogTarget::Stdout) % id % path;
153150
return path;
154151
}

0 commit comments

Comments
 (0)