Skip to content

Commit

Permalink
Position tool tips correctly on high resolutions (#1020)
Browse files Browse the repository at this point in the history
Fixes #1003
  • Loading branch information
eddebaby authored Apr 22, 2021
1 parent 6d330c3 commit 8dc16e3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gui_tooltips.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ void set_gui_tooltip_box_fmt(int bxtype,const char *format, ...)
va_end(val);
if (bxtype != 0) {
tool_tip_box.pos_x = GetMouseX();
tool_tip_box.pos_y = GetMouseY()+86;
long y_offset_times_two = (43 * units_per_pixel) >> 2;
long y_offset = (y_offset_times_two + (y_offset_times_two & 1)) >> 1; // equivalent to (86 * (units_per_pixel/16)) but accounts for rounding, 86 was the previous hard value of y_offset (meant for 640x400)
tool_tip_box.pos_y = GetMouseY() + y_offset;
}
tool_tip_box.field_809 = bxtype;
}
Expand Down Expand Up @@ -102,7 +104,9 @@ static inline TbBool update_gui_tooltip_button(struct GuiButton *gbtn)
{
tool_tip_box.gbutton = gbtn;
tool_tip_box.pos_x = GetMouseX();
tool_tip_box.pos_y = GetMouseY()+86;
long y_offset_times_two = (43 * units_per_pixel) >> 2;
long y_offset = (y_offset_times_two + (y_offset_times_two & 1)) >> 1; // equivalent to (86 * (units_per_pixel/16)) but accounts for rounding, 86 was the previous hard value of y_offset (meant for 640x400)
tool_tip_box.pos_y = GetMouseY() + y_offset;
tool_tip_box.field_809 = 0;
return true;
}
Expand Down

0 comments on commit 8dc16e3

Please sign in to comment.