mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Window_SetVisible -> Window_Show
We never actually need to hide the window, so it's useless having code to do this
This commit is contained in:
parent
e06091a9fe
commit
ddd81db6e2
@ -715,7 +715,7 @@ static void Game_RunLoop(void) {
|
|||||||
void Game_Run(int width, int height, const String* title) {
|
void Game_Run(int width, int height, const String* title) {
|
||||||
Window_Create(width, height);
|
Window_Create(width, height);
|
||||||
Window_SetTitle(title);
|
Window_SetTitle(title);
|
||||||
Window_SetVisible(true);
|
Window_Show();
|
||||||
|
|
||||||
Game_Load();
|
Game_Load();
|
||||||
Event_RaiseVoid(&WindowEvents.Resized);
|
Event_RaiseVoid(&WindowEvents.Resized);
|
||||||
|
@ -243,7 +243,7 @@ void Launcher_Run(void) {
|
|||||||
static const String title = String_FromConst(GAME_APP_TITLE);
|
static const String title = String_FromConst(GAME_APP_TITLE);
|
||||||
Window_Create(640, 400);
|
Window_Create(640, 400);
|
||||||
Window_SetTitle(&title);
|
Window_SetTitle(&title);
|
||||||
Window_SetVisible(true);
|
Window_Show();
|
||||||
|
|
||||||
Drawer2D_Component.Init();
|
Drawer2D_Component.Init();
|
||||||
Game_UpdateDimensions();
|
Game_UpdateDimensions();
|
||||||
|
35
src/Window.c
35
src/Window.c
@ -469,14 +469,10 @@ void Clipboard_SetText(const String* value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetVisible(bool visible) {
|
void Window_Show(void) {
|
||||||
if (visible) {
|
|
||||||
ShowWindow(win_handle, SW_SHOW);
|
ShowWindow(win_handle, SW_SHOW);
|
||||||
BringWindowToTop(win_handle);
|
BringWindowToTop(win_handle);
|
||||||
SetForegroundWindow(win_handle);
|
SetForegroundWindow(win_handle);
|
||||||
} else {
|
|
||||||
ShowWindow(win_handle, SW_HIDE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Window_GetWindowState(void) {
|
int Window_GetWindowState(void) {
|
||||||
@ -881,13 +877,7 @@ void Clipboard_SetText(const String* value) {
|
|||||||
XSetSelectionOwner(win_display, xa_clipboard, win_handle, 0);
|
XSetSelectionOwner(win_display, xa_clipboard, win_handle, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetVisible(bool visible) {
|
void Window_Show(void) { XMapWindow(win_display, win_handle); }
|
||||||
if (visible) {
|
|
||||||
XMapWindow(win_display, win_handle);
|
|
||||||
} else {
|
|
||||||
XUnmapWindow(win_display, win_handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Window_GetWindowState(void) {
|
int Window_GetWindowState(void) {
|
||||||
Atom prop_type;
|
Atom prop_type;
|
||||||
@ -1870,14 +1860,11 @@ void Window_SetTitle(const String* title) {
|
|||||||
SetWindowTitleWithCFString(win_handle, titleCF);
|
SetWindowTitleWithCFString(win_handle, titleCF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetVisible(bool visible) {
|
void Window_Show(void) {
|
||||||
if (visible) {
|
|
||||||
ShowWindow(win_handle);
|
ShowWindow(win_handle);
|
||||||
|
/* TODO: Do we actually need to reposition */
|
||||||
RepositionWindow(win_handle, NULL, kWindowCenterOnMainScreen);
|
RepositionWindow(win_handle, NULL, kWindowCenterOnMainScreen);
|
||||||
SelectWindow(win_handle);
|
SelectWindow(win_handle);
|
||||||
} else {
|
|
||||||
HideWindow(win_handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Window_GetWindowState(void) {
|
int Window_GetWindowState(void) {
|
||||||
@ -2106,13 +2093,7 @@ void Clipboard_SetText(const String* value) {
|
|||||||
SDL_SetClipboardText(str);
|
SDL_SetClipboardText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetVisible(bool visible) {
|
void Window_Show(void) { SDL_ShowWindow(win_handle); }
|
||||||
if (visible) {
|
|
||||||
SDL_ShowWindow(win_handle);
|
|
||||||
} else {
|
|
||||||
SDL_HideWindow(win_handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Window_GetWindowState(void) {
|
int Window_GetWindowState(void) {
|
||||||
Uint32 flags = SDL_GetWindowFlags(win_handle);
|
Uint32 flags = SDL_GetWindowFlags(win_handle);
|
||||||
@ -2677,7 +2658,7 @@ void Clipboard_RequestText(RequestClipboardCallback callback, void* obj) {
|
|||||||
clipboard_obj = obj;
|
clipboard_obj = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetVisible(bool visible) { }
|
void Window_Show(void) { }
|
||||||
|
|
||||||
int Window_GetWindowState(void) {
|
int Window_GetWindowState(void) {
|
||||||
EmscriptenFullscreenChangeEvent status;
|
EmscriptenFullscreenChangeEvent status;
|
||||||
@ -2994,7 +2975,7 @@ void Clipboard_SetText(const String* value) {
|
|||||||
|
|
||||||
|
|
||||||
/* Always a fullscreen window */
|
/* Always a fullscreen window */
|
||||||
void Window_SetVisible(bool visible) { }
|
void Window_Show(void) { }
|
||||||
int Window_GetWindowState(void) { return WINDOW_STATE_FULLSCREEN; }
|
int Window_GetWindowState(void) { return WINDOW_STATE_FULLSCREEN; }
|
||||||
void Window_EnterFullscreen(void) { }
|
void Window_EnterFullscreen(void) { }
|
||||||
void Window_ExitFullscreen(void) { }
|
void Window_ExitFullscreen(void) { }
|
||||||
@ -3746,7 +3727,7 @@ void Window_SetTitle(const String* title) {
|
|||||||
objc_msgSend(winHandle, sel_registerName("setTitle:"), titleCF);
|
objc_msgSend(winHandle, sel_registerName("setTitle:"), titleCF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetVisible(bool visible) { }
|
void Window_Show(void) { }
|
||||||
int Window_GetWindowState(void) { return 0; }
|
int Window_GetWindowState(void) { return 0; }
|
||||||
void Window_EnterFullscreen(void) { }
|
void Window_EnterFullscreen(void) { }
|
||||||
void Window_ExitFullscreen(void) { }
|
void Window_ExitFullscreen(void) { }
|
||||||
|
@ -86,8 +86,8 @@ CC_API void Clipboard_SetText(const String* value);
|
|||||||
/* With emscripten however, the callback is instead called when a 'paste' event arrives. */
|
/* With emscripten however, the callback is instead called when a 'paste' event arrives. */
|
||||||
void Clipboard_RequestText(RequestClipboardCallback callback, void* obj);
|
void Clipboard_RequestText(RequestClipboardCallback callback, void* obj);
|
||||||
|
|
||||||
/* Sets whether the window is visible on screen at all. */
|
/* Makes the window visible on screen. */
|
||||||
void Window_SetVisible(bool visible);
|
void Window_Show(void);
|
||||||
/* Gets the current state of the window, see WindowState enum. */
|
/* Gets the current state of the window, see WindowState enum. */
|
||||||
int Window_GetWindowState(void);
|
int Window_GetWindowState(void);
|
||||||
/* Switches the window to occupy the entire screen. */
|
/* Switches the window to occupy the entire screen. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user