1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00
Files
OpenRCT2/src/openrct2-ui/windows/TitleOptions.cpp
Hielke Morsink 7f29e4e39c Make rct_windowclass strong type WindowClass
This already revealed some places where implicit conversions were done, including some where its use was nonsense (MouseInput.cpp).
The changes to the Intent class were necessary to keep things working, and this splits things up more neatly.
2022-08-21 18:38:25 +02:00

68 lines
2.1 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/Context.h>
#include <openrct2/Intro.h>
#include <openrct2/config/Config.h>
#include <openrct2/localisation/Localisation.h>
// clang-format off
enum WindowTitleOptionsWidgetIdx {
WIDX_OPTIONS,
};
static rct_widget window_title_options_widgets[] = {
MakeWidget({0, 0}, {80, 15}, WindowWidgetType::Button, WindowColour::Tertiary, STR_OPTIONS, STR_OPTIONS_TIP),
WIDGETS_END,
};
static void WindowTitleOptionsMouseup(rct_window *w, rct_widgetindex widgetIndex);
static void WindowTitleOptionsPaint(rct_window *w, rct_drawpixelinfo *dpi);
static rct_window_event_list window_title_options_events([](auto& events)
{
events.mouse_up = &WindowTitleOptionsMouseup;
events.paint = &WindowTitleOptionsPaint;
});
// clang-format on
/**
* Creates the window containing the options button on the title screen.
*/
rct_window* WindowTitleOptionsOpen()
{
rct_window* window = WindowCreate(
ScreenCoordsXY(context_get_width() - 80, 0), 80, 15, &window_title_options_events, WindowClass::TitleOptions,
WF_STICK_TO_BACK | WF_TRANSPARENT);
window->widgets = window_title_options_widgets;
WindowInitScrollWidgets(*window);
return window;
}
static void WindowTitleOptionsMouseup(rct_window* w, rct_widgetindex widgetIndex)
{
if (gIntroState != IntroState::None)
return;
switch (widgetIndex)
{
case WIDX_OPTIONS:
context_open_window(WindowClass::Options);
break;
}
}
static void WindowTitleOptionsPaint(rct_window* w, rct_drawpixelinfo* dpi)
{
WindowDrawWidgets(*w, dpi);
}