Skip to content

Commit

Permalink
Merge pull request #161 from overbound/fix/1.1-menu-not-centered
Browse files Browse the repository at this point in the history
Fix/1.1 menu not centered
  • Loading branch information
AlexKhayrullin authored Jun 26, 2021
2 parents a706436 + 4dcaba1 commit f783072
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 10 additions & 7 deletions SonicTimeTwisted.gmx/scripts/menu_fn_set_scripts.gml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ if(DEVICE_INFO & DEVICE_TYPE_SMARTPHONE)
}
var view_height = view_hview[view_current];

internal__draw_menu_buttons_offset_x = (view_width - button_width)/2;
internal__draw_menu_buttons_offset_y = (view_height - min(internal__button_count, button_page_count)*button_slot_height)/2;

internal__draw_menu_rect_x_center = view_width/2;
internal__draw_menu_rect_y_center = view_height/2;

internal__draw_menu_buttons_offset_x = internal__draw_menu_rect_x_center - (button_width/2);
internal__draw_menu_rect_x1 = internal__draw_menu_buttons_offset_x - margin;
internal__draw_menu_rect_x2 = internal__draw_menu_buttons_offset_x + button_width + margin;
internal__draw_menu_rect_x_center = view_width/2;

internal__draw_menu_rect_y1 = internal__draw_menu_buttons_offset_y - margin;
internal__draw_menu_rect_y2 = internal__draw_menu_buttons_offset_y + (min(internal__button_count, button_page_count) * button_slot_height) + margin;
internal__draw_menu_rect_y_center = view_height/2;

if(argument1 == -1)
{
Expand Down Expand Up @@ -55,12 +57,13 @@ if(is_touchscreen)
scroll = 0;
scroll_target = 0;
scrollable = internal__button_count > button_page_count;

if(scrollable)
{
internal__draw_menu_buttons_offset_x = internal__draw_menu_buttons_offset_x - margin;
internal__draw_menu_rect_x1 = internal__draw_menu_rect_x1 - margin;
internal__draw_menu_rect_x2 = internal__draw_menu_rect_x2 + margin;
internal__draw_menu_rect_x_center = view_width/2 - margin;
internal__draw_menu_rect_x_center -= margin;
internal__draw_menu_buttons_offset_x -= margin;
internal__draw_menu_rect_x1 -= margin;
internal__draw_menu_rect_x2 += margin;

scroll_max = internal__button_count - button_page_count;
scroll_target = min(scroll_max, max(0, scroll_anchor - (button_page_count div 2)));
Expand Down
2 changes: 2 additions & 0 deletions SonicTimeTwisted.gmx/scripts/menu_fn_step_default.gml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ switch(state)
}
if(timer >= 10)
{
internal__menu_slide_offset_x = 0;
timer = 0;
state = 2;
}
Expand Down Expand Up @@ -246,6 +247,7 @@ switch(state)
}
if(timer >= 10)
{
internal__menu_slide_offset_x = 0;
timer = 0;
state = 2;
}
Expand Down

0 comments on commit f783072

Please sign in to comment.