mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-14 23:38:15 +00:00
InitWindow: return false if no monitor found
Otherwise we run into an assertion failure inside GLFW's glfwGetVideoMode. Example: http://www.cpantesters.org/cpan/report/b4ba5894-0bdb-11e8-841e-2c60b04e1d2d This is related to #456.
This commit is contained in:
@@ -1733,7 +1733,13 @@ static bool InitGraphicsDevice(int width, int height)
|
|||||||
// NOTE: Getting video modes is not implemented in emscripten GLFW3 version
|
// NOTE: Getting video modes is not implemented in emscripten GLFW3 version
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
// Find monitor resolution
|
// Find monitor resolution
|
||||||
const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||||
|
if (!monitor)
|
||||||
|
{
|
||||||
|
TraceLog(LOG_WARNING, "Failed to get monitor");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
|
||||||
|
|
||||||
displayWidth = mode->width;
|
displayWidth = mode->width;
|
||||||
displayHeight = mode->height;
|
displayHeight = mode->height;
|
||||||
|
Reference in New Issue
Block a user