OpenRCT2/src/openrct2-ui/windows/TitleOptions.cpp

94 lines
2.4 KiB
C++
Raw Normal View History

2015-02-20 01:35:29 +01:00
/*****************************************************************************
* Copyright (c) 2014-2019 OpenRCT2 developers
2015-02-20 01:35:29 +01:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2015-02-20 01:35:29 +01:00
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
2015-02-20 01:35:29 +01:00
*****************************************************************************/
2018-06-22 23:21:44 +02:00
#include <openrct2-ui/interface/Widget.h>
2017-08-06 21:20:05 +02:00
#include <openrct2-ui/windows/Window.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/Context.h>
2017-12-12 14:52:57 +01:00
#include <openrct2/Intro.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/config/Config.h>
2018-01-06 18:32:25 +01:00
#include <openrct2/localisation/Localisation.h>
2015-02-20 01:35:29 +01:00
// clang-format off
enum WINDOW_TITLE_OPTIONS_WIDGET_IDX {
WIDX_OPTIONS,
};
2015-02-20 01:35:29 +01:00
static rct_widget window_title_options_widgets[] = {
{ WWT_BUTTON, 2, 0, 79, 0, 14, STR_OPTIONS, STR_OPTIONS_TIP },
{ WIDGETS_END },
2015-02-20 01:35:29 +01:00
};
2017-05-01 15:41:45 +02:00
static void window_title_options_mouseup(rct_window *w, rct_widgetindex widgetIndex);
static void window_title_options_paint(rct_window *w, rct_drawpixelinfo *dpi);
2015-02-20 01:35:29 +01:00
static rct_window_event_list window_title_options_events = {
2017-08-15 10:07:44 +02:00
nullptr,
window_title_options_mouseup,
2017-08-15 10:07:44 +02:00
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
window_title_options_paint,
2017-08-15 10:07:44 +02:00
nullptr
2015-02-20 01:35:29 +01:00
};
// clang-format on
2015-02-20 01:35:29 +01:00
/**
* Creates the window containing the options button on the title screen.
*/
2018-06-22 23:21:44 +02:00
rct_window* window_title_options_open()
2015-02-20 01:35:29 +01:00
{
2018-06-22 23:21:44 +02:00
rct_window* window = window_create(
ScreenCoordsXY(context_get_width() - 80, 0), 80, 15, &window_title_options_events, WC_TITLE_OPTIONS,
WF_STICK_TO_BACK | WF_TRANSPARENT);
window->widgets = window_title_options_widgets;
window->enabled_widgets |= (1ULL << WIDX_OPTIONS);
window_init_scroll_widgets(window);
2017-08-06 05:22:00 +02:00
return window;
2015-02-20 01:35:29 +01:00
}
2018-06-22 23:21:44 +02:00
static void window_title_options_mouseup(rct_window* w, rct_widgetindex widgetIndex)
2015-02-20 01:35:29 +01:00
{
if (gIntroState != INTRO_STATE_NONE)
return;
2015-02-20 01:35:29 +01:00
2018-06-22 23:21:44 +02:00
switch (widgetIndex)
{
case WIDX_OPTIONS:
context_open_window(WC_OPTIONS);
break;
}
2015-02-20 01:35:29 +01:00
}
2018-06-22 23:21:44 +02:00
static void window_title_options_paint(rct_window* w, rct_drawpixelinfo* dpi)
2015-02-20 01:35:29 +01:00
{
window_draw_widgets(w, dpi);
}