mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- added I_FriendlyWindowTitle cvar, which takes the current game/mod name and uses it as a default window title.
This commit is contained in:
parent
037bb1408b
commit
d16ad3dcb5
4 changed files with 51 additions and 0 deletions
|
@ -127,6 +127,7 @@ void DrawHUD();
|
|||
|
||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||
|
||||
extern void I_SetWindowTitle(const char* caption);
|
||||
extern void ReadStatistics();
|
||||
extern void M_RestoreMode ();
|
||||
extern void M_SetDefaultMode ();
|
||||
|
@ -163,6 +164,7 @@ EXTERN_CVAR (Bool, lookstrafe)
|
|||
EXTERN_CVAR (Int, screenblocks)
|
||||
EXTERN_CVAR (Bool, sv_cheats)
|
||||
EXTERN_CVAR (Bool, sv_unlimited_pickup)
|
||||
EXTERN_CVAR (Bool, I_FriendlyWindowTitle)
|
||||
|
||||
extern int testingmode;
|
||||
extern bool setmodeneeded;
|
||||
|
@ -2737,6 +2739,9 @@ void D_DoomMain (void)
|
|||
setmodeneeded = false; // This may be set to true here, but isn't needed for a restart
|
||||
}
|
||||
|
||||
if (I_FriendlyWindowTitle)
|
||||
I_SetWindowTitle(DoomStartupInfo.Name.GetChars());
|
||||
|
||||
D_DoomLoop (); // this only returns if a 'restart' CCMD is given.
|
||||
//
|
||||
// Clean up after a restart
|
||||
|
@ -2891,3 +2896,12 @@ DEFINE_FIELD_X(InputEventData, event_t, data2)
|
|||
DEFINE_FIELD_X(InputEventData, event_t, data3)
|
||||
DEFINE_FIELD_X(InputEventData, event_t, x)
|
||||
DEFINE_FIELD_X(InputEventData, event_t, y)
|
||||
|
||||
|
||||
CUSTOM_CVAR(Bool, I_FriendlyWindowTitle, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
if (self)
|
||||
I_SetWindowTitle(DoomStartupInfo.Name.GetChars());
|
||||
else
|
||||
I_SetWindowTitle(NULL);
|
||||
}
|
|
@ -1519,3 +1519,14 @@ void I_SetMainWindowVisible(bool visible)
|
|||
{
|
||||
CocoaVideo::SetWindowVisible(visible);
|
||||
}
|
||||
|
||||
// each platform has its own specific version of this function.
|
||||
void I_SetWindowTitle(const char* title)
|
||||
{
|
||||
static NSString* const TITLE_STRING;
|
||||
if (title)
|
||||
TITLE_STRING = [NSString stringWithFormat:@"%s", title];
|
||||
else
|
||||
TITLE_STRING = [NSString stringWithFormat:@"%s %s", GAMESIG, GetVersionString()];
|
||||
[m_window setTitle:TITLE_STRING];
|
||||
}
|
|
@ -551,3 +551,16 @@ ADD_STAT (blit)
|
|||
BlitCycles.TimeMS(), SDLFlipCycles.TimeMS());
|
||||
return out;
|
||||
}
|
||||
|
||||
// each platform has its own specific version of this function.
|
||||
void I_SetWindowTitle(const char* caption)
|
||||
{
|
||||
if (caption)
|
||||
SDL_SetWindowTitle(Screen, caption);
|
||||
else
|
||||
{
|
||||
FString default_caption;
|
||||
default_caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
|
||||
SDL_SetWindowTitle(Screen, default_caption);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1360,3 +1360,16 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
|
|||
MainThread = INVALID_HANDLE_VALUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// each platform has its own specific version of this function.
|
||||
void I_SetWindowTitle(const char* caption)
|
||||
{
|
||||
if (caption)
|
||||
SetWindowText(Window, (LPCTSTR)caption);
|
||||
else
|
||||
{
|
||||
char default_caption[100];
|
||||
mysnprintf(default_caption, countof(default_caption), "" GAMESIG " %s " X64 " (%s)", GetVersionString(), GetGitTime());
|
||||
SetWindowText(Window, default_caption);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue