-
Notifications
You must be signed in to change notification settings - Fork 79
[ZH] Implement the system time and simulation timer within InGameUI #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The placement of the right side timer is not optimal. What are the options of fonts here? GenTool uses the "Tahoma" font for its top screen texts, starting with a size of 8. I do wonder if it would make sense to use that font again, to present it with a familiar look for legacy players. |
|
Everything is based off position from the left side of the screen, i just replicated what the weapon timers were doing by using a percentage of screen * current horizontal resolution. At 4:3 the simulation timer is just shy of touching the right side of the screen edge. I can make it relative to the right side of the screen The font can be whatever we want it to be, i just chose Ariel as it matches the other fonts of the ui message text and weapon timers. |
Ah it actually ends up being roughly 4 pixels per character as we have a fixed layout. This gives an idea of what it should be if you input EDIT: Actually it's not that straightforward, it can vary and be over or under. |
In GenTool I have a function to get the extent for font + text to get its width and height. With this information, refined positioning is possible. |
I could add the functionality to the display string class so it can return the area the current string covers. |
aead4da
to
e471c53
Compare
Just a rebase with recent main before making relevant changes. |
e471c53
to
3b89ec9
Compare
3b89ec9
to
d45833d
Compare
Updated with Tahoma set to bold and rebased with last 5 pushes to main. |
d45833d
to
907d2e4
Compare
Rebased with main and updated the colour of the frame string to be the same grey as Gentools |
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
Outdated
Show resolved
Hide resolved
907d2e4
to
7dfec20
Compare
Made an update covering most points. |
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
Outdated
Show resolved
Hide resolved
@@ -876,6 +876,21 @@ const FieldParse InGameUI::s_fieldParseTable[] = | |||
{ "ClearMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLEARMINES] ) }, | |||
{ "AmbulanceRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) }, | |||
|
|||
// TheSuperHackers @info ui enhancement configuration | |||
{ "SystemTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_systemTimeFont ) }, | |||
{ "SystemTimePointSize", INI::parseInt, NULL, offsetof( InGameUI, m_systemTimePointSize ) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point size can go into the Options.ini. GenTool also allows to customize the size.
And then we do not need the ShowSystemTime
option, because setting SystemTimePointSize
to 0 already implies that it is not shown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also mean making it an option to change the font size in the options menu when that time comes around, instead of it just being a toggle on and off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well even with the font size it could still be a toggle option. Off would mean font size 0, on would mean font size N. I think it is not necessary to have a "show" option if the point size itself already can say whether it is shown.
Users will ask for being able to make the font smaller, so this is inevitable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tweaked it so that the font size is controlled in the options and removed adjusting it from the ingameui.ini
7dfec20
to
44ee55a
Compare
Updated with recent suggestions |
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
Outdated
Show resolved
Hide resolved
44ee55a
to
5be13ba
Compare
Reworked based on recent suggestions |
3c09aac
to
eff725d
Compare
Pushed with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more small things.
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
Outdated
Show resolved
Hide resolved
TimeString.format(L"%2.2d:%2.2d:%2.2d", systemTime.wHour, systemTime.wMinute, systemTime.wSecond); | ||
Int adjustedSystemTimeFontSize = TheGlobalLanguageData->adjustFontSize(m_systemTimePointSize); | ||
GameFont* systemTimeFont = TheWindowManager->winFindFont(m_systemTimeFont, adjustedSystemTimeFontSize, m_systemTimeBold); | ||
m_systemTimeString->setFont(systemTimeFont); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setup is done every frame. This can be optimized by moving display string creation and setup to the constructor or init function. Can create a pair to freeCustomUiResources
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want people to be able to change the font size dynamically from the options menu then it will need to be setup every frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The settings in the Options Menu are applied when pressing ACCEPT, which calls a function. In this function we will then be able to call
freeCustomUiResources();
createCustomUiResources();
or
refreshCustomUiResources();
to rescale the texts.
This would then also need to be done after the Display Resolution has changed.
eff725d
to
699612e
Compare
Had to add an extra check when drawing the game time as the quickstart menu is not considered ingame and is not considered the shellmap |
This PR implements the system clock and simulation timer. Both can be stylised and moved by adding the relevant fields to the inGameUi.ini file.
The system time is just currently offset from the left while the simulation timer is positions based on a percentage of the current horizontal resolution, this is how the game timers are positioned on screen as well.
They are enabled by default for now, but can also be disabled in the options.ini and the code has been setup for future expansion for when the options menu gets expanded to include new features.
The following will disable them independently if added to the options.ini
EDIT: Updated example with latest version

EDIT2: Updated once more with the now grey frame string
Example:
TODO