mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-23 07:39:18 -05:00
REMOVED: CORE.Window.fullscreen, using available flag instead
This commit is contained in:
@ -885,7 +885,6 @@ void ClosePlatform(void)
|
||||
// NOTE: returns false in case graphic device could not be created
|
||||
static int InitGraphicsDevice(void)
|
||||
{
|
||||
CORE.Window.fullscreen = true;
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
EGLint samples = 0;
|
||||
|
||||
@ -176,7 +176,7 @@ bool WindowShouldClose(void)
|
||||
// Toggle fullscreen mode
|
||||
void ToggleFullscreen(void)
|
||||
{
|
||||
if (!CORE.Window.fullscreen)
|
||||
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
// Store previous window position (in case we exit fullscreen)
|
||||
CORE.Window.previousPosition = CORE.Window.position;
|
||||
@ -192,8 +192,6 @@ void ToggleFullscreen(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to get monitor");
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
glfwSetWindowMonitor(platform.handle, NULL, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||
}
|
||||
@ -666,7 +664,7 @@ void SetWindowMonitor(int monitor)
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
if (CORE.Window.fullscreen)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
TRACELOG(LOG_INFO, "GLFW: Selected fullscreen monitor: [%i] %s", monitor, glfwGetMonitorName(monitors[monitor]));
|
||||
|
||||
@ -1422,8 +1420,6 @@ int InitPlatform(void)
|
||||
unsigned int requestedWindowFlags = CORE.Window.flags;
|
||||
|
||||
// Check window creation flags
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) CORE.Window.fullscreen = true;
|
||||
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window
|
||||
else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden
|
||||
|
||||
@ -1536,11 +1532,14 @@ int InitPlatform(void)
|
||||
// REF: https://github.com/raysan5/raylib/issues/1554
|
||||
glfwSetJoystickCallback(NULL);
|
||||
|
||||
GLFWmonitor *monitor = NULL;
|
||||
if (CORE.Window.fullscreen)
|
||||
if ((CORE.Window.screen.width == 0) || (CORE.Window.screen.height == 0)) FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
// Init window in fullscreen mode if requested
|
||||
// NOTE: Keeping original screen size for toggle
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
// NOTE: Fullscreen applications default to the primary monitor
|
||||
monitor = glfwGetPrimaryMonitor();
|
||||
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||
if (!monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to get primary monitor");
|
||||
@ -1614,9 +1613,6 @@ int InitPlatform(void)
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to initialize Window");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// NOTE: Full-screen change, not working properly...
|
||||
//glfwSetWindowMonitor(platform.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -290,14 +290,13 @@ bool WindowShouldClose(void)
|
||||
// Toggle fullscreen mode
|
||||
void ToggleFullscreen(void)
|
||||
{
|
||||
if (!CORE.Window.fullscreen)
|
||||
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
// Store previous window position (in case we exit fullscreen)
|
||||
CORE.Window.previousPosition = CORE.Window.position;
|
||||
CORE.Window.previousScreen = CORE.Window.screen;
|
||||
|
||||
platform.mon = RGFW_window_getMonitor(platform.window);
|
||||
CORE.Window.fullscreen = true;
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
RGFW_monitor_scaleToWindow(platform.mon, platform.window);
|
||||
@ -305,7 +304,6 @@ void ToggleFullscreen(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
if (platform.mon.mode.area.w)
|
||||
@ -331,7 +329,9 @@ void ToggleFullscreen(void)
|
||||
// Toggle borderless windowed mode
|
||||
void ToggleBorderlessWindowed(void)
|
||||
{
|
||||
if (CORE.Window.fullscreen)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) ToggleFullscreen();
|
||||
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||
{
|
||||
CORE.Window.previousPosition = CORE.Window.position;
|
||||
CORE.Window.previousScreen = CORE.Window.screen;
|
||||
@ -348,8 +348,6 @@ void ToggleBorderlessWindowed(void)
|
||||
CORE.Window.position = CORE.Window.previousPosition;
|
||||
RGFW_window_resize(platform.window, RGFW_AREA(CORE.Window.previousScreen.width, CORE.Window.previousScreen.height));
|
||||
}
|
||||
|
||||
CORE.Window.fullscreen = !CORE.Window.fullscreen;
|
||||
}
|
||||
|
||||
// Set window state: maximized, if resizable
|
||||
|
||||
@ -472,13 +472,11 @@ void ToggleFullscreen(void)
|
||||
{
|
||||
SDL_SetWindowFullscreen(platform.window, 0);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
CORE.Window.fullscreen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN);
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
CORE.Window.fullscreen = true;
|
||||
}
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
||||
@ -554,7 +552,7 @@ void SetWindowState(unsigned int flags)
|
||||
#endif
|
||||
{
|
||||
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN);
|
||||
CORE.Window.fullscreen = true;
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
||||
}
|
||||
@ -644,7 +642,6 @@ void ClearWindowState(unsigned int flags)
|
||||
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
SDL_SetWindowFullscreen(platform.window, 0);
|
||||
CORE.Window.fullscreen = false;
|
||||
}
|
||||
if (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE))
|
||||
{
|
||||
@ -1937,11 +1934,7 @@ int InitPlatform(void)
|
||||
FLAG_SET(flags, SDL_WINDOW_MOUSE_CAPTURE); // Window has mouse captured
|
||||
|
||||
// Check window creation flags
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
CORE.Window.fullscreen = true;
|
||||
FLAG_SET(flags, SDL_WINDOW_FULLSCREEN);
|
||||
}
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) FLAG_SET(flags, SDL_WINDOW_FULLSCREEN);
|
||||
|
||||
//if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_SET(flags, SDL_WINDOW_HIDDEN);
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) FLAG_SET(flags, SDL_WINDOW_BORDERLESS);
|
||||
|
||||
@ -454,7 +454,6 @@ int InitPlatform(void)
|
||||
// raylib uses OpenGL so, platform should create that kind of connection
|
||||
// Below example illustrates that process using EGL library
|
||||
//----------------------------------------------------------------------------
|
||||
CORE.Window.fullscreen = true;
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||
|
||||
@ -204,7 +204,6 @@ void ToggleFullscreen(void)
|
||||
|
||||
EM_ASM(document.exitFullscreen(););
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||
}
|
||||
@ -213,14 +212,12 @@ void ToggleFullscreen(void)
|
||||
if (enterFullscreen)
|
||||
{
|
||||
// NOTE: The setTimeouts handle the browser mode change delay
|
||||
EM_ASM
|
||||
(
|
||||
setTimeout(function()
|
||||
{
|
||||
EM_ASM(
|
||||
setTimeout(function(){
|
||||
Module.requestFullscreen(false, false);
|
||||
}, 100);
|
||||
);
|
||||
CORE.Window.fullscreen = true;
|
||||
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
|
||||
@ -238,7 +235,7 @@ void ToggleFullscreen(void)
|
||||
*/
|
||||
// EM_ASM(Module.requestFullscreen(false, false););
|
||||
/*
|
||||
if (!CORE.Window.fullscreen)
|
||||
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
// Option 1: Request fullscreen for the canvas element
|
||||
// This option does not seem to work at all:
|
||||
@ -274,7 +271,6 @@ void ToggleFullscreen(void)
|
||||
emscripten_get_canvas_element_size(platform.canvasId, &width, &height);
|
||||
TRACELOG(LOG_WARNING, "Emscripten: Enter fullscreen: Canvas size: %i x %i", width, height);
|
||||
|
||||
CORE.Window.fullscreen = true; // Toggle fullscreen flag
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
else
|
||||
@ -286,7 +282,6 @@ void ToggleFullscreen(void)
|
||||
emscripten_get_canvas_element_size(platform.canvasId, &width, &height);
|
||||
TRACELOG(LOG_WARNING, "Emscripten: Exit fullscreen: Canvas size: %i x %i", width, height);
|
||||
|
||||
CORE.Window.fullscreen = false; // Toggle fullscreen flag
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
*/
|
||||
@ -313,7 +308,6 @@ void ToggleBorderlessWindowed(void)
|
||||
|
||||
EM_ASM(document.exitFullscreen(););
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||
}
|
||||
@ -545,7 +539,6 @@ void ClearWindowState(unsigned int flags)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE) || (canvasStyleWidth > canvasWidth)) EM_ASM(document.exitFullscreen(););
|
||||
}
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
|
||||
@ -1155,8 +1148,6 @@ int InitPlatform(void)
|
||||
// glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
||||
|
||||
// Check window creation flags
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) CORE.Window.fullscreen = true;
|
||||
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window
|
||||
else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden
|
||||
|
||||
@ -1260,7 +1251,7 @@ int InitPlatform(void)
|
||||
// TODO: Consider requesting another type of canvas, not a WebGL one --> Replace GLFW-web by Emscripten?
|
||||
platform.pixels = (unsigned int *)RL_CALLOC(CORE.Window.screen.width*CORE.Window.screen.height, sizeof(unsigned int));
|
||||
#else
|
||||
if (CORE.Window.fullscreen)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
// remember center for switchinging from fullscreen to window
|
||||
if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width))
|
||||
@ -1830,7 +1821,6 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
|
||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||
if (!wasFullscreen)
|
||||
{
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||
}
|
||||
|
||||
@ -167,7 +167,6 @@ void ToggleFullscreen(void)
|
||||
|
||||
EM_ASM(document.exitFullscreen(););
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||
}
|
||||
@ -183,7 +182,7 @@ void ToggleFullscreen(void)
|
||||
Module.requestFullscreen(false, false);
|
||||
}, 100);
|
||||
);
|
||||
CORE.Window.fullscreen = true;
|
||||
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
|
||||
@ -201,7 +200,7 @@ void ToggleFullscreen(void)
|
||||
*/
|
||||
// EM_ASM(Module.requestFullscreen(false, false););
|
||||
/*
|
||||
if (!CORE.Window.fullscreen)
|
||||
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||
{
|
||||
// Option 1: Request fullscreen for the canvas element
|
||||
// This option does not seem to work at all:
|
||||
@ -237,7 +236,6 @@ void ToggleFullscreen(void)
|
||||
emscripten_get_canvas_element_size("#canvas", &width, &height);
|
||||
TRACELOG(LOG_WARNING, "Emscripten: Enter fullscreen: Canvas size: %i x %i", width, height);
|
||||
|
||||
CORE.Window.fullscreen = true; // Toggle fullscreen flag
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
else
|
||||
@ -249,7 +247,6 @@ void ToggleFullscreen(void)
|
||||
emscripten_get_canvas_element_size("#canvas", &width, &height);
|
||||
TRACELOG(LOG_WARNING, "Emscripten: Exit fullscreen: Canvas size: %i x %i", width, height);
|
||||
|
||||
CORE.Window.fullscreen = false; // Toggle fullscreen flag
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
*/
|
||||
@ -275,7 +272,6 @@ void ToggleBorderlessWindowed(void)
|
||||
|
||||
EM_ASM(document.exitFullscreen(););
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||
}
|
||||
@ -494,7 +490,6 @@ void ClearWindowState(unsigned int flags)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE) || (canvasStyleWidth > canvasWidth)) EM_ASM(document.exitFullscreen(););
|
||||
}
|
||||
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
}
|
||||
|
||||
@ -1117,8 +1112,6 @@ int InitPlatform(void)
|
||||
attribs.antialias = EM_FALSE;
|
||||
|
||||
// Check window creation flags
|
||||
//if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) CORE.Window.fullscreen = true;
|
||||
|
||||
// Disable FLAG_WINDOW_MINIMIZED, not supported
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||
|
||||
@ -1354,7 +1347,6 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
|
||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||
if (!wasFullscreen)
|
||||
{
|
||||
CORE.Window.fullscreen = false;
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user