summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorRay <[email protected]>2018-02-12 11:27:26 +0100
committerGitHub <[email protected]>2018-02-12 11:27:26 +0100
commitdd8f0765b833bff2fbcc523e2d0a20d4fd28b5f3 (patch)
tree298dc5f3d8890bdb478c73c3737c751486b6ec5b /src/core.c
parentb908a4078a2f318e6bc9cbdcb7045d1ccab0c6a4 (diff)
parent8af5f9dfe0e23d918bb88a5fca9e5671c9100f3a (diff)
downloadraylib-dd8f0765b833bff2fbcc523e2d0a20d4fd28b5f3.tar.gz
raylib-dd8f0765b833bff2fbcc523e2d0a20d4fd28b5f3.zip
Merge pull request #465 from raysan5/develop
Integrate develop branch into master
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/core.c b/src/core.c
index 29f9a23a..ce017af2 100644
--- a/src/core.c
+++ b/src/core.c
@@ -294,11 +294,11 @@ static int renderOffsetX = 0; // Offset X from render area (must b
static int renderOffsetY = 0; // Offset Y from render area (must be divided by 2)
static bool fullscreen = false; // Fullscreen mode (useful only for PLATFORM_DESKTOP)
static Matrix downscaleView; // Matrix to downscale view (in case screen size bigger than display size)
+static bool cursorHidden = false; // Track if cursor is hidden
+static bool cursorOnScreen = false; // Tracks if cursor is inside client area
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB) || defined(PLATFORM_UWP)
static const char *windowTitle = NULL; // Window text title...
-static bool cursorHidden = false; // Track if cursor is hidden
-static bool cursorOnScreen = false; // Tracks if cursor is inside client area
static int screenshotCounter = 0; // Screenshots counter
// Register mouse states
@@ -441,12 +441,13 @@ void InitWindow(int width, int height, void *data)
uwpWindow = (EGLNativeWindowType)data;
#endif
+ // Init hi-res timer
+ InitTimer();
+
// Init graphics device (display device and OpenGL context)
// NOTE: returns true if window and graphic device has been initialized successfully
windowReady = InitGraphicsDevice(width, height);
-
- // Init hi-res timer
- InitTimer();
+ if (!windowReady) return;
#if defined(SUPPORT_DEFAULT_FONT)
// Load default font
@@ -1733,7 +1734,13 @@ static bool InitGraphicsDevice(int width, int height)
// NOTE: Getting video modes is not implemented in emscripten GLFW3 version
#if defined(PLATFORM_DESKTOP)
// 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;
displayHeight = mode->height;