2016-05-04 19:24:41 +02:00
|
|
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
2014-04-03 04:08:06 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
2016-05-04 19:24:41 +02:00
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
2014-04-03 04:08:06 +02:00
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
2014-04-03 04:08:06 +02:00
|
|
|
*****************************************************************************/
|
2016-05-04 19:24:41 +02:00
|
|
|
#pragma endregion
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2017-02-18 16:45:10 +01:00
|
|
|
#include "../config/Config.h"
|
2017-03-26 22:42:07 +02:00
|
|
|
#include "../Context.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../game.h"
|
|
|
|
#include "../sprites.h"
|
|
|
|
#include "../localisation/localisation.h"
|
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
2016-05-13 22:36:07 +02:00
|
|
|
#include "../intro.h"
|
2016-11-30 12:07:10 +01:00
|
|
|
#include "../rct2.h"
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2017-03-11 21:47:06 +01:00
|
|
|
enum WINDOW_TITLE_EXIT_WIDGET_IDX {
|
|
|
|
WIDX_EXIT,
|
|
|
|
};
|
|
|
|
|
2014-04-03 04:08:06 +02:00
|
|
|
static rct_widget window_title_exit_widgets[] = {
|
|
|
|
{ WWT_IMGBTN, 2, 0, 39, 0, 63, SPR_MENU_EXIT, STR_EXIT },
|
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_title_exit_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_title_exit_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
2014-04-29 22:10:57 +02:00
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_title_exit_events = {
|
|
|
|
NULL,
|
2014-04-29 22:10:57 +02:00
|
|
|
window_title_exit_mouseup,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2017-05-17 13:19:42 +02:00
|
|
|
NULL,
|
2014-04-29 22:10:57 +02:00
|
|
|
window_title_exit_paint,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL
|
2014-04-29 22:10:57 +02:00
|
|
|
};
|
|
|
|
|
2014-04-03 04:08:06 +02:00
|
|
|
/**
|
|
|
|
* Creates the window containing the exit button on the title screen.
|
|
|
|
* rct2: 0x0066B624 (part of 0x0066B3E8)
|
|
|
|
*/
|
|
|
|
void window_title_exit_open()
|
|
|
|
{
|
|
|
|
rct_window* window;
|
|
|
|
|
|
|
|
window = window_create(
|
2017-03-26 22:42:07 +02:00
|
|
|
context_get_width() - 40, context_get_height() - 64,
|
2014-04-24 21:26:05 +02:00
|
|
|
40, 64,
|
2015-07-10 02:39:16 +02:00
|
|
|
&window_title_exit_events,
|
2014-04-24 21:26:05 +02:00
|
|
|
WC_TITLE_EXIT,
|
2015-06-13 23:16:14 +02:00
|
|
|
WF_STICK_TO_BACK | WF_TRANSPARENT
|
2014-04-03 04:08:06 +02:00
|
|
|
);
|
2014-04-03 20:49:00 +02:00
|
|
|
window->widgets = window_title_exit_widgets;
|
2017-03-11 21:47:06 +01:00
|
|
|
window->enabled_widgets |= (1ULL << WIDX_EXIT);
|
2014-04-03 04:08:06 +02:00
|
|
|
window_init_scroll_widgets(window);
|
2014-04-21 11:27:48 +02:00
|
|
|
}
|
2014-04-29 22:10:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066B83C
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_title_exit_mouseup(rct_window *w, rct_widgetindex widgetIndex)
|
2014-04-29 22:10:57 +02:00
|
|
|
{
|
2016-05-13 22:36:07 +02:00
|
|
|
if (gIntroState != INTRO_STATE_NONE)
|
2014-04-29 22:10:57 +02:00
|
|
|
return;
|
|
|
|
|
2017-03-11 21:47:06 +01:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_EXIT:
|
2014-05-24 21:01:10 +02:00
|
|
|
rct2_quit();
|
2017-03-11 21:47:06 +01:00
|
|
|
//game_do_command(0, 1, 0, 0, 5, 3, 0);
|
|
|
|
break;
|
|
|
|
};
|
2014-04-29 22:10:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-29 22:10:57 +02:00
|
|
|
* rct2: 0x0066B836
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_title_exit_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
2014-04-29 22:10:57 +02:00
|
|
|
{
|
|
|
|
window_draw_widgets(w, dpi);
|
2015-05-12 16:13:30 +02:00
|
|
|
}
|