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

Replace float scale with int scale

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

View file

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

View file

@ -775,9 +775,10 @@ static void menurender(void)
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the scale of the UI buttons."), tr, tg, tb); 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]; 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", vformat_buf(buffer, sizeof(buffer), loc::gettext("Current scale: {scale}.{extra}x"), "scale:int, extra:int",
(int)touch::scale, (int) scale,
(int)((float)((float)touch::scale - (int)touch::scale) * 10) (int) ((float) ((float) scale - (int) scale) * 10)
); );
font::print(PR_CEN, -1, 75, buffer, tr, tg, tb); font::print(PR_CEN, -1, 75, buffer, tr, tg, tb);
break; break;

View file

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

View file

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