1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

Add and use widget index for exit and option button

This commit is contained in:
Broxzier
2017-03-11 21:47:06 +01:00
parent 4cd39babbb
commit f688a2c9db
2 changed files with 19 additions and 5 deletions

View File

@@ -24,6 +24,10 @@
#include "../intro.h"
#include "../rct2.h"
enum WINDOW_TITLE_EXIT_WIDGET_IDX {
WIDX_EXIT,
};
static rct_widget window_title_exit_widgets[] = {
{ WWT_IMGBTN, 2, 0, 39, 0, 63, SPR_MENU_EXIT, STR_EXIT },
{ WIDGETS_END },
@@ -80,7 +84,7 @@ void window_title_exit_open()
WF_STICK_TO_BACK | WF_TRANSPARENT
);
window->widgets = window_title_exit_widgets;
window->enabled_widgets |= 1;
window->enabled_widgets |= (1ULL << WIDX_EXIT);
window_init_scroll_widgets(window);
}
@@ -93,9 +97,12 @@ static void window_title_exit_mouseup(rct_window *w, sint32 widgetIndex)
if (gIntroState != INTRO_STATE_NONE)
return;
if (widgetIndex == 0)
switch (widgetIndex) {
case WIDX_EXIT:
rct2_quit();
// game_do_command(0, 1, 0, 0, 5, 3, 0);
//game_do_command(0, 1, 0, 0, 5, 3, 0);
break;
};
}
/**

View File

@@ -23,6 +23,10 @@
#include "../interface/themes.h"
#include "../rct2.h"
enum WINDOW_TITLE_OPTIONS_WIDGET_IDX {
WIDX_OPTIONS,
};
static rct_widget window_title_options_widgets[] = {
{ WWT_DROPDOWN_BUTTON, 2, 0, 79, 0, 11, STR_OPTIONS, STR_OPTIONS_TIP },
{ WIDGETS_END },
@@ -78,7 +82,7 @@ void window_title_options_open()
WF_STICK_TO_BACK | WF_TRANSPARENT
);
window->widgets = window_title_options_widgets;
window->enabled_widgets |= 1;
window->enabled_widgets |= (1ULL << WIDX_OPTIONS);
window_init_scroll_widgets(window);
}
@@ -87,8 +91,11 @@ static void window_title_options_mouseup(rct_window *w, sint32 widgetIndex)
if (gIntroState != INTRO_STATE_NONE)
return;
if (widgetIndex == 0)
switch (widgetIndex) {
case WIDX_OPTIONS:
window_options_open();
break;
}
}
static void window_title_options_paint(rct_window *w, rct_drawpixelinfo *dpi)