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:
Dav999-v
2023-01-16 21:29:50 +01:00
committed by Misa Elizabeth Kai
parent 7c55ea7832
commit a706fb249a
8 changed files with 114 additions and 99 deletions

View File

@@ -1,5 +1,6 @@
#include "Constants.h"
#include "Enums.h"
#include "Font.h"
#include "Game.h"
#include "Graphics.h"
#include "GraphicsUtil.h"
@@ -134,8 +135,7 @@ void preloaderrender(void)
pre_fakepercent
);
int percentage_len = graphics.len(buffer);
graphics.Print(282-percentage_len, 204, buffer, 124, 112, 218, false);
font::print(PR_RIGHT | PR_CJK_HIGH, 282, 204, buffer, 124, 112, 218);
}
graphics.drawfade();