Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/d3d/rwxbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
22 changes: 19 additions & 3 deletions src/gl/gl3device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/gl/gl3render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gl/rwgl3impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ struct GlGlobals

GLFWmonitor *monitor;
int numMonitors;
int currentMonitor;
#endif
int currentMonitor;

DisplayMode *modes;
int numModes;
Expand Down