mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 18:04:09 +03:00
Migrate more prints and graphics.len calls to font::
I especially focused on graphics.len and the print calls around them, because graphics.len calls appear a bit less often, might be overlooked when migrating print calls (thus possibly using different fonts by accident) and are often used for some kind of right-alignment or centering which can be changed into PR_RIGHT or PR_CEN with a different X anyway. Notably, I also added a new function to generate these kinds of sliders: ....[]............ Different languages means that the slider for analogue stick sensitivity needs to be longer to fit possibly long words for Low/Medium/High, and then different font sizes means that the longer slider won't fit onscreen in a language that needs a 12-wide font. So slider_get() can take a "target width", which dynamically changes the number of characters depending on the width of them in the interface font. I kinda forgot that I could force the 8x8 font instead of adapting the characters in the slider to the font, and other ideas (like using different characters or a more graphical progress bar) have been brought up on Discord, so this might all change again sooner or later.
This commit is contained in:
committed by
Misa Elizabeth Kai
parent
7c55ea7832
commit
a706fb249a
@@ -2833,7 +2833,7 @@ void Game::updatestate(void)
|
||||
"gamecomplete_n_trinkets:int",
|
||||
trinkets()
|
||||
);
|
||||
graphics.createtextboxflipme(label, 168-graphics.len(label), 84, 0,0,0);
|
||||
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 84, 0,0,0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
graphics.createtextboxflipme(buffer, 180, 84, 0, 0, 0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
@@ -2846,7 +2846,7 @@ void Game::updatestate(void)
|
||||
|
||||
const char* label = loc::gettext("Game Time:");
|
||||
std::string tempstring = savetime;
|
||||
graphics.createtextboxflipme(label, 168-graphics.len(label), 96, 0,0,0);
|
||||
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 96, 0,0,0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
graphics.createtextboxflipme(tempstring, 180, 96, 0, 0, 0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
@@ -2858,7 +2858,7 @@ void Game::updatestate(void)
|
||||
setstatedelay(45);
|
||||
|
||||
const char* label = loc::gettext("Total Flips:");
|
||||
graphics.createtextboxflipme(label, 168-graphics.len(label), 123, 0,0,0);
|
||||
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 123, 0,0,0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
graphics.createtextboxflipme(help.String(totalflips), 180, 123, 0, 0, 0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
@@ -2870,7 +2870,7 @@ void Game::updatestate(void)
|
||||
setstatedelay(45+15);
|
||||
|
||||
const char* label = loc::gettext("Total Deaths:");
|
||||
graphics.createtextboxflipme(label, 168-graphics.len(label), 135, 0,0,0);
|
||||
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 135, 0,0,0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
graphics.createtextboxflipme(help.String(deathcounts), 180, 135, 0, 0, 0);
|
||||
graphics.textboxprintflags(PR_FONT_INTERFACE);
|
||||
@@ -6888,7 +6888,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||
menuwidth = 0;
|
||||
for (size_t i = 0; i < menuoptions.size(); i++)
|
||||
{
|
||||
int width = i*menuspacing + graphics.len(menuoptions[i].text);
|
||||
int width = i*menuspacing + font::len(menuoptions[i].print_flags, menuoptions[i].text);
|
||||
if (width > menuwidth)
|
||||
menuwidth = width;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user