2014-04-03 04:08:06 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 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/Viewport.h>
|
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
|
|
|
#include <openrct2/Context.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
#include <openrct2/localisation/StringIds.h>
|
2018-01-11 10:59:26 +01:00
|
|
|
#include <openrct2/world/Footpath.h>
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format off
|
2017-10-09 17:13:14 +02:00
|
|
|
static rct_widget window_main_widgets[] = {
|
2020-11-27 04:14:20 +01:00
|
|
|
MakeWidget({0, 0}, {0, 0}, WindowWidgetType::Viewport, WindowColour::Primary, STR_VIEWPORT),
|
2021-09-26 11:11:42 +02:00
|
|
|
WIDGETS_END,
|
2014-04-03 04:08:06 +02:00
|
|
|
};
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
void WindowMainPaint(rct_window *w, rct_drawpixelinfo *dpi);
|
2014-07-15 15:59:43 +02:00
|
|
|
|
2020-09-28 20:36:15 +02:00
|
|
|
static rct_window_event_list window_main_events([](auto& events)
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
events.paint = &WindowMainPaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
});
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format on
|
2014-07-15 15:59:43 +02:00
|
|
|
|
2014-04-03 04:08:06 +02:00
|
|
|
/**
|
2014-07-15 15:59:43 +02:00
|
|
|
* Creates the main window that holds the main viewport.
|
2014-04-03 04:08:06 +02:00
|
|
|
* rct2: 0x0066B3E8
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
rct_window* WindowMainOpen()
|
2014-04-03 04:08:06 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_main_widgets[0].right = context_get_width();
|
|
|
|
window_main_widgets[0].bottom = context_get_height();
|
2020-11-04 05:52:23 +01:00
|
|
|
rct_window* window = WindowCreate(
|
2019-10-19 13:07:03 +02:00
|
|
|
ScreenCoordsXY(0, 0), window_main_widgets[0].right, window_main_widgets[0].bottom, &window_main_events, WC_MAIN_WINDOW,
|
2018-06-22 23:21:44 +02:00
|
|
|
WF_STICK_TO_BACK);
|
2017-06-06 23:24:18 +02:00
|
|
|
window->widgets = window_main_widgets;
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2021-09-21 11:06:04 +02:00
|
|
|
viewport_create(window, window->windowPos, window->width, window->height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0)));
|
2017-06-06 23:24:18 +02:00
|
|
|
window->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
|
|
|
gCurrentRotation = 0;
|
|
|
|
gShowGridLinesRefCount = 0;
|
|
|
|
gShowLandRightsRefCount = 0;
|
|
|
|
gShowConstuctionRightsRefCount = 0;
|
2021-09-08 22:21:49 +02:00
|
|
|
WindowFootpathResetSelectedPath();
|
2017-08-12 23:06:12 +02:00
|
|
|
|
|
|
|
return window;
|
2014-04-21 11:27:48 +02:00
|
|
|
}
|
2014-07-15 15:59:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x66CCAE
|
2014-07-15 15:59:43 +02:00
|
|
|
* This function immediately jumps to 0x00685BE1 this is the second function
|
|
|
|
* decompiled.
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
void WindowMainPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-10-09 16:55:47 +02:00
|
|
|
{
|
2021-10-27 05:13:38 +02:00
|
|
|
viewport_render(dpi, w->viewport, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } });
|
2014-07-15 15:59:43 +02:00
|
|
|
}
|