diff --git a/HISTORY.md b/HISTORY.md index 995423b3c..6291d5f29 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -270,7 +270,7 @@ First, some general numbers of this new update: Here the list with some highlights for `raylib 3.5`. - - NEW **Platform** supported: **Raspberry Pi 4 native mode** (no X11 windows) through [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) subsystem and GBM API. Actually this is a really interesting improvement because it opens the door to raylib to support other embedded platforms (Odroid, GameShell, NanoPi...). Also worth mentioning the un-official homebrew ports of raylib for [PS4](https://github.com/orbisdev/orbisdev-orbisGl2) and PSVita. + - NEW **Platform** supported: **Raspberry Pi 4 native mode** (no X11 windows) through [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) subsystem and GBM API. Actually this is a really interesting improvement because it opens the door to raylib to support other embedded platforms (Odroid, GameShell, NanoPi...). Also worth mentioning the un-official homebrew ports of raylib for [PS4](https://github.com/orbisdev/orbisdev-orbisGl2) and [PSVita](https://github.com/psp2dev/raylib4Vita). - NEW **configuration options** exposed: For custom raylib builds, `config.h` now exposes **more than 150 flags and defines** to build raylib with only the desired features, for example, it allows to build a minimal raylib library in just some KB removing all external data filetypes supported, very useful to generate **small executables or embedded devices**. diff --git a/examples/core/core_window_letterbox.c b/examples/core/core_window_letterbox.c index 4402dd2a3..1712b9ba5 100644 --- a/examples/core/core_window_letterbox.c +++ b/examples/core/core_window_letterbox.c @@ -71,6 +71,10 @@ int main(void) virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale; virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale; virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ gameScreenWidth, gameScreenHeight }); + + // Apply the same transformation as the virtual mouse to the real mouse (i.e. to work with raygui) + //SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth*scale))*0.5f, -(GetScreenHeight() - (gameScreenHeight*scale))*0.5f); + //SetMouseScale(1/scale, 1/scale); //---------------------------------------------------------------------------------- // Draw diff --git a/src/core.c b/src/core.c index be95665b9..cd3fa7bc2 100644 --- a/src/core.c +++ b/src/core.c @@ -1025,7 +1025,7 @@ void ToggleFullscreen(void) // Store previous window position (in case we exit fullscreen) glfwGetWindowPos(CORE.Window.handle, &CORE.Window.position.x, &CORE.Window.position.y); - GLFWmonitor *monitor = glfwGetPrimaryMonitor(); + GLFWmonitor *monitor = glfwGetWindowMonitor(CORE.Window.handle); if (!monitor) { TRACELOG(LOG_WARNING, "GLFW: Failed to get monitor"); @@ -1035,9 +1035,10 @@ void ToggleFullscreen(void) return; } - const GLFWvidmode *mode = glfwGetVideoMode(monitor); + const GLFWvidmode *mode = glfwGetVideoMode(monitor) + glfwSetWindowSizeCallback(CORE.Window.handle, NULL); - glfwSetWindowMonitor(CORE.Window.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate); + glfwSetWindowMonitor(CORE.Window.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate); glfwSetWindowSizeCallback(CORE.Window.handle, WindowSizeCallback); // Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS) @@ -1461,6 +1462,16 @@ int GetMonitorCount(void) #endif } +// Get number of monitors +int GetCurrentMonitor(void) +{ +#if defined(PLATFORM_DESKTOP) + return glfwGetWindowMonitor(CORE.Window.handle); +#else + return 0; +#endif +} + // Get selected monitor width Vector2 GetMonitorPosition(int monitor) { diff --git a/src/raylib.h b/src/raylib.h index 031640b12..fd85814ba 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -916,6 +916,7 @@ RLAPI void *GetWindowHandle(void); // Get native RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height RLAPI int GetMonitorCount(void); // Get number of connected monitors +RLAPI int GetCurrentMonitor(void); // Get current connected monitor RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position RLAPI int GetMonitorWidth(int monitor); // Get specified monitor width RLAPI int GetMonitorHeight(int monitor); // Get specified monitor height