mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
window: show window dimensions on title bar when resizing window
This commit is contained in:
parent
ff79eae6c4
commit
b8da31869e
2 changed files with 17 additions and 8 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
|
|
||||||
bool m_isFullscreenKeyReleased = true;
|
bool m_isFullscreenKeyReleased = true;
|
||||||
|
bool m_isResizing = false;
|
||||||
|
|
||||||
int Window_OnSDLEvent(void*, SDL_Event* event)
|
int Window_OnSDLEvent(void*, SDL_Event* event)
|
||||||
{
|
{
|
||||||
|
|
@ -93,8 +94,10 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_WINDOWEVENT_RESIZED:
|
||||||
|
m_isResizing = true;
|
||||||
Window::s_width = event->window.data1;
|
Window::s_width = event->window.data1;
|
||||||
Window::s_height = event->window.data2;
|
Window::s_height = event->window.data2;
|
||||||
|
Window::SetTitle(std::format("{} - [{}x{}]", Window::GetTitle(), Window::s_width, Window::s_height).c_str());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
|
|
@ -187,4 +190,10 @@ void Window::Update()
|
||||||
Config::WindowWidth = Window::s_width;
|
Config::WindowWidth = Window::s_width;
|
||||||
Config::WindowHeight = Window::s_height;
|
Config::WindowHeight = Window::s_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_isResizing)
|
||||||
|
{
|
||||||
|
SetTitle();
|
||||||
|
m_isResizing = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,16 +58,16 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* GetTitle()
|
||||||
|
{
|
||||||
|
return Config::Language == ELanguage::Japanese
|
||||||
|
? "SONIC WORLD ADVENTURE"
|
||||||
|
: "SONIC UNLEASHED";
|
||||||
|
}
|
||||||
|
|
||||||
static void SetTitle(const char* title = nullptr)
|
static void SetTitle(const char* title = nullptr)
|
||||||
{
|
{
|
||||||
if (!title)
|
SDL_SetWindowTitle(s_pWindow, title ? title : GetTitle());
|
||||||
{
|
|
||||||
title = Config::Language == ELanguage::Japanese
|
|
||||||
? "SONIC WORLD ADVENTURE"
|
|
||||||
: "SONIC UNLEASHED";
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_SetWindowTitle(s_pWindow, title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsFullscreen()
|
static bool IsFullscreen()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue