[rcore] created SetWindowShouldClose
This commit is contained in:
parent
8ea5db3ec4
commit
0aea99507e
|
|
@ -313,6 +313,11 @@ bool WindowShouldClose(void)
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
CORE.Window.shouldClose = shouldClose;
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,12 @@ bool WindowShouldClose(void)
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
CORE.Window.shouldClose = shouldClose;
|
||||||
|
glfwSetWindowShouldClose(platform.handle, shouldClose);
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,12 @@ bool WindowShouldClose(void)
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
CORE.Window.shouldClose = shouldClose;
|
||||||
|
RGFW_window_setShouldClose(platform.window);
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,11 @@ bool WindowShouldClose(void)
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
CORE.Window.shouldClose = shouldClose;
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
@ -1063,7 +1068,7 @@ void PollInputEvents(void)
|
||||||
// All input events can be processed after polling
|
// All input events can be processed after polling
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case SDL_QUIT: CORE.Window.shouldClose = true; break;
|
case SDL_QUIT: SetWindowShouldClose(true); break;
|
||||||
|
|
||||||
case SDL_DROPFILE: // Dropped file
|
case SDL_DROPFILE: // Dropped file
|
||||||
{
|
{
|
||||||
|
|
@ -1150,7 +1155,7 @@ void PollInputEvents(void)
|
||||||
// TODO: Put exitKey verification outside the switch?
|
// TODO: Put exitKey verification outside the switch?
|
||||||
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey])
|
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey])
|
||||||
{
|
{
|
||||||
CORE.Window.shouldClose = true;
|
SetWindowShouldClose(true);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ static const short linuxToRaylibMap[KEYMAP_SIZE] = {
|
||||||
[BTN_TL] = GAMEPAD_BUTTON_LEFT_TRIGGER_1,
|
[BTN_TL] = GAMEPAD_BUTTON_LEFT_TRIGGER_1,
|
||||||
[BTN_TL2] = GAMEPAD_BUTTON_LEFT_TRIGGER_2,
|
[BTN_TL2] = GAMEPAD_BUTTON_LEFT_TRIGGER_2,
|
||||||
[BTN_TR] = GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
|
[BTN_TR] = GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
|
||||||
[BTN_TR2] GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
|
[BTN_TR2] = GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
|
||||||
[BTN_SELECT] = GAMEPAD_BUTTON_MIDDLE_LEFT,
|
[BTN_SELECT] = GAMEPAD_BUTTON_MIDDLE_LEFT,
|
||||||
[BTN_MODE] = GAMEPAD_BUTTON_MIDDLE,
|
[BTN_MODE] = GAMEPAD_BUTTON_MIDDLE,
|
||||||
[BTN_START] = GAMEPAD_BUTTON_MIDDLE_RIGHT,
|
[BTN_START] = GAMEPAD_BUTTON_MIDDLE_RIGHT,
|
||||||
|
|
@ -253,6 +253,11 @@ bool WindowShouldClose(void)
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
CORE.Window.shouldClose = shouldClose;
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
@ -668,7 +673,7 @@ void PollInputEvents(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check exit key
|
// Check exit key
|
||||||
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey] == 1) CORE.Window.shouldClose = true;
|
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey] == 1) SetWindowShouldClose(true);
|
||||||
|
|
||||||
// Register previous mouse position
|
// Register previous mouse position
|
||||||
if (platform.cursorRelative) CORE.Input.Mouse.currentPosition = (Vector2){ 0.0f, 0.0f };
|
if (platform.cursorRelative) CORE.Input.Mouse.currentPosition = (Vector2){ 0.0f, 0.0f };
|
||||||
|
|
@ -1139,7 +1144,7 @@ void ClosePlatform(void)
|
||||||
platform.device = EGL_NO_DISPLAY;
|
platform.device = EGL_NO_DISPLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE.Window.shouldClose = true; // Added to force threads to exit when the close window is called
|
SetWindowShouldClose(true); // Added to force threads to exit when the close window is called
|
||||||
|
|
||||||
// Close the evdev devices
|
// Close the evdev devices
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,12 @@ bool WindowShouldClose(void)
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
CORE.Window.shouldClose = shouldClose;
|
||||||
|
TRACELOG(LOG_WARNING, "SetWindowShouldClose() not available on target platform");
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,11 @@ bool WindowShouldClose(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowShouldClose(bool shouldClose)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "SetWindowShouldClose() has no effect on Web");
|
||||||
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -958,6 +958,7 @@ extern "C" { // Prevents name mangling of functions
|
||||||
RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
|
RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
|
||||||
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
||||||
RLAPI bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
|
RLAPI bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
|
||||||
|
RLAPI void SetWindowShouldClose(bool); // Set "Window Should Close" state
|
||||||
RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
|
RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
|
||||||
RLAPI bool IsWindowFullscreen(void); // Check if window is currently fullscreen
|
RLAPI bool IsWindowFullscreen(void); // Check if window is currently fullscreen
|
||||||
RLAPI bool IsWindowHidden(void); // Check if window is currently hidden (only PLATFORM_DESKTOP)
|
RLAPI bool IsWindowHidden(void); // Check if window is currently hidden (only PLATFORM_DESKTOP)
|
||||||
|
|
|
||||||
|
|
@ -678,7 +678,7 @@ void InitWindow(int width, int height, const char *title)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CORE.Time.frameCounter = 0;
|
CORE.Time.frameCounter = 0;
|
||||||
CORE.Window.shouldClose = false;
|
SetWindowShouldClose(false);
|
||||||
|
|
||||||
// Initialize random seed
|
// Initialize random seed
|
||||||
SetRandomSeed((unsigned int)time(NULL));
|
SetRandomSeed((unsigned int)time(NULL));
|
||||||
|
|
@ -2736,7 +2736,7 @@ void PlayAutomationEvent(AutomationEvent event)
|
||||||
case INPUT_GESTURE: GESTURES.current = event.params[0]; break; // param[0]: gesture (enum Gesture) -> rgestures.h: GESTURES.current
|
case INPUT_GESTURE: GESTURES.current = event.params[0]; break; // param[0]: gesture (enum Gesture) -> rgestures.h: GESTURES.current
|
||||||
#endif
|
#endif
|
||||||
// Window event
|
// Window event
|
||||||
case WINDOW_CLOSE: CORE.Window.shouldClose = true; break;
|
case WINDOW_CLOSE: SetWindowShouldClose(true); break;
|
||||||
case WINDOW_MAXIMIZE: MaximizeWindow(); break;
|
case WINDOW_MAXIMIZE: MaximizeWindow(); break;
|
||||||
case WINDOW_MINIMIZE: MinimizeWindow(); break;
|
case WINDOW_MINIMIZE: MinimizeWindow(); break;
|
||||||
case WINDOW_RESIZE: SetWindowSize(event.params[0], event.params[1]); break;
|
case WINDOW_RESIZE: SetWindowSize(event.params[0], event.params[1]); break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user