1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Replace float scale with int scale

This commit is contained in:
NyakoFox 2024-04-11 19:58:49 -03:00
parent c5b3664d5e
commit a53addecde
4 changed files with 10 additions and 9 deletions

View file

@ -1995,11 +1995,11 @@ static void menuactionpress(void)
music.playef(Sound_CRY);
break;
case 1:
touch::scale += 0.5;
touch::scale += 5;
music.playef(Sound_VIRIDIAN);
if (touch::scale > 2)
if (touch::scale > 20)
{
touch::scale = 0.5;
touch::scale = 5;
}
game.savestatsandsettings_menu();
break;

View file

@ -784,9 +784,10 @@ static void menurender(void)
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the scale of the UI buttons."), tr, tg, tb);
char buffer[SCREEN_WIDTH_CHARS + 1];
float scale = (float)touch::scale / 10.0;
vformat_buf(buffer, sizeof(buffer), loc::gettext("Current scale: {scale}.{extra}x"), "scale:int, extra:int",
(int)touch::scale,
(int)((float)((float)touch::scale - (int)touch::scale) * 10)
(int) scale,
(int) ((float) ((float) scale - (int) scale) * 10)
);
font::print(PR_CEN, -1, 75, buffer, tr, tg, tb);
break;

View file

@ -15,7 +15,7 @@ namespace touch
{
std::vector<VVV_Finger> fingers;
TouchButton buttons[NUM_TOUCH_BUTTONS];
float scale;
int scale;
int get_rect(TouchButton* button, SDL_Rect* rect)
{
@ -35,12 +35,12 @@ namespace touch
int scale_x = rect.w / SCREEN_WIDTH_PIXELS;
int scale_y = rect.h / SCREEN_HEIGHT_PIXELS;
return SDL_ceil(SDL_min(scale_x, scale_y) * scale);
return SDL_ceil(SDL_min(scale_x, scale_y) * ((float) scale / 10.f));
}
void init(void)
{
scale = 1;
scale = 10;
for (int i = 0; i < NUM_TOUCH_BUTTONS; i++)
{

View file

@ -46,7 +46,7 @@ namespace touch
{
extern std::vector<VVV_Finger> fingers;
extern TouchButton buttons[NUM_TOUCH_BUTTONS];
extern float scale;
extern int scale;
void refresh_buttons(void);
void reset(void);