2014-04-03 04:08:06 +02:00
|
|
|
/*****************************************************************************
|
2024-01-01 12:52:28 +01:00
|
|
|
* Copyright (c) 2014-2024 OpenRCT2 developers
|
2014-04-03 04:08:06 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2014-04-03 04:08:06 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2014-04-03 04:08:06 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-01-03 00:13:37 +01:00
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
|
|
|
#include <openrct2/Context.h>
|
|
|
|
#include <openrct2/config/Config.h>
|
|
|
|
#include <openrct2/localisation/Localisation.h>
|
|
|
|
#include <openrct2/sprites.h>
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2024-03-10 14:52:35 +01:00
|
|
|
namespace OpenRCT2::Ui::Windows
|
|
|
|
{
|
|
|
|
// clang-format off
|
2021-11-26 15:25:34 +01:00
|
|
|
enum WindowTitleExitWidgetIdx {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_EXIT,
|
2017-03-11 21:47:06 +01:00
|
|
|
};
|
|
|
|
|
2023-07-05 22:49:09 +02:00
|
|
|
static Widget _titleExitWidgets[] = {
|
2022-12-24 17:47:22 +01:00
|
|
|
MakeWidget({0, 0}, {40, 64}, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_EXIT), STR_EXIT),
|
2024-03-09 15:15:45 +01:00
|
|
|
kWidgetsEnd,
|
2014-04-03 04:08:06 +02:00
|
|
|
};
|
2024-03-10 14:52:35 +01:00
|
|
|
// clang-format on
|
2014-04-29 22:10:57 +02:00
|
|
|
|
2024-03-10 14:52:35 +01:00
|
|
|
class TitleExitWindow final : public Window
|
2022-10-20 11:33:46 +02:00
|
|
|
{
|
2024-03-10 14:52:35 +01:00
|
|
|
void OnOpen() override
|
|
|
|
{
|
|
|
|
widgets = _titleExitWidgets;
|
|
|
|
InitScrollWidgets();
|
|
|
|
}
|
2017-08-06 05:22:00 +02:00
|
|
|
|
2024-03-10 14:52:35 +01:00
|
|
|
void OnMouseUp(WidgetIndex widgetIndex) override
|
|
|
|
{
|
|
|
|
switch (widgetIndex)
|
|
|
|
{
|
|
|
|
case WIDX_EXIT:
|
|
|
|
ContextQuit();
|
|
|
|
// game_do_command(0, 1, 0, 0, 5, 3, 0);
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnDraw(DrawPixelInfo& dpi) override
|
2022-10-20 11:33:46 +02:00
|
|
|
{
|
2024-03-10 14:52:35 +01:00
|
|
|
DrawWidgets(dpi);
|
|
|
|
}
|
|
|
|
};
|
2014-04-29 22:10:57 +02:00
|
|
|
|
2024-03-10 14:52:35 +01:00
|
|
|
/**
|
|
|
|
* Creates the window containing the exit button on the title screen.
|
|
|
|
* rct2: 0x0066B624 (part of 0x0066B3E8)
|
|
|
|
*/
|
2024-03-17 07:37:46 +01:00
|
|
|
WindowBase* TitleExitOpen()
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2024-03-10 14:52:35 +01:00
|
|
|
return WindowCreate<TitleExitWindow>(
|
|
|
|
WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64,
|
|
|
|
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
2022-10-20 11:33:46 +02:00
|
|
|
}
|
2024-03-10 14:52:35 +01:00
|
|
|
} // namespace OpenRCT2::Ui::Windows
|