Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

position tool tips correctly #1020

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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