diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5b169011..41951ff0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_definitions(librw "RW_${LIBRW_PLATFORM}" ) -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) target_link_libraries(librw PRIVATE m @@ -120,14 +120,12 @@ endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") target_compile_options(librw PRIVATE - "-Wall" + ${GNU_PROJECT_WARNINGS} ) if (NOT LIBRW_PLATFORM_PS2) target_compile_options(librw PRIVATE - "-Wextra" - "-Wdouble-promotion" - "-Wpedantic" + ${GNU_PROJECT_WARNINGS_EXTRA} ) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") diff --git a/src/d3d/rwxbox.h b/src/d3d/rwxbox.h index 1abebe10..cf427648 100644 --- a/src/d3d/rwxbox.h +++ b/src/d3d/rwxbox.h @@ -100,7 +100,7 @@ Texture *readNativeTexture(Stream *stream); void writeNativeTexture(Texture *tex, Stream *stream); uint32 getSizeNativeTexture(Texture *tex); -enum { +enum : uint32 { D3DFMT_UNKNOWN = 0xFFFFFFFF, /* Swizzled formats */ diff --git a/src/gl/gl3device.cpp b/src/gl/gl3device.cpp index 96bddb28..1ad5feaf 100644 --- a/src/gl/gl3device.cpp +++ b/src/gl/gl3device.cpp @@ -1553,12 +1553,15 @@ startSDL2(void) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, profiles[i].major); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, profiles[i].minor); + SDL_Rect bounds; + SDL_GetDisplayBounds(glGlobals.currentMonitor, &bounds); + if(mode->flags & VIDEOMODEEXCLUSIVE) { - win = SDL_CreateWindow(glGlobals.winTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, mode->mode.w, mode->mode.h, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN); + win = SDL_CreateWindow(glGlobals.winTitle, bounds.x, bounds.y, mode->mode.w, mode->mode.h, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN); if (win) SDL_SetWindowDisplayMode(win, &mode->mode); } else { - win = SDL_CreateWindow(glGlobals.winTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, glGlobals.winWidth, glGlobals.winHeight, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); + win = SDL_CreateWindow(glGlobals.winTitle, bounds.x, bounds.y, glGlobals.winWidth, glGlobals.winHeight, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); if (win) SDL_SetWindowDisplayMode(win, NULL); } @@ -1940,7 +1943,20 @@ deviceSystemSDL2(DeviceReq req, void *arg, int32 n) case DEVICEFINALIZE: return finalizeOpenGL(); - // TODO: implement subsystems + case DEVICEGETNUMSUBSYSTEMS: + return SDL_GetNumVideoDisplays(); + case DEVICEGETSUBSSYSTEMINFO: + if (n > SDL_GetNumVideoDisplays()) + return 0; + strncpy(((SubSystemInfo*)arg)->name, SDL_GetDisplayName(n), sizeof(SubSystemInfo::name)); + return 1; + case DEVICEGETCURRENTSUBSYSTEM: + return glGlobals.currentMonitor; + case DEVICESETSUBSYSTEM: + if (n > SDL_GetNumVideoDisplays()) + return 0; + glGlobals.currentMonitor = n; + return 1; case DEVICEGETNUMVIDEOMODES: return glGlobals.numModes; diff --git a/src/gl/gl3render.cpp b/src/gl/gl3render.cpp index 4dd79ba7..55206c4e 100644 --- a/src/gl/gl3render.cpp +++ b/src/gl/gl3render.cpp @@ -121,7 +121,7 @@ lightingCB(Atomic *atomic) lightData.locals = locals; lightData.numLocals = 8; - if(atomic->geometry->flags & rw::Geometry::LIGHT){ + if(atomic->geometry->flags & rw::Geometry::LIGHT && engine->currentWorld){ ((World*)engine->currentWorld)->enumerateLights(atomic, &lightData); if((atomic->geometry->flags & rw::Geometry::NORMALS) == 0){ // Get rid of lights that need normals when we don't have any diff --git a/src/gl/rwgl3impl.h b/src/gl/rwgl3impl.h index 39f0050a..3176eb54 100644 --- a/src/gl/rwgl3impl.h +++ b/src/gl/rwgl3impl.h @@ -45,8 +45,8 @@ struct GlGlobals GLFWmonitor *monitor; int numMonitors; - int currentMonitor; #endif + int currentMonitor; DisplayMode *modes; int numModes;