2019-06-15 17:01:41 +02:00
|
|
|
#include "Window_internal.h"
|
|
|
|
|
|
2021-11-24 17:19:52 +02:00
|
|
|
#include "../entity/EntityList.h"
|
2021-11-26 16:49:52 +02:00
|
|
|
#include "../entity/EntityRegistry.h"
|
2021-05-29 06:01:32 +01:00
|
|
|
#include "Viewport.h"
|
2019-06-15 17:12:14 +02:00
|
|
|
|
2020-07-16 17:01:42 -04:00
|
|
|
void rct_window::SetLocation(const CoordsXYZ& coords)
|
2019-06-15 17:01:41 +02:00
|
|
|
{
|
2020-07-16 17:01:42 -04:00
|
|
|
window_scroll_to_location(this, coords);
|
2019-06-15 17:01:41 +02:00
|
|
|
flags &= ~WF_SCROLLING_TO_LOCATION;
|
|
|
|
|
}
|
2019-06-15 17:12:14 +02:00
|
|
|
|
|
|
|
|
void rct_window::ScrollToViewport()
|
|
|
|
|
{
|
2021-09-21 10:06:04 +01:00
|
|
|
if (viewport == nullptr || !focus.has_value())
|
2019-06-15 17:12:14 +02:00
|
|
|
return;
|
|
|
|
|
|
2021-09-21 10:06:04 +01:00
|
|
|
CoordsXYZ newCoords = focus.value().GetPos();
|
2019-06-15 17:12:14 +02:00
|
|
|
|
2020-07-15 22:26:27 -04:00
|
|
|
auto mainWindow = window_get_main();
|
2019-06-15 17:12:14 +02:00
|
|
|
if (mainWindow != nullptr)
|
2020-07-15 22:26:27 -04:00
|
|
|
window_scroll_to_location(mainWindow, newCoords);
|
2019-06-15 17:12:14 +02:00
|
|
|
}
|
2019-06-15 17:20:16 +02:00
|
|
|
|
|
|
|
|
void rct_window::Invalidate()
|
|
|
|
|
{
|
2020-07-08 12:16:24 -04:00
|
|
|
gfx_set_dirty_blocks({ windowPos, windowPos + ScreenCoordsXY{ width, height } });
|
2019-06-15 17:20:16 +02:00
|
|
|
}
|
2020-09-28 23:38:58 +03:00
|
|
|
|
|
|
|
|
void rct_window::RemoveViewport()
|
|
|
|
|
{
|
|
|
|
|
if (viewport == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-01-07 21:06:49 +02:00
|
|
|
viewport_remove(viewport);
|
2020-09-28 23:38:58 +03:00
|
|
|
viewport = nullptr;
|
|
|
|
|
}
|