Skip to content

Commit

Permalink
set_window_fullscreen, get_window_os_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
samtupy committed Jan 5, 2025
1 parent a122caf commit 55c4bb0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ bool ShowNVGTWindow(const std::string& window_title) {
SDL_ShowWindow(g_WindowHandle);
SDL_RaiseWindow(g_WindowHandle);
voice_over_window_created();
#elif defined(__ANDROID__)
g_OSWindowHandle = (NSWindow*)SDL_GetPointerProperty(window_props, SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER, NULL);
#endif
g_WindowThreadId = thread_current_thread_id();
return true;
Expand Down Expand Up @@ -298,6 +300,10 @@ bool WindowIsHidden() {
if (!g_WindowHandle) return false;
return (SDL_GetWindowFlags(g_WindowHandle) & SDL_WINDOW_HIDDEN) != 0;
}
bool set_window_fullscreen(bool fullscreen) {
if (!g_WindowHandle) return false;
return SDL_SetWindowFullscreen(g_WindowHandle, fullscreen);
}
std::string get_window_text() {
if (!g_WindowHandle) return "";
return std::string(SDL_GetWindowTitle(g_WindowHandle));
Expand Down Expand Up @@ -436,6 +442,7 @@ void RegisterUI(asIScriptEngine* engine) {
engine->RegisterGlobalFunction("bool focus_window()", asFUNCTION(FocusNVGTWindow), asCALL_CDECL);
engine->RegisterGlobalFunction("bool is_window_active()", asFUNCTION(WindowIsFocused), asCALL_CDECL);
engine->RegisterGlobalFunction("bool is_window_hidden()", asFUNCTION(WindowIsHidden), asCALL_CDECL);
engine->RegisterGlobalFunction("bool set_window_fullscreen(bool fullscreen)", asFUNCTION(set_window_fullscreen), asCALL_CDECL);
engine->RegisterGlobalFunction("string get_window_text()", asFUNCTION(get_window_text), asCALL_CDECL);
engine->RegisterGlobalFunction("uint64 get_window_os_handle()", asFUNCTION(get_window_os_handle), asCALL_CDECL);
engine->RegisterGlobalFunction("void refresh_window()", asFUNCTION(refresh_window), asCALL_CDECL);
Expand Down

0 comments on commit 55c4bb0

Please sign in to comment.