1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Introduce widget::midX and widget::midY helper functions

This commit is contained in:
Aaron van Geffen
2020-06-25 10:31:15 +02:00
parent 681b8d7938
commit 2e153a7e95
25 changed files with 61 additions and 84 deletions

View File

@@ -1052,7 +1052,7 @@ static void input_widget_left(const ScreenCoordsXY& screenCoords, rct_window* w,
default:
if (widget_is_enabled(w, widgetIndex) && !widget_is_disabled(w, widgetIndex))
{
audio_play_sound(SoundId::Click1, 0, w->windowPos.x + ((widget->left + widget->right) / 2));
audio_play_sound(SoundId::Click1, 0, w->windowPos.x + widget->midX());
// Set new cursor down widget
gPressedWidget.window_classification = windowClass;
@@ -1334,7 +1334,7 @@ void input_state_widget_pressed(
break;
{
int32_t mid_point_x = (widget->left + widget->right) / 2 + w->windowPos.x;
int32_t mid_point_x = widget->midX() + w->windowPos.x;
audio_play_sound(SoundId::Click2, 0, mid_point_x);
}
if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)