diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp index 0c60599bbb..1b467792b3 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp @@ -180,7 +180,7 @@ GLuint OpenGLFramebuffer::CreateDepthTexture(int32_t width, int32_t height) return depth; } -void OpenGLFramebuffer::GetPixels(RenderTarget& rt) const +void OpenGLFramebuffer::GetPixels(Drawing::RenderTarget& rt) const { assert(rt.width == _width && rt.height == _height); @@ -200,7 +200,7 @@ void OpenGLFramebuffer::GetPixels(RenderTarget& rt) const } } -void OpenGLFramebuffer::SetPixels(const RenderTarget& rt) +void OpenGLFramebuffer::SetPixels(const Drawing::RenderTarget& rt) { assert(rt.width == _width && rt.height == _height); diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h index 0507a049fe..4b5d50ed7e 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h @@ -58,12 +58,12 @@ namespace OpenRCT2::Ui void Bind() const; void BindDraw() const; void BindRead() const; - void GetPixels(RenderTarget& rt) const; + void GetPixels(Drawing::RenderTarget& rt) const; void SwapColourBuffer(OpenGLFramebuffer& other); GLuint SwapDepthTexture(GLuint depth); void Copy(OpenGLFramebuffer& src, GLenum filter); - void SetPixels(const RenderTarget& rt); + void SetPixels(const Drawing::RenderTarget& rt); static GLuint CreateDepthTexture(int32_t width, int32_t height); }; diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h index 513995b50f..aa580a16ac 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h @@ -20,9 +20,13 @@ #include #include -struct RenderTarget; struct PaletteMap; -enum class FilterPaletteID : int32_t; + +namespace OpenRCT2::Drawing +{ + enum class FilterPaletteID : int32_t; + struct RenderTarget; +} // namespace OpenRCT2::Drawing namespace OpenRCT2::Ui { @@ -211,7 +215,7 @@ namespace OpenRCT2::Ui GLuint GetAtlasesTexture(); GLuint GetPaletteTexture(); GLuint GetBlendPaletteTexture(); - static GLint PaletteToY(FilterPaletteID palette); + static GLint PaletteToY(Drawing::FilterPaletteID palette); private: void CreateTextures(); @@ -221,11 +225,11 @@ namespace OpenRCT2::Ui AtlasTextureInfo LoadGlyphTexture(const ImageId image, const PaletteMap& paletteMap); AtlasTextureInfo AllocateImage(int32_t imageWidth, int32_t imageHeight); AtlasTextureInfo LoadBitmapTexture(ImageIndex image, const void* pixels, size_t width, size_t height); - static RenderTarget GetImageAsDPI(const ImageId imageId); - static RenderTarget GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap); + static Drawing::RenderTarget GetImageAsDPI(const ImageId imageId); + static Drawing::RenderTarget GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap); void FreeTextures(); - static RenderTarget CreateDPI(int32_t width, int32_t height); - static void DeleteDPI(RenderTarget rt); + static Drawing::RenderTarget CreateDPI(int32_t width, int32_t height); + static void DeleteDPI(Drawing::RenderTarget rt); }; } // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/interface/Graph.h b/src/openrct2-ui/interface/Graph.h index 9d0d637150..eb56c73806 100644 --- a/src/openrct2-ui/interface/Graph.h +++ b/src/openrct2-ui/interface/Graph.h @@ -68,7 +68,7 @@ namespace OpenRCT2::Graph } }; - void DrawFinanceGraph(RenderTarget& rt, const GraphProperties& p); - void DrawRatingGraph(RenderTarget& rt, const GraphProperties& p); - void DrawGuestGraph(RenderTarget& rt, const GraphProperties& p); + void DrawFinanceGraph(Drawing::RenderTarget& rt, const GraphProperties& p); + void DrawRatingGraph(Drawing::RenderTarget& rt, const GraphProperties& p); + void DrawGuestGraph(Drawing::RenderTarget& rt, const GraphProperties& p); } // namespace OpenRCT2::Graph diff --git a/src/openrct2-ui/interface/InGameConsole.h b/src/openrct2-ui/interface/InGameConsole.h index fb83b6cd63..b1fc28e676 100644 --- a/src/openrct2-ui/interface/InGameConsole.h +++ b/src/openrct2-ui/interface/InGameConsole.h @@ -69,7 +69,7 @@ namespace OpenRCT2::Ui void Scroll(int32_t linesToScroll); void Update(); - void Draw(RenderTarget& rt) const; + void Draw(Drawing::RenderTarget& rt) const; private: void ClearInput(); diff --git a/src/openrct2-ui/interface/Widget.h b/src/openrct2-ui/interface/Widget.h index 8de17d6b22..da160cb0d7 100644 --- a/src/openrct2-ui/interface/Widget.h +++ b/src/openrct2-ui/interface/Widget.h @@ -78,7 +78,7 @@ namespace OpenRCT2::Ui const ScreenCoordsXY& origin, const ScreenSize& size, WidgetType type, WindowColour colour, ImageIndex content, StringId tooltip = kStringIdNone) { - return makeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::paletteNull), tooltip); + return makeWidget(origin, size, type, colour, ImageId(content, Drawing::FilterPaletteID::paletteNull), tooltip); } constexpr Widget makeTab(const ScreenCoordsXY& origin, StringId tooltip = kStringIdNone) @@ -248,7 +248,7 @@ namespace OpenRCT2::Ui makeDropdownButtonWidget(origin, size, type, colour, content, tooltip)); }; - void widgetDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex); + void widgetDraw(Drawing::RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex); bool widgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex); bool widgetIsHoldable(const WindowBase& w, WidgetIndex widgetIndex); diff --git a/src/openrct2-ui/interface/Window.h b/src/openrct2-ui/interface/Window.h index fbdb0b1c50..dca1d5d5df 100644 --- a/src/openrct2-ui/interface/Window.h +++ b/src/openrct2-ui/interface/Window.h @@ -23,8 +23,8 @@ namespace OpenRCT2::Ui struct Window : WindowBase { - void onDraw(RenderTarget& rt) override; - void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override; + void onDraw(Drawing::RenderTarget& rt) override; + void onDrawWidget(WidgetIndex widgetIndex, Drawing::RenderTarget& rt) override; void scrollToViewport(); void initScrollWidgets(); @@ -36,7 +36,7 @@ namespace OpenRCT2::Ui void setWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value); void setWidgetPressed(WidgetIndex widgetIndex, bool value); void setCheckboxValue(WidgetIndex widgetIndex, bool value); - void drawWidgets(RenderTarget& rt); + void drawWidgets(Drawing::RenderTarget& rt); void close(); void closeOthers(); void closeOthersOfThisClass(); @@ -86,8 +86,8 @@ namespace OpenRCT2::Ui::Windows void InvalidateAllWindowsAfterInput(); - void WindowDrawWidgets(WindowBase& w, RenderTarget& rt); - void WindowDrawViewport(RenderTarget& rt, WindowBase& w); + void WindowDrawWidgets(WindowBase& w, Drawing::RenderTarget& rt); + void WindowDrawViewport(Drawing::RenderTarget& rt, WindowBase& w); void WindowZoomIn(WindowBase& w, bool atCursor); void WindowZoomOut(WindowBase& w, bool atCursor); diff --git a/src/openrct2-ui/scripting/CustomListView.h b/src/openrct2-ui/scripting/CustomListView.h index ab00a4a21f..119ac4fa4f 100644 --- a/src/openrct2-ui/scripting/CustomListView.h +++ b/src/openrct2-ui/scripting/CustomListView.h @@ -138,15 +138,17 @@ namespace OpenRCT2::Ui::Windows void MouseOver(const ScreenCoordsXY& pos, bool isMouseDown); void MouseDown(const ScreenCoordsXY& pos); void MouseUp(const ScreenCoordsXY& pos); - void Paint(WindowBase* w, RenderTarget& rt, const ScrollArea* scroll) const; + void Paint(WindowBase* w, Drawing::RenderTarget& rt, const ScrollArea* scroll) const; private: void PaintHeading( - WindowBase* w, RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text, - ColumnSortOrder sortOrder, bool isPressed) const; - void PaintSeparator(RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const; + WindowBase* w, Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, + const std::string& text, ColumnSortOrder sortOrder, bool isPressed) const; + void PaintSeparator( + Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const; void PaintCell( - RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const; + Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, + bool isHighlighted) const; std::optional GetItemIndexAt(const ScreenCoordsXY& pos); Widget* GetWidget() const; void Invalidate(); diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 4b98178e89..6b16a6f41a 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -536,7 +536,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); DrawTabImages(rt); diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 135660010f..f5188b0823 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -147,7 +147,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -219,7 +219,7 @@ namespace OpenRCT2::Ui::Windows } } - int32_t DrawOpenRCT2Info(RenderTarget& rt) + int32_t DrawOpenRCT2Info(Drawing::RenderTarget& rt) { // Draw logo on placeholder widget const auto& logoWidget = widgets[WIDX_OPENRCT2_LOGO]; @@ -252,7 +252,7 @@ namespace OpenRCT2::Ui::Windows return textCoords.y - windowPos.y; } - int32_t DrawRCT2Info(RenderTarget& rt) + int32_t DrawRCT2Info(Drawing::RenderTarget& rt) { auto& backgroundWidget = widgets[WIDX_PAGE_BACKGROUND]; auto textCoords = windowPos + ScreenCoordsXY{ backgroundWidget.midX(), backgroundWidget.top + kPadding }; diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp index c47ddef779..6705cb6f6d 100644 --- a/src/openrct2-ui/windows/AssetPacks.cpp +++ b/src/openrct2-ui/windows/AssetPacks.cpp @@ -187,12 +187,12 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_APPLY].top = widgets[WIDX_APPLY].bottom - 24; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; Rectangle::fill( @@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows } private: - void PaintItem(RenderTarget& rt, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted) + void PaintItem(Drawing::RenderTarget& rt, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted) { auto listWidth = widgets[WIDX_LIST].right - widgets[WIDX_LIST].left; auto stringId = STR_BLACK_STRING; @@ -258,7 +258,7 @@ namespace OpenRCT2::Ui::Windows PaintCheckbox(rt, { { 2, y + 1 }, { 2 + checkboxSize + 1, y + 1 + checkboxSize } }, isChecked); } - void PaintCheckbox(RenderTarget& rt, const ScreenRect& rect, bool checked) + void PaintCheckbox(Drawing::RenderTarget& rt, const ScreenRect& rect, bool checked) { Rectangle::fillInset( rt, rect, colours[1], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::dark, diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index 0d826b6cb4..127c39d33a 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows createViewport(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index cc61d724df..59d335f5f6 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { const int32_t lineHeight = FontGetLineHeight(FontStyle::medium); diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 80ac97b985..941eacb6b4 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -593,7 +593,7 @@ static StringId window_cheats_page_titles[] = { } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -775,7 +775,7 @@ static StringId window_cheats_page_titles[] = { } } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { // Money tab if (!isWidgetDisabled(WIDX_TAB_1)) diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index a7814d0b0b..71f1dda8d8 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 8c7feb0e27..4d8d6e83eb 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -187,7 +187,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto ft = Formatter::Common(); ft.Add(10.00_GBP); diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index c15f9caae3..d556c8668d 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -154,7 +154,7 @@ namespace OpenRCT2::Ui::Windows setCheckboxValue(WIDX_TOGGLE_FORCE_REDRAW, gPaintForceRedraw); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); } diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 8d8bfafcef..2cfb809dc4 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 77eeaa9d4b..c6b9cd1328 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -104,7 +104,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, { screenCoords.x + 2, screenCoords.y + yOffset }, width - 7, format, ft, { colour }); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 5f281d28e2..d528c24fa7 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -125,7 +125,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto drawPreviousButton = widgets[WIDX_PREVIOUS_STEP_BUTTON].type != WidgetType::empty; auto drawNextButton = widgets[WIDX_NEXT_STEP_BUTTON].type != WidgetType::empty; @@ -334,7 +334,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_NEXT_IMAGE].type = WidgetType::empty; } - void DrawLeftButtonBack(RenderTarget& rt) + void DrawLeftButtonBack(Drawing::RenderTarget& rt) { const auto& previousWidget = widgets[WIDX_PREVIOUS_IMAGE]; auto leftTop = windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top }; @@ -342,7 +342,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); } - void DrawLeftButton(RenderTarget& rt) + void DrawLeftButton(Drawing::RenderTarget& rt) { const auto topLeft = windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 1, widgets[WIDX_PREVIOUS_IMAGE].top + 1 }; @@ -374,7 +374,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre }); } - void DrawRightButtonBack(RenderTarget& rt) + void DrawRightButtonBack(Drawing::RenderTarget& rt) { auto nextWidget = widgets[WIDX_NEXT_IMAGE]; auto leftTop = windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top }; @@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); } - void DrawRightButton(RenderTarget& rt) + void DrawRightButton(Drawing::RenderTarget& rt) { const auto topLeft = windowPos + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].left + 1, widgets[WIDX_NEXT_IMAGE].top + 1 }; @@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre }); } - void DrawStepText(RenderTarget& rt) + void DrawStepText(Drawing::RenderTarget& rt) { int16_t stateX = (widgets[WIDX_PREVIOUS_IMAGE].right + widgets[WIDX_NEXT_IMAGE].left) / 2 + windowPos.x; int16_t stateY = height - 0x0C + windowPos.y; diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index cf53d75afd..dc46740127 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows WindowEditorInventionsListDragOpen(researchItem, windowPos, widgets[WIDX_PRE_RESEARCHED_SCROLL].right); } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { const auto& gameState = getGameState(); @@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows return fallback; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -655,7 +655,7 @@ namespace OpenRCT2::Ui::Windows close(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto screenCoords = windowPos + ScreenCoordsXY{ 0, 2 }; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 22d16ee9f4..8c7d89e42b 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -725,7 +725,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { // ScrollPaint ScreenCoordsXY screenCoords; @@ -1008,7 +1008,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].right = widgets[WIDX_PREVIEW].left + kPreviewSize; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -1248,7 +1248,7 @@ namespace OpenRCT2::Ui::Windows _listItems.shrink_to_fit(); } - void DrawDescriptions(RenderTarget& rt) + void DrawDescriptions(Drawing::RenderTarget& rt) { auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIEW].midX(), widgets[WIDX_PREVIEW].bottom + 3 }; auto descriptionWidth = width - widgets[WIDX_LIST].right - 12; @@ -1356,7 +1356,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawDebugData(RenderTarget& rt) + void DrawDebugData(Drawing::RenderTarget& rt) { ObjectListItem* listItem = &_listItems[selectedListItem]; auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (kListRowHeight * 6) }; diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index e08bf361a3..cb14f3fa56 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -105,7 +105,7 @@ namespace OpenRCT2::Ui::Windows return numRows; } - void PaintPreview(RenderTarget& rt, ImageIndex imageStart, ScreenCoordsXY screenCoords, Direction direction) + void PaintPreview(Drawing::RenderTarget& rt, ImageIndex imageStart, ScreenCoordsXY screenCoords, Direction direction) { imageStart += (direction * 3); @@ -307,7 +307,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_LIST].bottom = height - 5; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); GfxDrawSprite( @@ -315,7 +315,7 @@ namespace OpenRCT2::Ui::Windows windowPos + ScreenCoordsXY{ widgets[WIDX_TAB].left, widgets[WIDX_TAB].top }); } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { GfxClear(rt, ColourMapA[colours[1].colour].mid_light); diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 3605a31d2f..68fa1e61b3 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -457,7 +457,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { switch (page) { @@ -515,7 +515,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES) { @@ -590,7 +590,7 @@ namespace OpenRCT2::Ui::Windows setWidgetPressed(WIDX_TAB_1 + page, true); } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { Widget* widget; int32_t spriteIndex; @@ -1141,7 +1141,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x0067161C */ - void ObjectiveOnDraw(RenderTarget& rt) + void ObjectiveOnDraw(Drawing::RenderTarget& rt) { const auto& gameState = getGameState(); const auto& scenarioOptions = gameState.scenarioOptions; @@ -1272,7 +1272,7 @@ namespace OpenRCT2::Ui::Windows SetPressedTab(); } - void ScenarioDetailsOnDraw(RenderTarget& rt) + void ScenarioDetailsOnDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -1684,7 +1684,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox; } - void FinancialDraw(RenderTarget& rt) + void FinancialDraw(Drawing::RenderTarget& rt) { ScreenCoordsXY screenCoords{}; @@ -1970,7 +1970,7 @@ namespace OpenRCT2::Ui::Windows setWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); } - void GuestsDraw(RenderTarget& rt) + void GuestsDraw(Drawing::RenderTarget& rt) { ScreenCoordsXY screenCoords{}; @@ -2173,7 +2173,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox; } - void LandDraw(RenderTarget& rt) + void LandDraw(Drawing::RenderTarget& rt) { ScreenCoordsXY screenCoords{}; @@ -2327,7 +2327,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x00672340 */ - void RidesOnDraw(RenderTarget& rt) + void RidesOnDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -2337,7 +2337,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x0067236F */ - void RidesOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) + void RidesOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) { int32_t colour = ColourMapA[colours[1].colour].mid_light; Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index dc9762175f..f7c932a9c9 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -67,7 +67,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 7d0bd1dd35..0789f03470 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows onPrepareDrawGraph(graphPageWidget, centredGraph); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -395,7 +395,7 @@ namespace OpenRCT2::Ui::Windows return {}; } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { if (page != WINDOW_FINANCES_PAGE_SUMMARY) return; @@ -588,7 +588,7 @@ namespace OpenRCT2::Ui::Windows initialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); } - void onDrawSummary(RenderTarget& rt) + void onDrawSummary(Drawing::RenderTarget& rt) { auto titleBarBottom = widgets[WIDX_TITLE].bottom; auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 }; @@ -706,7 +706,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDrawMarketing(RenderTarget& rt) + void onDrawMarketing(Drawing::RenderTarget& rt) { auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_TAB_1].top + 45 }; int32_t noCampaignsActive = 1; @@ -785,7 +785,7 @@ namespace OpenRCT2::Ui::Windows #pragma region Graph Events - void onDrawGraph(RenderTarget& rt, const money64 currentValue, const StringId fmt) const + void onDrawGraph(Drawing::RenderTarget& rt, const money64 currentValue, const StringId fmt) const { Formatter ft; ft.Add(currentValue); @@ -852,7 +852,7 @@ namespace OpenRCT2::Ui::Windows widgetScrollUpdateThumbs(*this, widgetIndex); } - void DrawTabImage(RenderTarget& rt, int32_t tabPage, int32_t spriteIndex) + void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabPage, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; @@ -870,7 +870,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { DrawTabImage(rt, WINDOW_FINANCES_PAGE_SUMMARY, SPR_TAB_FINANCES_SUMMARY_0); DrawTabImage(rt, WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, SPR_TAB_FINANCES_FINANCIAL_GRAPH_0); diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 0828e7aceb..4da27dc435 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -555,7 +555,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { ScreenCoordsXY screenCoords; WindowDrawWidgets(*this, rt); @@ -683,7 +683,7 @@ namespace OpenRCT2::Ui::Windows } } - void WindowFootpathDrawDropdownButtons(RenderTarget& rt) + void WindowFootpathDrawDropdownButtons(Drawing::RenderTarget& rt) { if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull) { @@ -734,7 +734,7 @@ namespace OpenRCT2::Ui::Windows } } - void WindowFootpathDrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageIndex image) + void WindowFootpathDrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageIndex image) { const auto& widget = widgets[widgetIndex]; GfxDrawSprite(rt, ImageId(image), { windowPos.x + widget.left, windowPos.y + widget.top }); diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index f4cb9623c3..09373cda63 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -89,7 +89,7 @@ namespace OpenRCT2::Ui::Windows : colours[0].colour); } - void DrawLeftPanel(RenderTarget& rt) + void DrawLeftPanel(Drawing::RenderTarget& rt) { const auto& leftPanelWidget = widgets[WIDX_LEFT_OUTSET]; @@ -154,7 +154,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawParkRating(RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor) + void DrawParkRating(Drawing::RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor) { int16_t bar_width = (factor * 114) / 255; Rectangle::fillInset( @@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(SPR_RATING_HIGH), coords + ScreenCoordsXY{ 114, 0 }); } - void DrawRightPanel(RenderTarget& rt) + void DrawRightPanel(Drawing::RenderTarget& rt) { const auto& rightPanelWidget = widgets[WIDX_RIGHT_OUTSET]; @@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawNewsItem(RenderTarget& rt) + void DrawNewsItem(Drawing::RenderTarget& rt) { const auto& middleOutsetWidget = widgets[WIDX_MIDDLE_OUTSET]; auto* newsItem = News::GetItem(0); @@ -353,7 +353,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawMiddlePanel(RenderTarget& rt) + void DrawMiddlePanel(Drawing::RenderTarget& rt) { Widget* middleOutsetWidget = &widgets[WIDX_MIDDLE_OUTSET]; @@ -620,7 +620,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { const auto& leftWidget = widgets[WIDX_LEFT_OUTSET]; const auto& rightWidget = widgets[WIDX_RIGHT_OUTSET]; diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 759ad93113..9bf88fa08e 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -356,7 +356,7 @@ namespace OpenRCT2::Ui::Windows onViewportRotateOverview(); } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { switch (page) { @@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows onScrollMouseDownRides(scrollIndex, screenCoords); } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { if (page == WINDOW_GUEST_RIDES) { @@ -543,7 +543,7 @@ namespace OpenRCT2::Ui::Windows #pragma region Overview - void OverviewTabDraw(RenderTarget& rt) + void OverviewTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_1)) return; @@ -780,7 +780,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - void onDrawOverview(RenderTarget& rt) + void onDrawOverview(Drawing::RenderTarget& rt) { drawWidgets(rt); OverviewTabDraw(rt); @@ -1050,7 +1050,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Stats - void StatsTabDraw(RenderTarget& rt) + void StatsTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_2)) return; @@ -1107,7 +1107,7 @@ namespace OpenRCT2::Ui::Windows return std::clamp(newValue, newMin, 100); } - void onDrawStats(RenderTarget& rt) + void onDrawStats(Drawing::RenderTarget& rt) { // ebx const auto peep = GetGuest(); @@ -1206,7 +1206,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Rides - void RidesTabDraw(RenderTarget& rt) + void RidesTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_3)) return; @@ -1315,7 +1315,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_RIDE_SCROLL].bottom = height - 15; } - void onDrawRides(RenderTarget& rt) + void onDrawRides(Drawing::RenderTarget& rt) { drawWidgets(rt); OverviewTabDraw(rt); @@ -1352,7 +1352,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, screenCoords, width - 14, STR_FAVOURITE_RIDE, ft); } - void onScrollDrawRides(int32_t scrollIndex, RenderTarget& rt) + void onScrollDrawRides(int32_t scrollIndex, Drawing::RenderTarget& rt) { auto colour = ColourMapA[colours[1].colour].mid_light; Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); @@ -1379,7 +1379,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Finance - void FinanceTabDraw(RenderTarget& rt) + void FinanceTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_4)) return; @@ -1405,7 +1405,7 @@ namespace OpenRCT2::Ui::Windows invalidateWidget(WIDX_TAB_4); } - void onDrawFinance(RenderTarget& rt) + void onDrawFinance(Drawing::RenderTarget& rt) { drawWidgets(rt); OverviewTabDraw(rt); @@ -1517,7 +1517,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Thoughts - void ThoughtsTabDraw(RenderTarget& rt) + void ThoughtsTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_5)) return; @@ -1554,7 +1554,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDrawThoughts(RenderTarget& rt) + void onDrawThoughts(Drawing::RenderTarget& rt) { drawWidgets(rt); OverviewTabDraw(rt); @@ -1595,7 +1595,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Inventory - void InventoryTabDraw(RenderTarget& rt) + void InventoryTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_6)) return; @@ -1735,7 +1735,7 @@ namespace OpenRCT2::Ui::Windows return std::make_pair(itemImage, ft); } - void onDrawInventory(RenderTarget& rt) + void onDrawInventory(Drawing::RenderTarget& rt) { drawWidgets(rt); OverviewTabDraw(rt); @@ -1785,7 +1785,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Debug - void DebugTabDraw(RenderTarget& rt) + void DebugTabDraw(Drawing::RenderTarget& rt) { if (widgetIsDisabled(*this, WIDX_TAB_7)) return; @@ -1808,7 +1808,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - void onDrawDebug(RenderTarget& rt) + void onDrawDebug(Drawing::RenderTarget& rt) { char buffer[512]{}; char buffer2[512]{}; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 869db8829a..0c5a4222b5 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -427,7 +427,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { Rectangle::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -626,7 +626,7 @@ namespace OpenRCT2::Ui::Windows } private: - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { // Tab 1 image auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0); @@ -643,7 +643,7 @@ namespace OpenRCT2::Ui::Windows windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); } - void DrawScrollIndividual(RenderTarget& rt) + void DrawScrollIndividual(Drawing::RenderTarget& rt) { size_t index = 0; auto y = static_cast(_selectedPage) * -kGuestPageHeight; @@ -710,7 +710,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawScrollSummarised(RenderTarget& rt) + void DrawScrollSummarised(Drawing::RenderTarget& rt) { size_t index = 0; auto y = 0; diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 8ee75bf41a..c968f3deb9 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index b18d77732b..27208711dc 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -259,7 +259,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { ScreenCoordsXY screenCoords; int32_t numTiles; @@ -843,7 +843,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawDropdownButtons(RenderTarget& rt) + void DrawDropdownButtons(Drawing::RenderTarget& rt) { auto& objManager = GetContext()->GetObjectManager(); const auto* surfaceObj = objManager.GetLoadedObject(_selectedFloorTexture); @@ -866,7 +866,7 @@ namespace OpenRCT2::Ui::Windows DrawDropdownButton(rt, WIDX_WALL, edgeImage); } - void DrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageId image) + void DrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageId image) { const auto& widget = widgets[widgetIndex]; GfxDrawSprite(rt, image, { windowPos.x + widget.left, windowPos.y + widget.top }); diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index e47ca7abc0..871289e04b 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -392,7 +392,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(), windowPos.y + widgets[WIDX_PREVIEW].midY() }; diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index ecee501af4..602fb40792 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawPreview(RenderTarget& rt) + void DrawPreview(Drawing::RenderTarget& rt) { // Find preview image to draw PreviewImage* image = nullptr; @@ -731,7 +731,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -1077,7 +1077,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { Rectangle::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index a336ac81c0..420b7f4cd6 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows WindowFootpathResetSelectedPath(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { ViewportRender(rt, viewport); } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index d298d7745e..18e1fa87ae 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -566,7 +566,7 @@ namespace OpenRCT2::Ui::Windows onScrollMouseDown(scrollIndex, screenCoords); } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { GfxClear(rt, PaletteIndex::pi10); @@ -661,7 +661,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -947,7 +947,7 @@ namespace OpenRCT2::Ui::Windows return colourB; } - void PaintPeepOverlay(RenderTarget& rt, const ScreenCoordsXY& offset) + void PaintPeepOverlay(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset) { auto flashColour = GetGuestFlashColour(); for (auto guest : EntityList()) @@ -961,7 +961,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, RenderTarget& rt, const ScreenCoordsXY& offset) + void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, Drawing::RenderTarget& rt, const ScreenCoordsXY& offset) { if (peep->x == kLocationNull) return; @@ -1007,7 +1007,7 @@ namespace OpenRCT2::Ui::Windows return colour; } - void PaintTrainOverlay(RenderTarget& rt, const ScreenCoordsXY& offset) + void PaintTrainOverlay(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset) { for (auto train : TrainManager::View()) { @@ -1029,7 +1029,7 @@ namespace OpenRCT2::Ui::Windows * The call to Rectangle::fill was originally wrapped in Sub68DABD which made sure that arguments were ordered * correctly, but it doesn't look like it's ever necessary here so the call was removed. */ - void PaintHudRectangle(RenderTarget& rt, const ScreenCoordsXY& widgetOffset) + void PaintHudRectangle(Drawing::RenderTarget& rt, const ScreenCoordsXY& widgetOffset) { WindowBase* mainWindow = WindowGetMain(); if (mainWindow == nullptr) @@ -1067,7 +1067,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::fill(rt, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PaletteIndex::pi56); } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { // Guest tab image (animated) uint32_t guestTabImage = SPR_TAB_GUESTS_0; diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 285bfcd402..38c448c01e 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -299,7 +299,7 @@ namespace OpenRCT2::Ui::Windows pressedWidgets |= 1LL << (WIDX_TAB_1 + page); } - void DrawTabImage(RenderTarget& rt, int32_t newPage, int32_t spriteIndex) + void DrawTabImage(Drawing::RenderTarget& rt, int32_t newPage, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB_1 + newPage; @@ -317,7 +317,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { DrawTabImage(rt, WINDOW_MAPGEN_PAGE_BASE, SPR_TAB_GEARS_0); DrawTabImage(rt, WINDOW_MAPGEN_PAGE_TERRAIN, SPR_G2_MAP_GEN_TERRAIN_TAB); @@ -597,7 +597,7 @@ namespace OpenRCT2::Ui::Windows // clang-format on } - void BaseDraw(RenderTarget& rt) + void BaseDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -759,7 +759,7 @@ namespace OpenRCT2::Ui::Windows setWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_DOWN, !_settings.trees || isFlatland); } - void ForestsDraw(RenderTarget& rt) + void ForestsDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -863,7 +863,7 @@ namespace OpenRCT2::Ui::Windows } } - void SimplexDraw(RenderTarget& rt) + void SimplexDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -973,7 +973,7 @@ namespace OpenRCT2::Ui::Windows setCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height); } - void HeightmapDraw(RenderTarget& rt) + void HeightmapDraw(Drawing::RenderTarget& rt) { const auto enabledColour = colours[1]; const auto disabledColour = enabledColour.withFlag(ColourFlag::inset, true); @@ -1159,7 +1159,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageId image) + void DrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageId image) { const auto& widget = widgets[widgetIndex]; ScreenCoordsXY pos = { windowPos.x + widget.left, windowPos.y + widget.top }; @@ -1181,7 +1181,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawDropdownButtons(RenderTarget& rt, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex) + void DrawDropdownButtons(Drawing::RenderTarget& rt, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex) { auto& objManager = GetContext()->GetObjectManager(); const auto* surfaceObj = objManager.GetLoadedObject(_settings.landTexture); @@ -1223,7 +1223,7 @@ namespace OpenRCT2::Ui::Windows SetPressedTab(); } - void TerrainDraw(RenderTarget& rt) + void TerrainDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -1334,7 +1334,7 @@ namespace OpenRCT2::Ui::Windows SetPressedTab(); } - void WaterDraw(RenderTarget& rt) + void WaterDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -1446,7 +1446,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { switch (page) { diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index f5492a6c9a..e09dd26163 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { StringId stringId; std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId)); diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 0612c82890..7ed86827a5 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -305,7 +305,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); } diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 8c8f2aad9e..e295792c09 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows } } - void informationPaint(RenderTarget& rt) + void informationPaint(Drawing::RenderTarget& rt) { RenderTarget clippedDPI; if (ClipDrawPixelInfo(clippedDPI, rt, windowPos, width, height)) @@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows } } - void playersPaint(RenderTarget& rt) + void playersPaint(Drawing::RenderTarget& rt) { // Number of players StringId stringId = numListItems == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; @@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, screenCoords, stringId, ft, { colours[2] }); } - void playersScrollPaint(int32_t scrollIndex, RenderTarget& rt) const + void playersScrollPaint(int32_t scrollIndex, Drawing::RenderTarget& rt) const { ScreenCoordsXY screenCoords; screenCoords.y = 0; @@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows } } - void groupsPaint(RenderTarget& rt) + void groupsPaint(Drawing::RenderTarget& rt) { thread_local std::string _buffer; @@ -389,7 +389,7 @@ namespace OpenRCT2::Ui::Windows } } - void groupsScrollPaint(int32_t scrollIndex, RenderTarget& rt) const + void groupsScrollPaint(int32_t scrollIndex, Drawing::RenderTarget& rt) const { auto screenCoords = ScreenCoordsXY{ 0, 0 }; @@ -432,7 +432,7 @@ namespace OpenRCT2::Ui::Windows } } - void drawTabImage(RenderTarget& rt, int32_t page_number, int32_t spriteIndex) + void drawTabImage(Drawing::RenderTarget& rt, int32_t page_number, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB1 + page_number; @@ -454,7 +454,7 @@ namespace OpenRCT2::Ui::Windows } } - void drawTabImages(RenderTarget& rt) + void drawTabImages(Drawing::RenderTarget& rt) { drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0); drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0); @@ -704,7 +704,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); drawTabImages(rt); @@ -900,7 +900,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { switch (page) { diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 8201902086..f506bf78b1 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); thread_local std::string _buffer; diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 70b6bfc7d0..418a966351 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -353,7 +353,7 @@ namespace OpenRCT2::Ui::Windows widgetSetDisabled(*this, WIDX_START_BUTTON, true); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { ScreenCoordsXY screenCoords{}; diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 60497bb4fa..0eb1ec678b 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -430,7 +430,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -488,7 +488,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { if (_currentTab == RESEARCH_TAB) { @@ -941,7 +941,8 @@ namespace OpenRCT2::Ui::Windows widgetScrollUpdateThumbs(*this, WIDX_RIDE_LIST); } - void DrawRideInformation(RenderTarget& rt, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth) + void DrawRideInformation( + Drawing::RenderTarget& rt, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth) { auto& objMgr = OpenRCT2::GetContext()->GetObjectManager(); const auto* rideObj = objMgr.GetLoadedObject(item.EntryIndex); @@ -1027,7 +1028,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImage(RenderTarget& rt, NewRideTabId tab, int32_t spriteIndex) + void DrawTabImage(Drawing::RenderTarget& rt, NewRideTabId tab, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(tab); @@ -1045,7 +1046,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { DrawTabImage(rt, TRANSPORT_TAB, SPR_TAB_RIDES_TRANSPORT_0); DrawTabImage(rt, GENTLE_TAB, SPR_TAB_RIDES_GENTLE_0); diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 638ea6336b..30583cc988 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -260,7 +260,7 @@ namespace OpenRCT2::Ui::Windows setWidgetPressed(WIDX_TAB_OPTIONS, page == optionsTab); } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { if (!isWidgetDisabled(WIDX_TAB_NEWS)) { @@ -308,7 +308,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -441,7 +441,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { int32_t lineHeight = FontGetLineHeight(FontStyle::small); int32_t itemHeight = CalculateNewsItemHeight(); diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index dd6372b294..f533d8058c 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -492,7 +492,7 @@ namespace OpenRCT2::Ui::Windows invalidateWidget(WIDX_SCROLL); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); @@ -510,7 +510,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, screenPos + ScreenCoordsXY{ 0, 29 }, kWindowSize.width - 5, STR_BLACK_STRING, ft); } - void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(const int32_t scrollIndex, Drawing::RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; Rectangle::fill( diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 95a0413f7d..f2faddf385 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -628,7 +628,7 @@ namespace OpenRCT2::Ui::Windows CommonPrepareDrawAfter(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -1019,7 +1019,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_FRAME_RATE_LIMIT].text = kFrameRateLimitStringIds[activeItem]; } - void DisplayDraw(RenderTarget& rt) + void DisplayDraw(Drawing::RenderTarget& rt) { auto ft = Formatter(); ft.Add(static_cast(Config::Get().general.windowScale * 100)); @@ -2224,7 +2224,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_ASSET_PACKS].bottom = widgets[WIDX_GROUP_ADVANCED].bottom - 6; } - void AdvancedDraw(RenderTarget& rt) + void AdvancedDraw(Drawing::RenderTarget& rt) { auto ft = Formatter(); ft.Add(static_cast(Config::Get().general.autosaveAmount)); @@ -2301,7 +2301,7 @@ namespace OpenRCT2::Ui::Windows Dropdown::Flag::StayOpen, num_items, widget->width() - 4); } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { DrawTabImage(rt, WINDOW_OPTIONS_PAGE_DISPLAY, SPR_G2_MONITOR_TAB_START); DrawTabImage(rt, WINDOW_OPTIONS_PAGE_RENDERING, SPR_G2_TAB_TREE); @@ -2313,7 +2313,7 @@ namespace OpenRCT2::Ui::Windows DrawTabImage(rt, WINDOW_OPTIONS_PAGE_ADVANCED, SPR_TAB_WRENCH_0); } - void DrawTabImage(RenderTarget& rt, int32_t p, int32_t spriteIndex) + void DrawTabImage(Drawing::RenderTarget& rt, int32_t p, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_FIRST_TAB + p; Widget* widget = &widgets[widgetIndex]; diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp index 30f41c9cec..28e1cde802 100644 --- a/src/openrct2-ui/windows/OverwritePrompt.cpp +++ b/src/openrct2-ui/windows/OverwritePrompt.cpp @@ -85,7 +85,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index d205915c4d..8de02560e0 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -357,7 +357,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { switch (page) { @@ -585,7 +585,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDrawEntrance(RenderTarget& rt) + void onDrawEntrance(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -700,7 +700,7 @@ namespace OpenRCT2::Ui::Windows kGraphNumYLabels, kParkRatingHistorySize); } - void onDrawRating(RenderTarget& rt) + void onDrawRating(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -781,7 +781,7 @@ namespace OpenRCT2::Ui::Windows kGraphNumYLabels, kGuestsInParkHistorySize); } - void onDrawGuests(RenderTarget& rt) + void onDrawGuests(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -882,7 +882,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void onDrawPrice(RenderTarget& rt) + void onDrawPrice(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -942,7 +942,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void onDrawStats(RenderTarget& rt) + void onDrawStats(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -1068,7 +1068,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void onDrawObjective(RenderTarget& rt) + void onDrawObjective(Drawing::RenderTarget& rt) { auto& gameState = getGameState(); drawWidgets(rt); @@ -1134,7 +1134,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void onDrawAwards(RenderTarget& rt) + void onDrawAwards(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -1208,7 +1208,7 @@ namespace OpenRCT2::Ui::Windows pressedWidgets |= 1LL << (WIDX_TAB_1 + page); } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { // Entrance tab if (!widgetIsDisabled(*this, WIDX_TAB_1)) diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index b5d26a2a6f..231a032a0f 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -136,7 +136,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index 4ab7638c58..7bad97d828 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -151,7 +151,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { switch (page) { @@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { Widget* widget; @@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows widgetSetEnabled(*this, WIDX_KICK, canKick && !isOwnWindow && !isServer); } - void onDrawOverview(RenderTarget& rt) + void onDrawOverview(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); @@ -599,7 +599,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2); } - void onDrawStatistics(RenderTarget& rt) + void onDrawStatistics(Drawing::RenderTarget& rt) { drawWidgets(rt); DrawTabImages(rt); diff --git a/src/openrct2-ui/windows/ProgressWindow.cpp b/src/openrct2-ui/windows/ProgressWindow.cpp index 6ba4212274..89a900ea0f 100644 --- a/src/openrct2-ui/windows/ProgressWindow.cpp +++ b/src/openrct2-ui/windows/ProgressWindow.cpp @@ -171,14 +171,14 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); auto& widget = widgets[WIDX_TITLE]; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.bottom + 1 }; - RenderTarget clipDPI; + Drawing::RenderTarget clipDPI; if (!ClipDrawPixelInfo(clipDPI, rt, screenCoords, width - 3, height - widget.bottom - 3)) return; diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 56f9eb7540..bbc269530e 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index f579911d1c..a9c1310e7d 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -266,7 +266,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImage(RenderTarget& rt, int32_t tabPage, int32_t spriteIndex) + void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabPage, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; @@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { DrawTabImage(rt, WINDOW_RESEARCH_PAGE_DEVELOPMENT, SPR_TAB_FINANCES_RESEARCH_0); DrawTabImage(rt, WINDOW_RESEARCH_PAGE_FUNDING, SPR_TAB_FINANCES_SUMMARY_0); @@ -340,7 +340,7 @@ namespace OpenRCT2::Ui::Windows } } - void WindowResearchDevelopmentDraw(WindowBase* w, RenderTarget& rt, WidgetIndex baseWidgetIndex) + void WindowResearchDevelopmentDraw(WindowBase* w, Drawing::RenderTarget& rt, WidgetIndex baseWidgetIndex) { const auto& gameState = getGameState(); @@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows } } - void WindowResearchFundingDraw(WindowBase* w, RenderTarget& rt) + void WindowResearchFundingDraw(WindowBase* w, Drawing::RenderTarget& rt) { const auto& gameState = getGameState(); if (gameState.park.flags & PARK_FLAGS_NO_MONEY) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index bb2ef774d7..2dc6f8762d 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -893,7 +893,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { switch (page) { @@ -1072,7 +1072,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { switch (page) { @@ -1204,7 +1204,7 @@ namespace OpenRCT2::Ui::Windows } private: - void drawTabImage(RenderTarget& rt, int32_t tab, int32_t spriteIndex) + void drawTabImage(Drawing::RenderTarget& rt, int32_t tab, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB_1 + tab; @@ -1221,7 +1221,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabMain(RenderTarget& rt) + void DrawTabMain(Drawing::RenderTarget& rt) { WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_MAIN); if (!widgetIsDisabled(*this, widgetIndex)) @@ -1255,7 +1255,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabVehicle(RenderTarget& rt) + void DrawTabVehicle(Drawing::RenderTarget& rt) { WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_VEHICLE); const auto& widget = widgets[widgetIndex]; @@ -1318,7 +1318,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabCustomer(RenderTarget& rt) + void DrawTabCustomer(Drawing::RenderTarget& rt) { WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_CUSTOMER); @@ -1338,7 +1338,7 @@ namespace OpenRCT2::Ui::Windows } } - void drawTabImages(RenderTarget& rt) + void drawTabImages(Drawing::RenderTarget& rt) { DrawTabVehicle(rt); drawTabImage(rt, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0); @@ -2558,7 +2558,7 @@ namespace OpenRCT2::Ui::Windows return GetStatusStation(ft); } - void MainOnDraw(RenderTarget& rt) + void MainOnDraw(Drawing::RenderTarget& rt) { WindowDrawWidgets(*this, rt); drawTabImages(rt); @@ -2847,7 +2847,7 @@ namespace OpenRCT2::Ui::Windows } } - void VehicleOnDraw(RenderTarget& rt) + void VehicleOnDraw(Drawing::RenderTarget& rt) { WindowDrawWidgets(*this, rt); drawTabImages(rt); @@ -2934,7 +2934,7 @@ namespace OpenRCT2::Ui::Windows ImageId imageId; }; - void VehicleOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) + void VehicleOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) { auto ride = GetRide(rideId); if (ride == nullptr) @@ -3670,7 +3670,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - void OperatingOnDraw(RenderTarget& rt) + void OperatingOnDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); drawTabImages(rt); @@ -4010,7 +4010,7 @@ namespace OpenRCT2::Ui::Windows } } - void MaintenanceOnDraw(RenderTarget& rt) + void MaintenanceOnDraw(Drawing::RenderTarget& rt) { auto ride = GetRide(rideId); if (ride == nullptr) @@ -4799,7 +4799,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - void ColourOnDraw(RenderTarget& rt) + void ColourOnDraw(Drawing::RenderTarget& rt) { // TODO: This should use lists and identified sprites RenderTarget clippedDpi; @@ -4908,7 +4908,7 @@ namespace OpenRCT2::Ui::Windows } } - void ColourOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) const + void ColourOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) const { auto ride = GetRide(rideId); if (ride == nullptr) @@ -5215,7 +5215,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - void MusicOnDraw(RenderTarget& rt) + void MusicOnDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); drawTabImages(rt); @@ -5252,7 +5252,7 @@ namespace OpenRCT2::Ui::Windows } } - void MusicOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) + void MusicOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) { auto ride = GetRide(rideId); if (ride == nullptr) @@ -5594,7 +5594,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - void MeasurementsOnDraw(RenderTarget& rt) + void MeasurementsOnDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); drawTabImages(rt); @@ -6038,13 +6038,13 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - void GraphsOnDraw(RenderTarget& rt) + void GraphsOnDraw(Drawing::RenderTarget& rt) { drawWidgets(rt); drawTabImages(rt); } - void GraphsOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) + void GraphsOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) { GfxClear(rt, ColourMapA[COLOUR_SATURATED_GREEN].darker); @@ -6599,7 +6599,7 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - void IncomeOnDraw(RenderTarget& rt) + void IncomeOnDraw(Drawing::RenderTarget& rt) { StringId stringId; money64 profit; @@ -6798,7 +6798,7 @@ namespace OpenRCT2::Ui::Windows } } - void CustomerOnDraw(RenderTarget& rt) + void CustomerOnDraw(Drawing::RenderTarget& rt) { ShopItem shopItem; int16_t popularity, satisfaction, queueTime; diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 4755aea8c3..7af1388880 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -1685,9 +1685,9 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_O_TRACK].tooltip = trackDrawerDescriptor.Covered.tooltip; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { - RenderTarget clippedRT; + Drawing::RenderTarget clippedRT; Widget* widget; int32_t widgetWidth, widgetHeight; @@ -2699,7 +2699,7 @@ namespace OpenRCT2::Ui::Windows } void DrawTrackPiece( - RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection, + Drawing::RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection, SelectedLiftAndInverted liftHillAndInvertedState, int32_t widgetWidth, int32_t widgetHeight) { auto currentRide = GetRide(rideIndex); @@ -2740,7 +2740,7 @@ namespace OpenRCT2::Ui::Windows } void DrawTrackPieceHelper( - RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection, + Drawing::RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection, SelectedLiftAndInverted liftHillAndInvertedState, const CoordsXY& originCoords, int32_t originZ) { TileElement tempSideTrackTileElement{ 0x80, 0x8F, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index af451ce930..410e481395 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -587,7 +587,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3235 */ - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); DrawTabImages(rt); @@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3240 */ - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; Rectangle::fill( @@ -881,7 +881,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B38EA */ - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { int32_t sprite_idx; diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index b92126bc5a..23f8fa2807 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -190,7 +190,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); } diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 750463c69f..4a35dc1e11 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -267,7 +267,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - ScreenCoordsXY DrawPreview(RenderTarget& rt, ScreenCoordsXY screenPos) + ScreenCoordsXY DrawPreview(Drawing::RenderTarget& rt, ScreenCoordsXY screenPos) { auto targetImageType = PreviewImageType::miniMap; if (Config::Get().interface.scenarioPreviewScreenshots) @@ -302,7 +302,7 @@ namespace OpenRCT2::Ui::Windows return frameEndPos; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -540,7 +540,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light; GfxClear(rt, paletteIndex); @@ -636,7 +636,7 @@ namespace OpenRCT2::Ui::Windows } private: - void DrawCategoryHeading(RenderTarget& rt, int32_t left, int32_t right, int32_t y, StringId stringId) const + void DrawCategoryHeading(Drawing::RenderTarget& rt, int32_t left, int32_t right, int32_t y, StringId stringId) const { auto baseColour = colours[1]; colour_t lightColour = ColourMapA[baseColour.colour].lighter; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 93cc170766..55984ac6ac 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -875,7 +875,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = canFit ? WidgetType::flatBtn : WidgetType::empty; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabs(rt, windowPos); @@ -1572,7 +1572,7 @@ namespace OpenRCT2::Ui::Windows return { name, price }; } - void DrawTabs(RenderTarget& rt, const ScreenCoordsXY& offset) + void DrawTabs(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset) { for (size_t tabIndex = 0; tabIndex < _tabEntries.size(); tabIndex++) { @@ -1587,7 +1587,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawSceneryItem(RenderTarget& rt, ScenerySelection scenerySelection) + void DrawSceneryItem(Drawing::RenderTarget& rt, ScenerySelection scenerySelection) { if (scenerySelection.SceneryType == SCENERY_TYPE_BANNER) { @@ -1705,7 +1705,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { GfxClear(rt, ColourMapA[colours[1].colour].mid_light); diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index 6c9c1e99dd..9fc6d14023 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize)); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index efcbc0cee1..dfa38b9001 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -305,7 +305,7 @@ namespace OpenRCT2::Ui::Windows return { fallback, ft }; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -326,7 +326,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE }); } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light; GfxClear(rt, paletteIndex); diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index e2e6806156..adea8f28c1 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -229,7 +229,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PORT_INPUT].top }, STR_PORT, {}, { colours[1] }); diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index a04b199b40..7cd951b77d 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -121,7 +121,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows setWidgetPressed(static_cast(WIDX_TAB_0 + _currentTabIndex), true); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; Rectangle::fill( @@ -472,7 +472,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) const + void DrawTabImages(Drawing::RenderTarget& rt) const { for (size_t i = 0; i < _tabs.size(); i++) { @@ -480,7 +480,7 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImage(RenderTarget& rt, size_t tabIndex) const + void DrawTabImage(Drawing::RenderTarget& rt, size_t tabIndex) const { const auto& tabDesc = _tabs[tabIndex]; auto widgetIndex = static_cast(WIDX_TAB_0 + tabIndex); @@ -501,14 +501,15 @@ namespace OpenRCT2::Ui::Windows } } - void DrawSeparator(RenderTarget& rt, int32_t y, int32_t scrollWidth) + void DrawSeparator(Drawing::RenderTarget& rt, int32_t y, int32_t scrollWidth) { const int32_t top = y + (kScrollableRowHeight / 2) - 1; Rectangle::fill(rt, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[1].colour].mid_dark); Rectangle::fill(rt, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[1].colour].lightest); } - void DrawItem(RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted) + void DrawItem( + Drawing::RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted) { auto format = STR_BLACK_STRING; if (isHighlighted) diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 72e1d5ef3f..e4b4cf9dc8 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -292,7 +292,7 @@ namespace OpenRCT2::Ui::Windows text_colour_btn->image = getColourButtonImage(_textColour); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 3fd6ae7f9b..f986fbf6b3 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -228,7 +228,7 @@ namespace OpenRCT2::Ui::Windows CommonPrepareDrawAfter(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -540,7 +540,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_FIRE].right = width - 2; } - void OverviewDraw(RenderTarget& rt) + void OverviewDraw(Drawing::RenderTarget& rt) { // Draw the viewport no sound sprite if (viewport != nullptr) @@ -567,7 +567,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::centre }); } - void DrawOverviewTabImage(RenderTarget& rt) + void DrawOverviewTabImage(Drawing::RenderTarget& rt) { if (isWidgetDisabled(WIDX_TAB_1)) return; @@ -579,7 +579,7 @@ namespace OpenRCT2::Ui::Windows if (page == WINDOW_STAFF_OVERVIEW) widgetHeight++; - RenderTarget clippedRT; + Drawing::RenderTarget clippedRT; if (!ClipDrawPixelInfo(clippedRT, rt, screenCoords, widgetWidth, widgetHeight)) { return; @@ -928,7 +928,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Statistics tab events - void StatsDraw(RenderTarget& rt) + void StatsDraw(Drawing::RenderTarget& rt) { auto staff = GetStaff(); if (staff == nullptr) @@ -1185,14 +1185,14 @@ namespace OpenRCT2::Ui::Windows WindowFollowSprite(*main, EntityId::FromUnderlying(number)); } - void DrawTabImages(RenderTarget& rt) + void DrawTabImages(Drawing::RenderTarget& rt) { DrawOverviewTabImage(rt); DrawTabImage(rt, WINDOW_STAFF_OPTIONS, SPR_TAB_STAFF_OPTIONS_0); DrawTabImage(rt, WINDOW_STAFF_STATISTICS, SPR_TAB_STATS_0); } - void DrawTabImage(RenderTarget& rt, int32_t p, int32_t baseImageId) + void DrawTabImage(Drawing::RenderTarget& rt, int32_t p, int32_t baseImageId) { WidgetIndex widgetIndex = WIDX_TAB_1 + p; Widget* widget = &widgets[widgetIndex]; diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index cf94694324..afc3473248 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index b3dca0cb5a..a7ec8e9a25 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -273,7 +273,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_STAFF_LIST_HIRE_BUTTON].right = width - 11; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); DrawTabImages(rt); @@ -367,7 +367,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; Rectangle::fill( @@ -595,7 +595,7 @@ namespace OpenRCT2::Ui::Windows return static_cast(_selectedTab); } - void DrawTabImages(RenderTarget& rt) const + void DrawTabImages(Drawing::RenderTarget& rt) const { const auto& gameState = getGameState(); DrawTabImage(rt, WINDOW_STAFF_LIST_TAB_HANDYMEN, AnimationPeepType::handyman, gameState.park.staffHandymanColour); @@ -604,7 +604,7 @@ namespace OpenRCT2::Ui::Windows DrawTabImage(rt, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, AnimationPeepType::entertainer); } - void DrawTabImage(RenderTarget& rt, int32_t tabIndex, AnimationPeepType type, colour_t colour) const + void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabIndex, AnimationPeepType type, colour_t colour) const { PeepAnimationsObject* animObj = findPeepAnimationsObjectForType(type); if (animObj == nullptr) @@ -622,7 +622,7 @@ namespace OpenRCT2::Ui::Windows windowPos + ScreenCoordsXY{ (widget.left + widget.right) / 2, widget.bottom - 6 }); } - void DrawTabImage(RenderTarget& rt, int32_t tabIndex, AnimationPeepType type) const + void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabIndex, AnimationPeepType type) const { PeepAnimationsObject* animObj = findPeepAnimationsObjectForType(type); if (animObj == nullptr) diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 7746bf6773..3eba555bfe 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -196,7 +196,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 6a30ee4852..b6ed3c6b70 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -388,7 +388,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { // Widgets WindowDrawWidgets(*this, rt); @@ -715,7 +715,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { ScreenCoordsXY screenCoords; @@ -906,7 +906,7 @@ namespace OpenRCT2::Ui::Windows return 0; } - void WindowThemesDrawTabImages(RenderTarget& rt) + void WindowThemesDrawTabImages(Drawing::RenderTarget& rt) { for (int32_t i = 0; i < WINDOW_THEMES_TAB_COUNT; i++) { diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 3ac4b129bd..30f1bbb927 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1044,7 +1044,7 @@ static uint64_t PageDisabledWidgets[] = { invalidateWidget(WIDX_LIST); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); ScreenCoordsXY screenCoords(windowPos.x, windowPos.y); @@ -1582,7 +1582,7 @@ static uint64_t PageDisabledWidgets[] = { } } - void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override { const int32_t listWidth = widgets[WIDX_LIST].width() - 1; Rectangle::fill( diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index 548e39a504..97cefee22e 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -44,7 +44,7 @@ namespace OpenRCT2::Ui::Windows }; } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); } diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index 55b4041693..41683e0dc6 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -57,7 +57,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x0066B872 */ - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto screenCoords = windowPos + ScreenCoordsXY{ 2, 2 }; GfxDrawSprite(rt, ImageId(SPR_G2_LOGO), screenCoords); diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 4902a32e6d..65df8a8e39 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -275,7 +275,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { Rectangle::filter(rt, _filterRect, FilterPaletteID::palette51); drawWidgets(rt); diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index 29f8b69703..87ea4896bc 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); } diff --git a/src/openrct2-ui/windows/TitleVersion.cpp b/src/openrct2-ui/windows/TitleVersion.cpp index fe9999d5f1..cadeb66624 100644 --- a/src/openrct2-ui/windows/TitleVersion.cpp +++ b/src/openrct2-ui/windows/TitleVersion.cpp @@ -24,7 +24,7 @@ namespace OpenRCT2::Ui::Windows class TitleVersionWindow final : public Window { - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { // Write name and version information const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true); diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index ceb503f1e3..bcf558fef4 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -103,7 +103,7 @@ namespace OpenRCT2::Ui::Windows UpdatePosition(gTooltipCursor); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { int32_t left = windowPos.x; int32_t top = windowPos.y; diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 23e62f27b1..940a1f5d81 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -1261,16 +1261,16 @@ namespace OpenRCT2::Ui::Windows }; uint32_t mapImageId = _imageIdByRotation[GetCurrentRotation()]; - widgets[WIDX_MAP].image = ImageId(mapImageId, FilterPaletteID::paletteNull); + widgets[WIDX_MAP].image = ImageId(mapImageId, Drawing::FilterPaletteID::paletteNull); } } void ApplyAudioState() { if (!OpenRCT2::Audio::gGameSoundsOff) - widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_MUTE, FilterPaletteID::paletteNull); + widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_MUTE, Drawing::FilterPaletteID::paletteNull); else - widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_UNMUTE, FilterPaletteID::paletteNull); + widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_UNMUTE, Drawing::FilterPaletteID::paletteNull); } void ApplyFootpathPressed() @@ -1371,7 +1371,7 @@ namespace OpenRCT2::Ui::Windows AlignButtonsCentre(); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { const auto& gameState = getGameState(); int32_t imgId; diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index d4f9ec98a3..f79bb05cd2 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -133,7 +133,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { Formatter::Common().Add(_trackDesignFileReference->name.c_str()); drawWidgets(rt); @@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 97d689e63d..2e4ff95da8 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -351,14 +351,14 @@ namespace OpenRCT2::Ui::Windows DrawMiniPreview(*_trackDesign); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto ft = Formatter::Common(); ft.Add(_trackDesign->gameStateData.name.c_str()); WindowDrawWidgets(*this, rt); // Draw mini tile preview - RenderTarget clippedRT; + Drawing::RenderTarget clippedRT; const auto& previewWidget = widgets[WIDX_PREVIEW]; const auto previewCoords = windowPos + ScreenCoordsXY{ previewWidget.left, previewWidget.top }; if (ClipDrawPixelInfo(clippedRT, rt, previewCoords, previewWidget.width(), previewWidget.height())) diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index d577872c25..4c5691bf24 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -452,7 +452,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); @@ -673,7 +673,7 @@ namespace OpenRCT2::Ui::Windows } } - void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(const int32_t scrollIndex, Drawing::RenderTarget& rt) override { uint8_t paletteIndex = ColourMapA[colours[0].colour].mid_light; GfxClear(rt, paletteIndex); diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp index 0c13353dec..73f0defddc 100644 --- a/src/openrct2-ui/windows/Transparency.cpp +++ b/src/openrct2-ui/windows/Transparency.cpp @@ -141,7 +141,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); // Locate mechanic button image diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 46966210f4..0fef3c583b 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -288,7 +288,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 1fa877a4f3..a2d11750fb 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows } } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index f006b6f21c..30f3309568 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void onDraw(RenderTarget& rt) override + void onDraw(Drawing::RenderTarget& rt) override { auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(), windowPos.y + widgets[WIDX_PREVIEW].midY() }; diff --git a/src/openrct2-ui/windows/Windows.h b/src/openrct2-ui/windows/Windows.h index 4f0220c2fb..a96345c992 100644 --- a/src/openrct2-ui/windows/Windows.h +++ b/src/openrct2-ui/windows/Windows.h @@ -219,12 +219,12 @@ namespace OpenRCT2::Ui::Windows WindowBase* ResearchOpen(); void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex); - void WindowResearchDevelopmentDraw(WindowBase* w, RenderTarget& rt, WidgetIndex baseWidgetIndex); + void WindowResearchDevelopmentDraw(WindowBase* w, Drawing::RenderTarget& rt, WidgetIndex baseWidgetIndex); void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex); void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex); - void WindowResearchFundingDraw(WindowBase* w, RenderTarget& dpi); + void WindowResearchFundingDraw(WindowBase* w, Drawing::RenderTarget& dpi); // Ride WindowBase* RideMainOpen(const Ride& ride); diff --git a/src/openrct2/core/Imaging.h b/src/openrct2/core/Imaging.h index 05200fe02f..15d81aca91 100644 --- a/src/openrct2/core/Imaging.h +++ b/src/openrct2/core/Imaging.h @@ -18,8 +18,6 @@ #include #include -struct RenderTarget; - enum class ImageFormat { unknown, diff --git a/src/openrct2/drawing/Drawing.Sprite.BMP.cpp b/src/openrct2/drawing/Drawing.Sprite.BMP.cpp index 9509ddbee4..4988fb2970 100644 --- a/src/openrct2/drawing/Drawing.Sprite.BMP.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.BMP.cpp @@ -9,6 +9,8 @@ #include "Drawing.h" +using namespace OpenRCT2::Drawing; + template static void FASTCALL DrawBMPSpriteMagnify(RenderTarget& rt, const DrawSpriteArgs& args) { diff --git a/src/openrct2/drawing/Drawing.Sprite.RLE.cpp b/src/openrct2/drawing/Drawing.Sprite.RLE.cpp index 0c0757387a..c725405b5e 100644 --- a/src/openrct2/drawing/Drawing.Sprite.RLE.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.RLE.cpp @@ -12,6 +12,8 @@ #include #include +using namespace OpenRCT2::Drawing; + template static void FASTCALL DrawRLESpriteMagnify(RenderTarget& rt, const DrawSpriteArgs& args) { diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index 64fa0b3833..ae2101b885 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -30,6 +30,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Ui; /** diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index 8156abb4fc..11068b9b76 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -27,6 +27,7 @@ #include "TTF.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, bool noFormatting); diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 070e1adba5..29776ce9a8 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -875,23 +875,6 @@ std::optional GetPaletteMapForColour(colour_t paletteId) return std::nullopt; } -uint8_t* RenderTarget::GetBitsOffset(const ScreenCoordsXY& pos) const -{ - return bits + pos.x + pos.y * LineStride(); -} - -RenderTarget RenderTarget::Crop(const ScreenCoordsXY& pos, const ScreenSize& size) const -{ - RenderTarget result = *this; - result.bits = GetBitsOffset(pos); - result.x = pos.x; - result.y = pos.y; - result.width = size.width; - result.height = size.height; - result.pitch = width + pitch - size.width; - return result; -} - FilterPaletteID GetGlassPaletteId(colour_t c) { return kGlassPaletteIds[c]; diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index de329e7d41..a879af71f7 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -15,8 +15,10 @@ #include "../interface/ZoomLevel.h" #include "../world/Location.hpp" #include "ColourPalette.h" +#include "FilterPaletteIds.h" #include "Font.h" #include "ImageId.hpp" +#include "RenderTarget.h" #include "Text.h" #include "TextColour.h" @@ -70,51 +72,6 @@ struct Gx std::unique_ptr data; }; -struct RenderTarget -{ - uint8_t* bits{}; - int32_t x{}; - int32_t y{}; - int32_t width{}; - int32_t height{}; - int32_t pitch{}; // note: this is actually (pitch - width) - int32_t cullingX{}; - int32_t cullingY{}; - int32_t cullingWidth{}; - int32_t cullingHeight{}; - ZoomLevel zoom_level{}; - - // Last position of drawn text. - ScreenCoordsXY lastStringPos{}; - - OpenRCT2::Drawing::IDrawingEngine* DrawingEngine{}; - - uint8_t* GetBitsOffset(const ScreenCoordsXY& pos) const; - RenderTarget Crop(const ScreenCoordsXY& pos, const ScreenSize& size) const; - - [[nodiscard]] constexpr int32_t WorldX() const - { - return zoom_level.ApplyTo(x); - } - [[nodiscard]] constexpr int32_t WorldY() const - { - return zoom_level.ApplyTo(y); - } - [[nodiscard]] constexpr int32_t WorldWidth() const - { - return zoom_level.ApplyTo(width); - } - [[nodiscard]] constexpr int32_t WorldHeight() const - { - return zoom_level.ApplyTo(height); - } - - [[nodiscard]] constexpr int32_t LineStride() const - { - return width + pitch; - } -}; - struct RCTG1Element { uint32_t offset; // 0x00 note: uint32_t always! @@ -159,157 +116,15 @@ constexpr DrawBlendOp kBlendSrc = 1 << 1; */ constexpr DrawBlendOp kBlendDst = 2 << 2; -enum class FilterPaletteID : int32_t +namespace OpenRCT2::Drawing { - paletteNull = 0, - - paletteWater = COLOUR_COUNT, - - paletteLandMarker0, // North (corner/edge) - paletteLandMarker1, // East (corner/edge) - paletteLandMarker2, // South (corner/edge) - paletteLandMarker3, // West (corner/edge) - paletteSceneryGroundMarker, - paletteWaterMarker, - paletteQuarterMarker0, // North (not sure why it couldn't just use PaletteLandMarker0) - paletteQuarterMarker1, // East - paletteQuarterMarker2, // South - paletteQuarterMarker3, // West - paletteRideGroundMarker, - paletteGhost, // Construction marker - palette45, // Decolourise + lighten - palette46, - - paletteDarken3, - - paletteDarken1 = paletteDarken3 + 2, - paletteDarken2, - palette51, // Decolourise + darken - paletteTranslucentGrey, - paletteTranslucentGreyHighlight, - paletteTranslucentGreyShadow, - paletteTranslucentLightBlue, - paletteTranslucentLightBlueHighlight, - paletteTranslucentLightBlueShadow, - paletteTranslucentBordeauxRed, - paletteTranslucentBordeauxRedHighlight, - paletteTranslucentBordeauxRedShadow, - paletteTranslucentDarkGreen, - paletteTranslucentDarkGreenHighlight, - paletteTranslucentDarkGreenShadow, - paletteTranslucentLightPurple, - paletteTranslucentLightPurpleHighlight, - paletteTranslucentLightPurpleShadow, - paletteTranslucentDarkOliveGreen, - paletteTranslucentDarkOliveGreenHighlight, - paletteTranslucentDarkOliveGreenShadow, - paletteTranslucentLightBrown, - paletteTranslucentLightBrownHighlight, - paletteTranslucentLightBrownShadow, - paletteTranslucentYellow, - paletteTranslucentYellowHighlight, - paletteTranslucentYellowShadow, - paletteTranslucentMossGreen, - paletteTranslucentMossGreenHighlight, - paletteTranslucentMossGreenShadow, - paletteTranslucentOliveGreen, - paletteTranslucentOliveGreenHighlight, - paletteTranslucentOliveGreenShadow, - paletteTranslucentBrightGreen, - paletteTranslucentBrightGreenHighlight, - paletteTranslucentBrightGreenShadow, - paletteTranslucentSalmonPink, - paletteTranslucentSalmonPinkHighlight, - paletteTranslucentSalmonPinkShadow, - paletteTranslucentBrightPurple, - paletteTranslucentBrightPurpleHighlight, - paletteTranslucentBrightPurpleShadow, - paletteTranslucentBrightRed, - paletteTranslucentBrightRedHighlight, - paletteTranslucentBrightRedShadow, - paletteTranslucentLightOrange, - paletteTranslucentLightOrangeHighlight, - paletteTranslucentLightOrangeShadow, - paletteTranslucentTeal, - paletteTranslucentTealHighlight, - paletteTranslucentTealShadow, - paletteTranslucentBrightPink, - paletteTranslucentBrightPinkHighlight, - paletteTranslucentBrightPinkShadow, - paletteTranslucentDarkBrown, - paletteTranslucentDarkBrownHighlight, - paletteTranslucentDarkBrownShadow, - paletteTranslucentLightPink, - paletteTranslucentLightPinkHighlight, - paletteTranslucentLightPinkShadow, - paletteTranslucentWhite, - paletteTranslucentWhiteHighlight, - paletteTranslucentWhiteShadow, - paletteGlass, - paletteGlassBlack = paletteGlass + COLOUR_BLACK, - paletteGlassGrey = paletteGlass + COLOUR_GREY, - paletteGlassWhite = paletteGlass + COLOUR_WHITE, - paletteGlassDarkPurple = paletteGlass + COLOUR_DARK_PURPLE, - paletteGlassLightPurple = paletteGlass + COLOUR_LIGHT_PURPLE, - paletteGlassBrightPurple = paletteGlass + COLOUR_BRIGHT_PURPLE, - paletteGlassDarkBlue = paletteGlass + COLOUR_DARK_BLUE, - paletteGlassLightBlue = paletteGlass + COLOUR_LIGHT_BLUE, - paletteGlassIcyBlue = paletteGlass + COLOUR_ICY_BLUE, - paletteGlassTeal = paletteGlass + COLOUR_TEAL, - paletteGlassAquamarine = paletteGlass + COLOUR_AQUAMARINE, - paletteGlassSaturatedGreen = paletteGlass + COLOUR_SATURATED_GREEN, - paletteGlassDarkGreen = paletteGlass + COLOUR_DARK_GREEN, - paletteGlassMossGreen = paletteGlass + COLOUR_MOSS_GREEN, - paletteGlassBrightGreen = paletteGlass + COLOUR_BRIGHT_GREEN, - paletteGlassOliveGreen = paletteGlass + COLOUR_OLIVE_GREEN, - paletteGlassDarkOliveGreen = paletteGlass + COLOUR_DARK_OLIVE_GREEN, - paletteGlassBrightYellow = paletteGlass + COLOUR_BRIGHT_YELLOW, - paletteGlassYellow = paletteGlass + COLOUR_YELLOW, - paletteGlassDarkYellow = paletteGlass + COLOUR_DARK_YELLOW, - paletteGlassLightOrange = paletteGlass + COLOUR_LIGHT_ORANGE, - paletteGlassDarkOrange = paletteGlass + COLOUR_DARK_ORANGE, - paletteGlassLightBrown = paletteGlass + COLOUR_LIGHT_BROWN, - paletteGlassSaturatedBrown = paletteGlass + COLOUR_SATURATED_BROWN, - paletteGlassDarkBrown = paletteGlass + COLOUR_DARK_BROWN, - paletteGlassSalmonPink = paletteGlass + COLOUR_SALMON_PINK, - paletteGlassBordeauxRed = paletteGlass + COLOUR_BORDEAUX_RED, - paletteGlassSaturatedRed = paletteGlass + COLOUR_SATURATED_RED, - paletteGlassBrightRed = paletteGlass + COLOUR_BRIGHT_RED, - paletteGlassDarkPink = paletteGlass + COLOUR_DARK_PINK, - paletteGlassBrightPink = paletteGlass + COLOUR_BRIGHT_PINK, - paletteGlassLightPink = paletteGlass + COLOUR_LIGHT_PINK, - paletteGlassDarkOliveDark = paletteGlass + COLOUR_DARK_OLIVE_DARK, - paletteGlassDarkOliveLight = paletteGlass + COLOUR_DARK_OLIVE_LIGHT, - paletteGlassSaturatedBrownLight = paletteGlass + COLOUR_SATURATED_BROWN_LIGHT, - paletteGlassBordeauxRedDark = paletteGlass + COLOUR_BORDEAUX_RED_DARK, - paletteGlassBordeauxRedLight = paletteGlass + COLOUR_BORDEAUX_RED_LIGHT, - paletteGlassGrassGreenDark = paletteGlass + COLOUR_GRASS_GREEN_DARK, - paletteGlassGrassGreenLight = paletteGlass + COLOUR_GRASS_GREEN_LIGHT, - paletteGlassOliveDark = paletteGlass + COLOUR_OLIVE_DARK, - paletteGlassOliveLight = paletteGlass + COLOUR_OLIVE_LIGHT, - paletteGlassSaturatedGreenLight = paletteGlass + COLOUR_SATURATED_GREEN_LIGHT, - paletteGlassTanDark = paletteGlass + COLOUR_TAN_DARK, - paletteGlassTanLight = paletteGlass + COLOUR_TAN_LIGHT, - paletteGlassDullPurpleLight = paletteGlass + COLOUR_DULL_PURPLE_LIGHT, - paletteGlassDullGreenDark = paletteGlass + COLOUR_DULL_GREEN_DARK, - paletteGlassDullGreenLight = paletteGlass + COLOUR_DULL_GREEN_LIGHT, - paletteGlassSaturatedPurpleDark = paletteGlass + COLOUR_SATURATED_PURPLE_DARK, - paletteGlassSaturatedPurpleLight = paletteGlass + COLOUR_SATURATED_PURPLE_LIGHT, - paletteGlassOrangeLight = paletteGlass + COLOUR_ORANGE_LIGHT, - paletteGlassAquaDark = paletteGlass + COLOUR_AQUA_DARK, - paletteGlassMagentaLight = paletteGlass + COLOUR_MAGENTA_LIGHT, - paletteGlassDullBrownDark = paletteGlass + COLOUR_DULL_BROWN_DARK, - paletteGlassDullBrownLight = paletteGlass + COLOUR_DULL_BROWN_LIGHT, - paletteGlassInvisible = paletteGlass + COLOUR_INVISIBLE, - paletteGlassVoid = paletteGlass + COLOUR_VOID, -}; - -struct TranslucentWindowPalette -{ - FilterPaletteID base; - FilterPaletteID highlight; - FilterPaletteID shadow; -}; + struct TranslucentWindowPalette + { + FilterPaletteID base; + FilterPaletteID highlight; + FilterPaletteID shadow; + }; +} // namespace OpenRCT2::Drawing /** * Represents an 8-bit indexed map that maps from one palette index to another. @@ -460,14 +275,16 @@ extern OpenRCT2::Drawing::GamePalette gGamePalette; extern uint32_t gPaletteEffectFrame; extern OpenRCT2::Drawing::TextColours gTextPalette; -extern const TranslucentWindowPalette kTranslucentWindowPalettes[COLOUR_COUNT]; +extern const OpenRCT2::Drawing::TranslucentWindowPalette kTranslucentWindowPalettes[COLOUR_COUNT]; extern ImageId gPickupPeepImage; extern int32_t gPickupPeepX; extern int32_t gPickupPeepY; extern bool gPaintForceRedraw; -bool ClipDrawPixelInfo(RenderTarget& dst, RenderTarget& src, const ScreenCoordsXY& coords, int32_t width, int32_t height); +bool ClipDrawPixelInfo( + OpenRCT2::Drawing::RenderTarget& dst, OpenRCT2::Drawing::RenderTarget& src, const ScreenCoordsXY& coords, int32_t width, + int32_t height); void GfxSetDirtyBlocks(const ScreenRect& rect); void GfxInvalidateScreen(); @@ -476,16 +293,18 @@ void GfxTransposePalette(int32_t pal, uint8_t product); void LoadPalette(); // other -void GfxClear(RenderTarget& rt, uint8_t paletteIndex); -void GfxFilterPixel(RenderTarget& rt, const ScreenCoordsXY& coords, FilterPaletteID palette); +void GfxClear(OpenRCT2::Drawing::RenderTarget& rt, uint8_t paletteIndex); +void GfxFilterPixel( + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, OpenRCT2::Drawing::FilterPaletteID palette); void GfxInvalidatePickedUpPeep(); -void GfxDrawPickedUpPeep(RenderTarget& rt); +void GfxDrawPickedUpPeep(OpenRCT2::Drawing::RenderTarget& rt); // line -void GfxDrawLine(RenderTarget& rt, const ScreenLine& line, int32_t colour); -void GfxDrawLineSoftware(RenderTarget& rt, const ScreenLine& line, int32_t colour); +void GfxDrawLine(OpenRCT2::Drawing::RenderTarget& rt, const ScreenLine& line, int32_t colour); +void GfxDrawLineSoftware(OpenRCT2::Drawing::RenderTarget& rt, const ScreenLine& line, int32_t colour); void GfxDrawDashedLine( - RenderTarget& rt, const ScreenLine& screenLine, const int32_t dashedLineSegmentLength, const int32_t color); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenLine& screenLine, const int32_t dashedLineSegmentLength, + const int32_t color); // sprite bool GfxLoadG1(const OpenRCT2::IPlatformEnvironment& env); @@ -499,31 +318,34 @@ const G1Element* GfxGetG1Element(ImageIndex image_id); void GfxSetG1Element(ImageIndex imageId, const G1Element* g1); std::optional GfxLoadGx(const std::vector& buffer); bool IsCsgLoaded(); -void FASTCALL GfxSpriteToBuffer(RenderTarget& rt, const DrawSpriteArgs& args); -void FASTCALL GfxBmpSpriteToBuffer(RenderTarget& rt, const DrawSpriteArgs& args); -void FASTCALL GfxRleSpriteToBuffer(RenderTarget& rt, const DrawSpriteArgs& args); -void FASTCALL GfxDrawSprite(RenderTarget& rt, const ImageId image_id, const ScreenCoordsXY& coords); -void FASTCALL GfxDrawGlyph(RenderTarget& rt, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); -void FASTCALL GfxDrawSpriteSolid(RenderTarget& rt, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour); +void FASTCALL GfxSpriteToBuffer(OpenRCT2::Drawing::RenderTarget& rt, const DrawSpriteArgs& args); +void FASTCALL GfxBmpSpriteToBuffer(OpenRCT2::Drawing::RenderTarget& rt, const DrawSpriteArgs& args); +void FASTCALL GfxRleSpriteToBuffer(OpenRCT2::Drawing::RenderTarget& rt, const DrawSpriteArgs& args); +void FASTCALL GfxDrawSprite(OpenRCT2::Drawing::RenderTarget& rt, const ImageId image_id, const ScreenCoordsXY& coords); +void FASTCALL GfxDrawGlyph( + OpenRCT2::Drawing::RenderTarget& rt, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); void FASTCALL - GfxDrawSpriteRawMasked(RenderTarget& rt, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage); -void FASTCALL GfxDrawSpriteSoftware(RenderTarget& rt, const ImageId imageId, const ScreenCoordsXY& spriteCoords); + GfxDrawSpriteSolid(OpenRCT2::Drawing::RenderTarget& rt, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour); +void FASTCALL GfxDrawSpriteRawMasked( + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage); +void FASTCALL + GfxDrawSpriteSoftware(OpenRCT2::Drawing::RenderTarget& rt, const ImageId imageId, const ScreenCoordsXY& spriteCoords); void FASTCALL GfxDrawSpritePaletteSetSoftware( - RenderTarget& rt, const ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); + OpenRCT2::Drawing::RenderTarget& rt, const ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); void FASTCALL GfxDrawSpriteRawMaskedSoftware( - RenderTarget& rt, const ScreenCoordsXY& scrCoords, const ImageId maskImage, const ImageId colourImage); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& scrCoords, const ImageId maskImage, const ImageId colourImage); // string void GfxDrawStringLeftCentred( - RenderTarget& rt, StringId format, void* args, ColourWithFlags colour, const ScreenCoordsXY& coords); + OpenRCT2::Drawing::RenderTarget& rt, StringId format, void* args, ColourWithFlags colour, const ScreenCoordsXY& coords); void DrawStringCentredRaw( - RenderTarget& rt, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle); void DrawNewsTicker( - RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, colour_t colour, StringId format, u8string_view args, - int32_t ticks); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, colour_t colour, StringId format, + u8string_view args, int32_t ticks); void GfxDrawStringWithYOffsets( - RenderTarget& rt, const utf8* text, ColourWithFlags colour, const ScreenCoordsXY& coords, const int8_t* yOffsets, - bool forceSpriteFont, FontStyle fontStyle); + OpenRCT2::Drawing::RenderTarget& rt, const utf8* text, ColourWithFlags colour, const ScreenCoordsXY& coords, + const int8_t* yOffsets, bool forceSpriteFont, FontStyle fontStyle); int32_t GfxWrapString(u8string_view text, int32_t width, FontStyle fontStyle, u8string* outWrappedText, int32_t* outNumLines); int32_t GfxGetStringWidth(std::string_view text, FontStyle fontStyle); @@ -533,13 +355,8 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle); int32_t GfxClipString(char* buffer, int32_t width, FontStyle fontStyle); u8string ShortenPath(const u8string& path, int32_t availableWidth, FontStyle fontStyle); void TTFDrawString( - RenderTarget& rt, const_utf8string text, ColourWithFlags colour, const ScreenCoordsXY& coords, bool noFormatting, - FontStyle fontStyle, TextDarkness darkness); - -namespace OpenRCT2 -{ - class Formatter; -} + OpenRCT2::Drawing::RenderTarget& rt, const_utf8string text, ColourWithFlags colour, const ScreenCoordsXY& coords, + bool noFormatting, FontStyle fontStyle, TextDarkness darkness); size_t G1CalculateDataSize(const G1Element* g1); @@ -565,6 +382,6 @@ void UpdatePaletteEffects(); void RefreshVideo(); void ToggleWindowedMode(); -void DebugDPI(RenderTarget& rt); +void DebugDPI(OpenRCT2::Drawing::RenderTarget& rt); #include "NewDrawing.h" diff --git a/src/openrct2/drawing/FilterPaletteIds.h b/src/openrct2/drawing/FilterPaletteIds.h new file mode 100644 index 0000000000..a8ea2f7a68 --- /dev/null +++ b/src/openrct2/drawing/FilterPaletteIds.h @@ -0,0 +1,160 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 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. + *****************************************************************************/ + +#pragma once + +#include "../interface/Colour.h" + +namespace OpenRCT2::Drawing +{ + enum class FilterPaletteID : int32_t + { + paletteNull = 0, + + paletteWater = COLOUR_COUNT, + + paletteLandMarker0, // North (corner/edge) + paletteLandMarker1, // East (corner/edge) + paletteLandMarker2, // South (corner/edge) + paletteLandMarker3, // West (corner/edge) + paletteSceneryGroundMarker, + paletteWaterMarker, + paletteQuarterMarker0, // North (not sure why it couldn't just use PaletteLandMarker0) + paletteQuarterMarker1, // East + paletteQuarterMarker2, // South + paletteQuarterMarker3, // West + paletteRideGroundMarker, + paletteGhost, // Construction marker + palette45, // Decolourise + lighten + palette46, + + paletteDarken3, + + paletteDarken1 = paletteDarken3 + 2, + paletteDarken2, + palette51, // Decolourise + darken + paletteTranslucentGrey, + paletteTranslucentGreyHighlight, + paletteTranslucentGreyShadow, + paletteTranslucentLightBlue, + paletteTranslucentLightBlueHighlight, + paletteTranslucentLightBlueShadow, + paletteTranslucentBordeauxRed, + paletteTranslucentBordeauxRedHighlight, + paletteTranslucentBordeauxRedShadow, + paletteTranslucentDarkGreen, + paletteTranslucentDarkGreenHighlight, + paletteTranslucentDarkGreenShadow, + paletteTranslucentLightPurple, + paletteTranslucentLightPurpleHighlight, + paletteTranslucentLightPurpleShadow, + paletteTranslucentDarkOliveGreen, + paletteTranslucentDarkOliveGreenHighlight, + paletteTranslucentDarkOliveGreenShadow, + paletteTranslucentLightBrown, + paletteTranslucentLightBrownHighlight, + paletteTranslucentLightBrownShadow, + paletteTranslucentYellow, + paletteTranslucentYellowHighlight, + paletteTranslucentYellowShadow, + paletteTranslucentMossGreen, + paletteTranslucentMossGreenHighlight, + paletteTranslucentMossGreenShadow, + paletteTranslucentOliveGreen, + paletteTranslucentOliveGreenHighlight, + paletteTranslucentOliveGreenShadow, + paletteTranslucentBrightGreen, + paletteTranslucentBrightGreenHighlight, + paletteTranslucentBrightGreenShadow, + paletteTranslucentSalmonPink, + paletteTranslucentSalmonPinkHighlight, + paletteTranslucentSalmonPinkShadow, + paletteTranslucentBrightPurple, + paletteTranslucentBrightPurpleHighlight, + paletteTranslucentBrightPurpleShadow, + paletteTranslucentBrightRed, + paletteTranslucentBrightRedHighlight, + paletteTranslucentBrightRedShadow, + paletteTranslucentLightOrange, + paletteTranslucentLightOrangeHighlight, + paletteTranslucentLightOrangeShadow, + paletteTranslucentTeal, + paletteTranslucentTealHighlight, + paletteTranslucentTealShadow, + paletteTranslucentBrightPink, + paletteTranslucentBrightPinkHighlight, + paletteTranslucentBrightPinkShadow, + paletteTranslucentDarkBrown, + paletteTranslucentDarkBrownHighlight, + paletteTranslucentDarkBrownShadow, + paletteTranslucentLightPink, + paletteTranslucentLightPinkHighlight, + paletteTranslucentLightPinkShadow, + paletteTranslucentWhite, + paletteTranslucentWhiteHighlight, + paletteTranslucentWhiteShadow, + paletteGlass, + paletteGlassBlack = paletteGlass + COLOUR_BLACK, + paletteGlassGrey = paletteGlass + COLOUR_GREY, + paletteGlassWhite = paletteGlass + COLOUR_WHITE, + paletteGlassDarkPurple = paletteGlass + COLOUR_DARK_PURPLE, + paletteGlassLightPurple = paletteGlass + COLOUR_LIGHT_PURPLE, + paletteGlassBrightPurple = paletteGlass + COLOUR_BRIGHT_PURPLE, + paletteGlassDarkBlue = paletteGlass + COLOUR_DARK_BLUE, + paletteGlassLightBlue = paletteGlass + COLOUR_LIGHT_BLUE, + paletteGlassIcyBlue = paletteGlass + COLOUR_ICY_BLUE, + paletteGlassTeal = paletteGlass + COLOUR_TEAL, + paletteGlassAquamarine = paletteGlass + COLOUR_AQUAMARINE, + paletteGlassSaturatedGreen = paletteGlass + COLOUR_SATURATED_GREEN, + paletteGlassDarkGreen = paletteGlass + COLOUR_DARK_GREEN, + paletteGlassMossGreen = paletteGlass + COLOUR_MOSS_GREEN, + paletteGlassBrightGreen = paletteGlass + COLOUR_BRIGHT_GREEN, + paletteGlassOliveGreen = paletteGlass + COLOUR_OLIVE_GREEN, + paletteGlassDarkOliveGreen = paletteGlass + COLOUR_DARK_OLIVE_GREEN, + paletteGlassBrightYellow = paletteGlass + COLOUR_BRIGHT_YELLOW, + paletteGlassYellow = paletteGlass + COLOUR_YELLOW, + paletteGlassDarkYellow = paletteGlass + COLOUR_DARK_YELLOW, + paletteGlassLightOrange = paletteGlass + COLOUR_LIGHT_ORANGE, + paletteGlassDarkOrange = paletteGlass + COLOUR_DARK_ORANGE, + paletteGlassLightBrown = paletteGlass + COLOUR_LIGHT_BROWN, + paletteGlassSaturatedBrown = paletteGlass + COLOUR_SATURATED_BROWN, + paletteGlassDarkBrown = paletteGlass + COLOUR_DARK_BROWN, + paletteGlassSalmonPink = paletteGlass + COLOUR_SALMON_PINK, + paletteGlassBordeauxRed = paletteGlass + COLOUR_BORDEAUX_RED, + paletteGlassSaturatedRed = paletteGlass + COLOUR_SATURATED_RED, + paletteGlassBrightRed = paletteGlass + COLOUR_BRIGHT_RED, + paletteGlassDarkPink = paletteGlass + COLOUR_DARK_PINK, + paletteGlassBrightPink = paletteGlass + COLOUR_BRIGHT_PINK, + paletteGlassLightPink = paletteGlass + COLOUR_LIGHT_PINK, + paletteGlassDarkOliveDark = paletteGlass + COLOUR_DARK_OLIVE_DARK, + paletteGlassDarkOliveLight = paletteGlass + COLOUR_DARK_OLIVE_LIGHT, + paletteGlassSaturatedBrownLight = paletteGlass + COLOUR_SATURATED_BROWN_LIGHT, + paletteGlassBordeauxRedDark = paletteGlass + COLOUR_BORDEAUX_RED_DARK, + paletteGlassBordeauxRedLight = paletteGlass + COLOUR_BORDEAUX_RED_LIGHT, + paletteGlassGrassGreenDark = paletteGlass + COLOUR_GRASS_GREEN_DARK, + paletteGlassGrassGreenLight = paletteGlass + COLOUR_GRASS_GREEN_LIGHT, + paletteGlassOliveDark = paletteGlass + COLOUR_OLIVE_DARK, + paletteGlassOliveLight = paletteGlass + COLOUR_OLIVE_LIGHT, + paletteGlassSaturatedGreenLight = paletteGlass + COLOUR_SATURATED_GREEN_LIGHT, + paletteGlassTanDark = paletteGlass + COLOUR_TAN_DARK, + paletteGlassTanLight = paletteGlass + COLOUR_TAN_LIGHT, + paletteGlassDullPurpleLight = paletteGlass + COLOUR_DULL_PURPLE_LIGHT, + paletteGlassDullGreenDark = paletteGlass + COLOUR_DULL_GREEN_DARK, + paletteGlassDullGreenLight = paletteGlass + COLOUR_DULL_GREEN_LIGHT, + paletteGlassSaturatedPurpleDark = paletteGlass + COLOUR_SATURATED_PURPLE_DARK, + paletteGlassSaturatedPurpleLight = paletteGlass + COLOUR_SATURATED_PURPLE_LIGHT, + paletteGlassOrangeLight = paletteGlass + COLOUR_ORANGE_LIGHT, + paletteGlassAquaDark = paletteGlass + COLOUR_AQUA_DARK, + paletteGlassMagentaLight = paletteGlass + COLOUR_MAGENTA_LIGHT, + paletteGlassDullBrownDark = paletteGlass + COLOUR_DULL_BROWN_DARK, + paletteGlassDullBrownLight = paletteGlass + COLOUR_DULL_BROWN_LIGHT, + paletteGlassInvisible = paletteGlass + COLOUR_INVISIBLE, + paletteGlassVoid = paletteGlass + COLOUR_VOID, + }; +} diff --git a/src/openrct2/drawing/IDrawingEngine.h b/src/openrct2/drawing/IDrawingEngine.h index 94c7d66270..7b673d2110 100644 --- a/src/openrct2/drawing/IDrawingEngine.h +++ b/src/openrct2/drawing/IDrawingEngine.h @@ -38,8 +38,6 @@ enum DrawingEngineFlag }; using DrawingEngineFlags = FlagHolder; -struct RenderTarget; - namespace OpenRCT2::Ui { struct IUiContext; @@ -48,6 +46,7 @@ namespace OpenRCT2::Ui namespace OpenRCT2::Drawing { struct IDrawingContext; + struct RenderTarget; struct IDrawingEngine { diff --git a/src/openrct2/drawing/ImageId.hpp b/src/openrct2/drawing/ImageId.hpp index bc24def9a8..203702ee53 100644 --- a/src/openrct2/drawing/ImageId.hpp +++ b/src/openrct2/drawing/ImageId.hpp @@ -16,7 +16,11 @@ #include using colour_t = uint8_t; -enum class FilterPaletteID : int32_t; + +namespace OpenRCT2::Drawing +{ + enum class FilterPaletteID : int32_t; +} enum class ImageCatalogue { @@ -28,7 +32,7 @@ enum class ImageCatalogue TEMPORARY, }; -FilterPaletteID GetGlassPaletteId(colour_t); +OpenRCT2::Drawing::FilterPaletteID GetGlassPaletteId(colour_t); /** * Represents a specific image from a catalogue such as G1, G2, CSG etc. with remap @@ -65,7 +69,7 @@ public: { } - constexpr ImageId(uint32_t index, FilterPaletteID palette) + constexpr ImageId(uint32_t index, OpenRCT2::Drawing::FilterPaletteID palette) : ImageId(ImageId(index).WithRemap(palette)) { } @@ -156,7 +160,7 @@ public: return result; } - [[nodiscard]] constexpr ImageId WithRemap(FilterPaletteID paletteId) const + [[nodiscard]] constexpr ImageId WithRemap(OpenRCT2::Drawing::FilterPaletteID paletteId) const { return WithRemap(static_cast(paletteId)); } @@ -216,7 +220,7 @@ public: return WithTransparency(GetGlassPaletteId(colour)); } - [[nodiscard]] ImageId WithTransparency(FilterPaletteID palette) const + [[nodiscard]] ImageId WithTransparency(OpenRCT2::Drawing::FilterPaletteID palette) const { ImageId result = *this; result._primary = static_cast(palette); diff --git a/src/openrct2/drawing/LightFX.h b/src/openrct2/drawing/LightFX.h index 8ce68a7bd1..364706bbc9 100644 --- a/src/openrct2/drawing/LightFX.h +++ b/src/openrct2/drawing/LightFX.h @@ -15,7 +15,6 @@ struct CoordsXY; struct Vehicle; -struct RenderTarget; struct CoordsXYZ; struct EntityBase; @@ -24,6 +23,11 @@ namespace OpenRCT2 struct Viewport; } +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + namespace OpenRCT2::Drawing::LightFx { enum class LightType : uint8_t diff --git a/src/openrct2/drawing/Line.cpp b/src/openrct2/drawing/Line.cpp index 07f3e3feb0..4f54f7fe10 100644 --- a/src/openrct2/drawing/Line.cpp +++ b/src/openrct2/drawing/Line.cpp @@ -12,6 +12,8 @@ #include #include +using namespace OpenRCT2::Drawing; + /** * Draws a horizontal line of specified colour to a buffer. * rct2: 0x0068474C diff --git a/src/openrct2/drawing/NewDrawing.h b/src/openrct2/drawing/NewDrawing.h index 962041c51d..1764366440 100644 --- a/src/openrct2/drawing/NewDrawing.h +++ b/src/openrct2/drawing/NewDrawing.h @@ -12,7 +12,10 @@ #include "../localisation/StringIdType.h" #include "ColourPalette.h" -struct RenderTarget; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} enum class DrawingEngine : int32_t; @@ -24,7 +27,7 @@ void DrawingEngineSetPalette(const OpenRCT2::Drawing::GamePalette& colours); void DrawingEngineCopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy); void DrawingEngineDispose(); -RenderTarget& DrawingEngineGetDpi(); +OpenRCT2::Drawing::RenderTarget& DrawingEngineGetDpi(); bool DrawingEngineHasDirtyOptimisations(); void DrawingEngineInvalidateImage(uint32_t image); void DrawingEngineSetVSync(bool vsync); diff --git a/src/openrct2/drawing/Rectangle.h b/src/openrct2/drawing/Rectangle.h index 170be7df2a..2ac65519e9 100644 --- a/src/openrct2/drawing/Rectangle.h +++ b/src/openrct2/drawing/Rectangle.h @@ -11,8 +11,6 @@ #include -enum class FilterPaletteID : int32_t; -struct RenderTarget; struct ScreenRect; namespace OpenRCT2 @@ -20,6 +18,12 @@ namespace OpenRCT2 struct ColourWithFlags; } +namespace OpenRCT2::Drawing +{ + enum class FilterPaletteID : int32_t; + struct RenderTarget; +} // namespace OpenRCT2::Drawing + namespace OpenRCT2::Drawing::Rectangle { enum class BorderStyle : uint8_t diff --git a/src/openrct2/drawing/RenderTarget.cpp b/src/openrct2/drawing/RenderTarget.cpp new file mode 100644 index 0000000000..90a6b78def --- /dev/null +++ b/src/openrct2/drawing/RenderTarget.cpp @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 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 "RenderTarget.h" + +namespace OpenRCT2::Drawing +{ + uint8_t* RenderTarget::GetBitsOffset(const ScreenCoordsXY& pos) const + { + return bits + pos.x + pos.y * LineStride(); + } + + RenderTarget RenderTarget::Crop(const ScreenCoordsXY& pos, const ScreenSize& size) const + { + RenderTarget result = *this; + result.bits = GetBitsOffset(pos); + result.x = pos.x; + result.y = pos.y; + result.width = size.width; + result.height = size.height; + result.pitch = width + pitch - size.width; + return result; + } +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/RenderTarget.h b/src/openrct2/drawing/RenderTarget.h new file mode 100644 index 0000000000..72ddbc84b9 --- /dev/null +++ b/src/openrct2/drawing/RenderTarget.h @@ -0,0 +1,63 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 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. + *****************************************************************************/ + +#pragma once + +#include "../interface/ZoomLevel.h" +#include "../world/Location.hpp" + +namespace OpenRCT2::Drawing +{ + struct IDrawingEngine; + + struct RenderTarget + { + uint8_t* bits{}; + int32_t x{}; + int32_t y{}; + int32_t width{}; + int32_t height{}; + int32_t pitch{}; // note: this is actually (pitch - width) + int32_t cullingX{}; + int32_t cullingY{}; + int32_t cullingWidth{}; + int32_t cullingHeight{}; + ZoomLevel zoom_level{}; + + // Last position of drawn text. + ScreenCoordsXY lastStringPos{}; + + IDrawingEngine* DrawingEngine{}; + + uint8_t* GetBitsOffset(const ScreenCoordsXY& pos) const; + RenderTarget Crop(const ScreenCoordsXY& pos, const ScreenSize& size) const; + + [[nodiscard]] constexpr int32_t WorldX() const + { + return zoom_level.ApplyTo(x); + } + [[nodiscard]] constexpr int32_t WorldY() const + { + return zoom_level.ApplyTo(y); + } + [[nodiscard]] constexpr int32_t WorldWidth() const + { + return zoom_level.ApplyTo(width); + } + [[nodiscard]] constexpr int32_t WorldHeight() const + { + return zoom_level.ApplyTo(height); + } + + [[nodiscard]] constexpr int32_t LineStride() const + { + return width + pitch; + } + }; +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/Text.h b/src/openrct2/drawing/Text.h index 35f78423ce..3c7c59edba 100644 --- a/src/openrct2/drawing/Text.h +++ b/src/openrct2/drawing/Text.h @@ -15,7 +15,6 @@ #include "Font.h" struct ScreenCoordsXY; -struct RenderTarget; using OpenRCT2::ColourWithFlags; @@ -24,6 +23,11 @@ namespace OpenRCT2 class Formatter; } +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + enum class TextAlignment { left, @@ -206,17 +210,19 @@ struct TextPaint } }; -void DrawTextBasic(RenderTarget& rt, const ScreenCoordsXY& coords, StringId format); -void DrawTextEllipsised(RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format); -int32_t DrawTextWrapped(RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format); +void DrawTextBasic(OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, StringId format); +void DrawTextEllipsised(OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format); +int32_t DrawTextWrapped(OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format); void DrawText( - RenderTarget& rt, const ScreenCoordsXY& coords, const TextPaint& paint, const_utf8string text, bool noFormatting = false); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, const TextPaint& paint, const_utf8string text, + bool noFormatting = false); void DrawTextBasic( - RenderTarget& rt, const ScreenCoordsXY& coords, StringId format, const OpenRCT2::Formatter& ft, TextPaint textPaint = {}); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, StringId format, const OpenRCT2::Formatter& ft, + TextPaint textPaint = {}); void DrawTextEllipsised( - RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format, const OpenRCT2::Formatter& ft, - TextPaint textPaint = {}); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format, + const OpenRCT2::Formatter& ft, TextPaint textPaint = {}); int32_t DrawTextWrapped( - RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format, const OpenRCT2::Formatter& ft, - TextPaint textPaint = {}); + OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, StringId format, + const OpenRCT2::Formatter& ft, TextPaint textPaint = {}); diff --git a/src/openrct2/drawing/Weather.h b/src/openrct2/drawing/Weather.h index 260f154451..6e6feca854 100644 --- a/src/openrct2/drawing/Weather.h +++ b/src/openrct2/drawing/Weather.h @@ -11,12 +11,11 @@ #include -struct RenderTarget; - namespace OpenRCT2::Drawing { struct IWeatherDrawer; -} + struct RenderTarget; +} // namespace OpenRCT2::Drawing // clang-format off static constexpr uint8_t kRainPattern[] = @@ -37,4 +36,4 @@ static constexpr uint8_t kSnowPattern[] = // clang-format on -void DrawWeather(RenderTarget& rt, OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer); +void DrawWeather(OpenRCT2::Drawing::RenderTarget& rt, OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer); diff --git a/src/openrct2/entity/Duck.cpp b/src/openrct2/entity/Duck.cpp index 3f94824339..ade8021119 100644 --- a/src/openrct2/entity/Duck.cpp +++ b/src/openrct2/entity/Duck.cpp @@ -377,7 +377,7 @@ void Duck::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); - RenderTarget& rt = session.DPI; + auto& rt = session.DPI; if (rt.zoom_level > ZoomLevel{ 1 }) return; diff --git a/src/openrct2/entity/Fountain.cpp b/src/openrct2/entity/Fountain.cpp index 020e298483..0d9e221b9c 100644 --- a/src/openrct2/entity/Fountain.cpp +++ b/src/openrct2/entity/Fountain.cpp @@ -411,7 +411,7 @@ void JumpingFountain::Paint(PaintSession& session, int32_t imageDirection) const constexpr uint32_t kJumpingFountainSnowBaseImage = 23037; constexpr uint32_t kJumpingFountainWaterBaseImage = 22973; - RenderTarget& rt = session.DPI; + auto& rt = session.DPI; if (rt.zoom_level > ZoomLevel{ 0 }) { return; diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index 9eae8b4a07..66e31cfb03 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -184,7 +184,7 @@ void Litter::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); - RenderTarget& rt = session.DPI; + auto& rt = session.DPI; if (rt.zoom_level > ZoomLevel{ 0 }) return; // If zoomed at all no litter drawn diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index cac1ffb4d0..af16c466ea 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -198,7 +198,7 @@ void MoneyEffect::Paint(PaintSession& session, int32_t imageDirection) const return; } - RenderTarget& rt = session.DPI; + auto& rt = session.DPI; if (rt.zoom_level > ZoomLevel{ 0 }) { return; diff --git a/src/openrct2/entity/Particle.cpp b/src/openrct2/entity/Particle.cpp index 3ade9dd0c5..aeb549c901 100644 --- a/src/openrct2/entity/Particle.cpp +++ b/src/openrct2/entity/Particle.cpp @@ -176,7 +176,7 @@ void VehicleCrashParticle::Paint(PaintSession& session, int32_t imageDirection) { PROFILED_FUNCTION(); - RenderTarget& rt = session.DPI; + auto& rt = session.DPI; if (rt.zoom_level > ZoomLevel{ 0 }) { return; diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index f520e435c6..9d0d538ab2 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -24,7 +24,6 @@ constexpr int16_t kChatInputSize = 1024; constexpr uint8_t kChatMaxMessageLength = 200; constexpr int16_t kChatMaxWindowWidth = 600; -struct RenderTarget; struct ScreenCoordsXY; enum class ChatInput : uint8_t @@ -36,6 +35,11 @@ enum class ChatInput : uint8_t extern bool gChatOpen; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + bool ChatAvailable(); void ChatOpen(); void ChatClose(); @@ -43,7 +47,7 @@ void ChatToggle(); void ChatInit(); void ChatUpdate(); -void ChatDraw(RenderTarget& rt, OpenRCT2::ColourWithFlags chatBackgroundColour); +void ChatDraw(OpenRCT2::Drawing::RenderTarget& rt, OpenRCT2::ColourWithFlags chatBackgroundColour); void ChatAddHistory(std::string_view s); void ChatInput(ChatInput input); diff --git a/src/openrct2/interface/InteractiveConsole.h b/src/openrct2/interface/InteractiveConsole.h index 842c5a07b1..edfb315b7a 100644 --- a/src/openrct2/interface/InteractiveConsole.h +++ b/src/openrct2/interface/InteractiveConsole.h @@ -13,8 +13,6 @@ #include #include -struct RenderTarget; - enum class ConsoleInput : uint8_t { None, @@ -32,6 +30,11 @@ namespace OpenRCT2 struct TextInputSession; } // namespace OpenRCT2 +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + class InteractiveConsole { private: diff --git a/src/openrct2/interface/Screenshot.h b/src/openrct2/interface/Screenshot.h index d4214dcef7..2aa0a514cf 100644 --- a/src/openrct2/interface/Screenshot.h +++ b/src/openrct2/interface/Screenshot.h @@ -17,8 +17,6 @@ #include #include -struct RenderTarget; - extern uint8_t gScreenshotCountdown; struct ScreenshotOptions @@ -53,9 +51,14 @@ struct CaptureOptions bool Transparent{}; }; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + void ScreenshotCheck(); std::string ScreenshotDump(); -std::string ScreenshotDumpPNG(RenderTarget& rt); +std::string ScreenshotDumpPNG(OpenRCT2::Drawing::RenderTarget& rt); void ScreenshotGiant(); int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOptions* options); diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index 4b0fce617f..ca3e52cb7b 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -19,12 +19,16 @@ struct PaintSession; struct PaintStruct; -struct RenderTarget; struct EntityBase; struct Guest; struct Staff; struct PaintEntry; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + namespace OpenRCT2 { struct TileElement; @@ -196,7 +200,7 @@ namespace OpenRCT2 void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest& peep); void ViewportRotateSingle(WindowBase* window, int32_t direction); void ViewportRotateAll(int32_t direction); - void ViewportRender(RenderTarget& rt, const Viewport* viewport); + void ViewportRender(OpenRCT2::Drawing::RenderTarget& rt, const Viewport* viewport); CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords, uint8_t rotation); diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 51c333da59..ae6cd13897 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -73,8 +73,10 @@ static constexpr float kWindowScrollLocations[][2] = { }; // clang-format on - static void WindowDrawCore(RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom); - static void WindowDrawSingle(RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom); + static void WindowDrawCore( + Drawing::RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom); + static void WindowDrawSingle( + Drawing::RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom); std::vector>::iterator WindowGetIterator(const WindowBase* w) { @@ -487,7 +489,7 @@ static constexpr float kWindowScrollLocations[][2] = { * Splits a drawing of a window into regions that can be seen and are not hidden * by other opaque overlapping windows. */ - void WindowDraw(RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom) + void WindowDraw(Drawing::RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom) { if (!w.isVisible) return; @@ -544,7 +546,8 @@ static constexpr float kWindowScrollLocations[][2] = { /** * Draws the given window and any other overlapping transparent windows. */ - static void WindowDrawCore(RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom) + static void WindowDrawCore( + Drawing::RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom) { // Clamp region left = std::max(left, w.windowPos.x); @@ -569,11 +572,13 @@ static constexpr float kWindowScrollLocations[][2] = { } } - static void WindowDrawSingle(RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom) + static void WindowDrawSingle( + Drawing::RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom) { assert(rt.zoom_level == ZoomLevel{ 0 }); + // Copy render target so we can crop it - RenderTarget copy = rt; + Drawing::RenderTarget copy = rt; // Clamp left to 0 int32_t overflow = left - copy.x; @@ -852,7 +857,7 @@ static constexpr float kWindowScrollLocations[][2] = { * right (dx) * bottom (bp) */ - void WindowDrawAll(RenderTarget& rt, int32_t left, int32_t top, int32_t right, int32_t bottom) + void WindowDrawAll(Drawing::RenderTarget& rt, int32_t left, int32_t top, int32_t right, int32_t bottom) { auto windowRT = rt.Crop({ left, top }, { right - left, bottom - top }); WindowVisitEach([&windowRT, left, top, right, bottom](WindowBase* w) { diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 0415158f67..e5dd911b49 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -22,13 +22,17 @@ #include #include -struct RenderTarget; struct TrackDesignFileRef; struct ScenarioIndexEntry; enum class CursorID : uint8_t; enum class CloseWindowModifier : uint8_t; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + namespace OpenRCT2 { using WindowNumber = int16_t; @@ -308,8 +312,8 @@ namespace OpenRCT2 void WindowCheckAllValidZoom(); void WindowZoomSet(WindowBase& w, ZoomLevel zoomLevel, bool atCursor); - void WindowDrawAll(RenderTarget& rt, int32_t left, int32_t top, int32_t right, int32_t bottom); - void WindowDraw(RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom); + void WindowDrawAll(Drawing::RenderTarget& rt, int32_t left, int32_t top, int32_t right, int32_t bottom); + void WindowDraw(Drawing::RenderTarget& rt, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom); bool isToolActive(WindowClass cls); bool isToolActive(WindowClass cls, WindowNumber number); diff --git a/src/openrct2/interface/WindowBase.h b/src/openrct2/interface/WindowBase.h index 40ca5aab6a..ee1369b9e1 100644 --- a/src/openrct2/interface/WindowBase.h +++ b/src/openrct2/interface/WindowBase.h @@ -161,10 +161,10 @@ namespace OpenRCT2 virtual void onPrepareDraw() { } - virtual void onDraw(RenderTarget& rt) + virtual void onDraw(Drawing::RenderTarget& rt) { } - virtual void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) + virtual void onDrawWidget(WidgetIndex widgetIndex, Drawing::RenderTarget& rt) { } virtual OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) @@ -199,7 +199,7 @@ namespace OpenRCT2 virtual void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { } - virtual void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) + virtual void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) { } virtual void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 2e2503d32c..3abb613db5 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -245,6 +245,7 @@ + @@ -255,6 +256,7 @@ + @@ -836,6 +838,7 @@ + diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 2b373461eb..f310049a7d 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -68,7 +68,7 @@ namespace OpenRCT2 _legacyType.image = 0; } - void BannerObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void BannerObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; diff --git a/src/openrct2/object/BannerObject.h b/src/openrct2/object/BannerObject.h index 96c110d3d7..621b5bbf0e 100644 --- a/src/openrct2/object/BannerObject.h +++ b/src/openrct2/object/BannerObject.h @@ -33,6 +33,6 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/object/ClimateObject.cpp b/src/openrct2/object/ClimateObject.cpp index 7e9ff423a5..6d4364b4d0 100644 --- a/src/openrct2/object/ClimateObject.cpp +++ b/src/openrct2/object/ClimateObject.cpp @@ -52,7 +52,7 @@ namespace OpenRCT2 static RawClimate readWeatherTable(json_t& weather); static Climate convertRawClimate(const RawClimate& rawClimate); - void ClimateObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void ClimateObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { const auto dist = getYearlyDistribution(); const auto totalSize = kNumClimateMonths * kWeatherDistSize; diff --git a/src/openrct2/object/ClimateObject.h b/src/openrct2/object/ClimateObject.h index 3ca67858d6..1607bbc14c 100644 --- a/src/openrct2/object/ClimateObject.h +++ b/src/openrct2/object/ClimateObject.h @@ -31,7 +31,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; const TemperatureThresholds& getItemThresholds() const; const WeatherPattern& getPatternForMonth(uint8_t month) const; diff --git a/src/openrct2/object/EntranceObject.cpp b/src/openrct2/object/EntranceObject.cpp index cb7ad7c51b..46ccb74a91 100644 --- a/src/openrct2/object/EntranceObject.cpp +++ b/src/openrct2/object/EntranceObject.cpp @@ -45,7 +45,7 @@ namespace OpenRCT2 _legacyType.image_id = 0; } - void EntranceObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void EntranceObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; GfxDrawSprite(rt, ImageId(_legacyType.image_id + 1), screenCoords + ScreenCoordsXY{ -32, 14 }); diff --git a/src/openrct2/object/EntranceObject.h b/src/openrct2/object/EntranceObject.h index c1cc6722db..6203acb2f5 100644 --- a/src/openrct2/object/EntranceObject.h +++ b/src/openrct2/object/EntranceObject.h @@ -34,7 +34,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; ImageIndex GetImage(uint8_t sequence, Direction direction) const; uint8_t GetScrollingMode() const; diff --git a/src/openrct2/object/FootpathObject.cpp b/src/openrct2/object/FootpathObject.cpp index 4c52b16207..03deac49c8 100644 --- a/src/openrct2/object/FootpathObject.cpp +++ b/src/openrct2/object/FootpathObject.cpp @@ -70,7 +70,7 @@ namespace OpenRCT2 _legacyType.image = 0; } - void FootpathObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void FootpathObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; GfxDrawSprite(rt, ImageId(_pathSurfaceDescriptor.PreviewImage), screenCoords - ScreenCoordsXY{ 49, 17 }); diff --git a/src/openrct2/object/FootpathObject.h b/src/openrct2/object/FootpathObject.h index fbfa964024..4f9298a12d 100644 --- a/src/openrct2/object/FootpathObject.h +++ b/src/openrct2/object/FootpathObject.h @@ -56,6 +56,6 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/object/FootpathRailingsObject.cpp b/src/openrct2/object/FootpathRailingsObject.cpp index 9784fe917e..4e78a6d001 100644 --- a/src/openrct2/object/FootpathRailingsObject.cpp +++ b/src/openrct2/object/FootpathRailingsObject.cpp @@ -49,7 +49,7 @@ namespace OpenRCT2 RailingsImageId = 0; } - void FootpathRailingsObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void FootpathRailingsObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto x = width / 2; auto y = height / 2; diff --git a/src/openrct2/object/FootpathRailingsObject.h b/src/openrct2/object/FootpathRailingsObject.h index 46e960ee08..8a18064f0b 100644 --- a/src/openrct2/object/FootpathRailingsObject.h +++ b/src/openrct2/object/FootpathRailingsObject.h @@ -34,7 +34,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; const PathRailingsDescriptor& GetDescriptor() const { diff --git a/src/openrct2/object/FootpathSurfaceObject.cpp b/src/openrct2/object/FootpathSurfaceObject.cpp index 5348c585b8..0e310d3a19 100644 --- a/src/openrct2/object/FootpathSurfaceObject.cpp +++ b/src/openrct2/object/FootpathSurfaceObject.cpp @@ -46,7 +46,7 @@ namespace OpenRCT2 BaseImageId = 0; } - void FootpathSurfaceObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void FootpathSurfaceObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2 - 16, height / 2 }; GfxDrawSprite(rt, ImageId(BaseImageId + 3), screenCoords); diff --git a/src/openrct2/object/FootpathSurfaceObject.h b/src/openrct2/object/FootpathSurfaceObject.h index 73089ae4f8..d3647019d3 100644 --- a/src/openrct2/object/FootpathSurfaceObject.h +++ b/src/openrct2/object/FootpathSurfaceObject.h @@ -30,7 +30,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; void SetRepositoryItem(ObjectRepositoryItem* item) const override; diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index 8d6ad1fb06..bc34542074 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -143,7 +143,7 @@ namespace OpenRCT2 _baseImageId = _legacyType.image = 0; } - void LargeSceneryObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void LargeSceneryObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, (height / 2) - 39 }; diff --git a/src/openrct2/object/LargeSceneryObject.h b/src/openrct2/object/LargeSceneryObject.h index db3745fb02..186382e4e2 100644 --- a/src/openrct2/object/LargeSceneryObject.h +++ b/src/openrct2/object/LargeSceneryObject.h @@ -38,7 +38,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; private: [[nodiscard]] static std::vector ReadTiles(OpenRCT2::IStream* stream); diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index 5d90c86cbf..3555d54225 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -86,7 +86,7 @@ namespace OpenRCT2 NameStringId = 0; } - void MusicObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void MusicObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { // Write (no image) int32_t x = width / 2; diff --git a/src/openrct2/object/MusicObject.h b/src/openrct2/object/MusicObject.h index a9f28fea9b..ae266cffb1 100644 --- a/src/openrct2/object/MusicObject.h +++ b/src/openrct2/object/MusicObject.h @@ -63,7 +63,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; bool HasPreview() const; std::optional GetOriginalStyleId() const; diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 9f4ca2da55..81ea8d2b28 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -22,9 +22,13 @@ #include #include -struct RenderTarget; using ride_type_t = uint16_t; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} + namespace OpenRCT2 { struct ObjectRepositoryItem; @@ -292,7 +296,7 @@ namespace OpenRCT2 virtual void Load() = 0; virtual void Unload() = 0; - virtual void DrawPreview(RenderTarget& /*rt*/, int32_t /*width*/, int32_t /*height*/) const + virtual void DrawPreview(Drawing::RenderTarget& /*rt*/, int32_t /*width*/, int32_t /*height*/) const { } diff --git a/src/openrct2/object/ObjectRepository.h b/src/openrct2/object/ObjectRepository.h index a9b951f0cf..4feb8c1576 100644 --- a/src/openrct2/object/ObjectRepository.h +++ b/src/openrct2/object/ObjectRepository.h @@ -15,7 +15,6 @@ #include #include -struct RenderTarget; enum class RideCategory : uint8_t; namespace OpenRCT2::Localisation diff --git a/src/openrct2/object/PathAdditionObject.cpp b/src/openrct2/object/PathAdditionObject.cpp index 1403113e7f..c86b0ffe00 100644 --- a/src/openrct2/object/PathAdditionObject.cpp +++ b/src/openrct2/object/PathAdditionObject.cpp @@ -73,7 +73,7 @@ namespace OpenRCT2 _legacyType.image = 0; } - void PathAdditionObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void PathAdditionObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; GfxDrawSprite(rt, ImageId(_legacyType.image), screenCoords - ScreenCoordsXY{ 22, 24 }); diff --git a/src/openrct2/object/PathAdditionObject.h b/src/openrct2/object/PathAdditionObject.h index f2d57737b6..f96b19fd4b 100644 --- a/src/openrct2/object/PathAdditionObject.h +++ b/src/openrct2/object/PathAdditionObject.h @@ -32,6 +32,6 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/object/PeepAnimationsObject.cpp b/src/openrct2/object/PeepAnimationsObject.cpp index 4e25f3ea32..040d208924 100644 --- a/src/openrct2/object/PeepAnimationsObject.cpp +++ b/src/openrct2/object/PeepAnimationsObject.cpp @@ -205,7 +205,7 @@ namespace OpenRCT2 return _animationGroups[EnumValue(animGroup)].isSlowWalking; } - void PeepAnimationsObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void PeepAnimationsObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto centre = ScreenCoordsXY{ width / 2, height / 2 }; diff --git a/src/openrct2/object/PeepAnimationsObject.h b/src/openrct2/object/PeepAnimationsObject.h index 0840e973f7..6373d6f4d3 100644 --- a/src/openrct2/object/PeepAnimationsObject.h +++ b/src/openrct2/object/PeepAnimationsObject.h @@ -57,7 +57,7 @@ namespace OpenRCT2 return _noRandomPlacement; } - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; void SetRepositoryItem(ObjectRepositoryItem* item) const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 5294198677..a0201d6157 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -376,7 +376,8 @@ namespace OpenRCT2 _legacyType.images_offset = 0; } - void RideObject::DrawPreview(RenderTarget& rt, [[maybe_unused]] int32_t width, [[maybe_unused]] int32_t height) const + void RideObject::DrawPreview( + Drawing::RenderTarget& rt, [[maybe_unused]] int32_t width, [[maybe_unused]] int32_t height) const { uint32_t imageId = _legacyType.images_offset; diff --git a/src/openrct2/object/RideObject.h b/src/openrct2/object/RideObject.h index ea2833de28..8b159a445c 100644 --- a/src/openrct2/object/RideObject.h +++ b/src/openrct2/object/RideObject.h @@ -47,7 +47,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; std::string GetDescription() const; std::string GetCapacity() const; diff --git a/src/openrct2/object/SceneryGroupObject.cpp b/src/openrct2/object/SceneryGroupObject.cpp index 399c451896..afd52871b8 100644 --- a/src/openrct2/object/SceneryGroupObject.cpp +++ b/src/openrct2/object/SceneryGroupObject.cpp @@ -70,7 +70,7 @@ namespace OpenRCT2 _legacyType.image = 0; } - void SceneryGroupObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void SceneryGroupObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; diff --git a/src/openrct2/object/SceneryGroupObject.h b/src/openrct2/object/SceneryGroupObject.h index b669f1d560..14cbd73330 100644 --- a/src/openrct2/object/SceneryGroupObject.h +++ b/src/openrct2/object/SceneryGroupObject.h @@ -38,7 +38,7 @@ namespace OpenRCT2 void Unload() override; void UpdateEntryIndexes(); - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; void SetRepositoryItem(ObjectRepositoryItem* item) const override; diff --git a/src/openrct2/object/SmallSceneryObject.cpp b/src/openrct2/object/SmallSceneryObject.cpp index d305547404..77d9ca50ac 100644 --- a/src/openrct2/object/SmallSceneryObject.cpp +++ b/src/openrct2/object/SmallSceneryObject.cpp @@ -98,7 +98,7 @@ namespace OpenRCT2 _legacyType.image = 0; } - void SmallSceneryObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void SmallSceneryObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto imageId = ImageId(_legacyType.image); if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) diff --git a/src/openrct2/object/SmallSceneryObject.h b/src/openrct2/object/SmallSceneryObject.h index 6bb3325050..b66a1fdd99 100644 --- a/src/openrct2/object/SmallSceneryObject.h +++ b/src/openrct2/object/SmallSceneryObject.h @@ -36,7 +36,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; private: static std::vector ReadFrameOffsets(IStream* stream); diff --git a/src/openrct2/object/StationObject.cpp b/src/openrct2/object/StationObject.cpp index 7bfbb30f71..3cace4d106 100644 --- a/src/openrct2/object/StationObject.cpp +++ b/src/openrct2/object/StationObject.cpp @@ -46,7 +46,7 @@ namespace OpenRCT2 ShelterImageId = kImageIndexUndefined; } - void StationObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void StationObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, (height / 2) + 16 }; diff --git a/src/openrct2/object/StationObject.h b/src/openrct2/object/StationObject.h index e506f02a68..ace3d0fa42 100644 --- a/src/openrct2/object/StationObject.h +++ b/src/openrct2/object/StationObject.h @@ -39,6 +39,6 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/object/TerrainEdgeObject.cpp b/src/openrct2/object/TerrainEdgeObject.cpp index 05bb847fa7..829969e2ab 100644 --- a/src/openrct2/object/TerrainEdgeObject.cpp +++ b/src/openrct2/object/TerrainEdgeObject.cpp @@ -39,7 +39,7 @@ namespace OpenRCT2 BaseImageId = 0; } - void TerrainEdgeObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void TerrainEdgeObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; diff --git a/src/openrct2/object/TerrainEdgeObject.h b/src/openrct2/object/TerrainEdgeObject.h index 53768dc8cb..05b5681b26 100644 --- a/src/openrct2/object/TerrainEdgeObject.h +++ b/src/openrct2/object/TerrainEdgeObject.h @@ -30,7 +30,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; static TerrainEdgeObject* GetById(ObjectEntryIndex entryIndex); }; diff --git a/src/openrct2/object/TerrainSurfaceObject.cpp b/src/openrct2/object/TerrainSurfaceObject.cpp index ed6b4beb0c..313b997286 100644 --- a/src/openrct2/object/TerrainSurfaceObject.cpp +++ b/src/openrct2/object/TerrainSurfaceObject.cpp @@ -49,7 +49,7 @@ namespace OpenRCT2 NumEntries = 0; } - void TerrainSurfaceObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void TerrainSurfaceObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto imageId = ImageId(GetImageId({}, 1, 0, 0, false, false)); if (Colour != kNoValue) diff --git a/src/openrct2/object/TerrainSurfaceObject.h b/src/openrct2/object/TerrainSurfaceObject.h index 9447706430..103613cdcf 100644 --- a/src/openrct2/object/TerrainSurfaceObject.h +++ b/src/openrct2/object/TerrainSurfaceObject.h @@ -63,7 +63,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; ImageId GetImageId( const CoordsXY& position, uint8_t length, uint8_t rotation, uint8_t offset, bool grid, bool underground) const; diff --git a/src/openrct2/object/WallObject.cpp b/src/openrct2/object/WallObject.cpp index 2482b41a32..00fb704673 100644 --- a/src/openrct2/object/WallObject.cpp +++ b/src/openrct2/object/WallObject.cpp @@ -70,7 +70,7 @@ namespace OpenRCT2 _legacyType.image = 0; } - void WallObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void WallObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; diff --git a/src/openrct2/object/WallObject.h b/src/openrct2/object/WallObject.h index 7dbb50f748..ad31cd996e 100644 --- a/src/openrct2/object/WallObject.h +++ b/src/openrct2/object/WallObject.h @@ -32,6 +32,6 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index cd2cbcd4ee..59c5acd977 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -56,7 +56,7 @@ namespace OpenRCT2 _legacyType.palette_index_2 = 0; } - void WaterObject::DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const + void WaterObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const { // Write (no image) auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; diff --git a/src/openrct2/object/WaterObject.h b/src/openrct2/object/WaterObject.h index e2e4feb8e0..86e15d8751 100644 --- a/src/openrct2/object/WaterObject.h +++ b/src/openrct2/object/WaterObject.h @@ -32,7 +32,7 @@ namespace OpenRCT2 void Load() override; void Unload() override; - void DrawPreview(RenderTarget& rt, int32_t width, int32_t height) const override; + void DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const override; private: void ReadJsonPalette(json_t& jPalette); diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 7301610af1..b48c872911 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -19,6 +19,7 @@ #include "../localisation/Currency.h" #include "../localisation/Formatting.h" #include "../localisation/LocalisationService.h" +#include "../localisation/StringIdType.h" #include "../paint/Painter.h" #include "../platform/Memory.h" #include "../profiling/Profiling.h" @@ -31,6 +32,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; // Globals for paint clipping diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 0b4756b731..f05fb73f4c 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -10,8 +10,11 @@ #pragma once #include "../core/Money.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/FilterPaletteIds.h" +#include "../drawing/ImageId.hpp" +#include "../drawing/RenderTarget.h" #include "../interface/Colour.h" +#include "../localisation/StringIdType.h" #include "../world/Location.hpp" #include "../world/MapLimits.h" #include "Boundbox.h" @@ -193,7 +196,7 @@ struct PaintNodeStorage struct PaintSession : public PaintSessionCore { - RenderTarget DPI; + OpenRCT2::Drawing::RenderTarget DPI; PaintNodeStorage paintEntries; PaintStruct* AllocateNormalPaintEntry() noexcept @@ -249,8 +252,8 @@ extern CoordsXY gClipSelectionA; extern CoordsXY gClipSelectionB; /** rct2: 0x00993CC4. The white ghost that indicates not-yet-built elements. */ -constexpr ImageId ConstructionMarker = ImageId(0).WithRemap(FilterPaletteID::paletteGhost); -constexpr ImageId HighlightMarker = ImageId(0).WithRemap(FilterPaletteID::paletteGhost); +constexpr ImageId ConstructionMarker = ImageId(0).WithRemap(OpenRCT2::Drawing::FilterPaletteID::paletteGhost); +constexpr ImageId HighlightMarker = ImageId(0).WithRemap(OpenRCT2::Drawing::FilterPaletteID::paletteGhost); constexpr ImageId TrackStationColour = ImageId(0, COLOUR_BLACK); constexpr ImageId ShopSupportColour = ImageId(0, COLOUR_DARK_BROWN); @@ -309,9 +312,9 @@ void PaintFloatingMoneyEffect( PaintSession& session, money64 amount, StringId string_id, int32_t y, int32_t z, int8_t y_offsets[], int32_t offset_x, uint32_t rotation); -PaintSession* PaintSessionAlloc(RenderTarget& rt, uint32_t viewFlags, uint8_t rotation); +PaintSession* PaintSessionAlloc(OpenRCT2::Drawing::RenderTarget& rt, uint32_t viewFlags, uint8_t rotation); void PaintSessionFree(PaintSession* session); void PaintSessionGenerate(PaintSession& session); void PaintSessionArrange(PaintSessionCore& session); void PaintDrawStructs(PaintSession& session); -void PaintDrawMoneyStructs(RenderTarget& rt, PaintStringStruct* ps); +void PaintDrawMoneyStructs(OpenRCT2::Drawing::RenderTarget& rt, PaintStringStruct* ps); diff --git a/src/openrct2/paint/PaintHelpers.cpp b/src/openrct2/paint/PaintHelpers.cpp index cdb929c9c0..2f4fab1190 100644 --- a/src/openrct2/paint/PaintHelpers.cpp +++ b/src/openrct2/paint/PaintHelpers.cpp @@ -7,6 +7,7 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "../drawing/Drawing.h" #include "../interface/Viewport.h" #include "../ride/TrackPaint.h" #include "Paint.h" diff --git a/src/openrct2/paint/Painter.h b/src/openrct2/paint/Painter.h index 8721c91996..b3d15e30f1 100644 --- a/src/openrct2/paint/Painter.h +++ b/src/openrct2/paint/Painter.h @@ -16,13 +16,12 @@ #include #include -struct RenderTarget; - namespace OpenRCT2 { namespace Drawing { struct IDrawingEngine; + struct RenderTarget; } // namespace Drawing namespace Ui @@ -46,13 +45,13 @@ namespace OpenRCT2 explicit Painter(Ui::IUiContext& uiContext); void Paint(Drawing::IDrawingEngine& de); - PaintSession* CreateSession(RenderTarget& rt, uint32_t viewFlags, uint8_t rotation); + PaintSession* CreateSession(Drawing::RenderTarget& rt, uint32_t viewFlags, uint8_t rotation); void ReleaseSession(PaintSession* session); ~Painter(); private: - void PaintReplayNotice(RenderTarget& rt, const char* text); - void PaintFPS(RenderTarget& rt); + void PaintReplayNotice(Drawing::RenderTarget& rt, const char* text); + void PaintFPS(Drawing::RenderTarget& rt); void MeasureFPS(); }; } // namespace Paint diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index d26934970d..d25477478d 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -30,6 +30,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; static constexpr uint16_t kVirtualFloorBaseSize = 5 * kCoordsXYStep; static constexpr CoordsXY kVirtualFloorBaseSizeXY = { kVirtualFloorBaseSize, kVirtualFloorBaseSize }; diff --git a/src/openrct2/paint/support/MetalSupports.cpp b/src/openrct2/paint/support/MetalSupports.cpp index ae3a77daf1..b1dc668b11 100644 --- a/src/openrct2/paint/support/MetalSupports.cpp +++ b/src/openrct2/paint/support/MetalSupports.cpp @@ -18,6 +18,7 @@ #include "../Paint.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; constexpr auto kMetalSupportSkip = 9 * 4 * 2; diff --git a/src/openrct2/paint/support/WoodenSupports.cpp b/src/openrct2/paint/support/WoodenSupports.cpp index 41e99b9506..fa6c09672a 100644 --- a/src/openrct2/paint/support/WoodenSupports.cpp +++ b/src/openrct2/paint/support/WoodenSupports.cpp @@ -20,6 +20,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; constexpr auto kNumWoodenSupportTypes = 2; diff --git a/src/openrct2/paint/tile_element/Paint.Banner.cpp b/src/openrct2/paint/tile_element/Paint.Banner.cpp index 741d69d23b..8b77f6741b 100644 --- a/src/openrct2/paint/tile_element/Paint.Banner.cpp +++ b/src/openrct2/paint/tile_element/Paint.Banner.cpp @@ -27,6 +27,7 @@ #include "Paint.TileElement.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; // kBannerBoundBoxes[rotation][0] is for the pole in the back // kBannerBoundBoxes[rotation][1] is for the pole and the banner in the front diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index 9973ffcdd9..a920063aa1 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -33,6 +33,7 @@ #include "Segment.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; // clang-format off diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 945996c1c5..f053c2cdcf 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -47,6 +47,7 @@ #include "Segment.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; bool gPaintWidePathsAsGhost = false; diff --git a/src/openrct2/paint/tile_element/Paint.PathAddition.h b/src/openrct2/paint/tile_element/Paint.PathAddition.h index 6319a3ba3e..195e022fe9 100644 --- a/src/openrct2/paint/tile_element/Paint.PathAddition.h +++ b/src/openrct2/paint/tile_element/Paint.PathAddition.h @@ -10,6 +10,7 @@ #pragma once #include "../../drawing/ImageId.hpp" +#include "../../localisation/StringIdType.h" #include "../Paint.h" #include diff --git a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp index fab527f1a1..e14b864932 100644 --- a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp @@ -24,6 +24,7 @@ #include "Segment.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; static constexpr CoordsXY kLengths[] = { diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index c5edeb085c..8f0b38d7c5 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -15,7 +15,6 @@ #include "../../SpriteIds.h" #include "../../config/Config.h" #include "../../core/Numerics.hpp" -#include "../../drawing/Drawing.h" #include "../../entity/EntityRegistry.h" #include "../../entity/PatrolArea.h" #include "../../entity/Peep.h" @@ -42,6 +41,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; // Needed to make the sign appear above footpaths. static constexpr int16_t ForSaleSignZOffset = 3; diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index 46f699116d..aed518f014 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -14,7 +14,6 @@ #include "../../SpriteIds.h" #include "../../config/Config.h" #include "../../core/Numerics.hpp" -#include "../../drawing/Drawing.h" #include "../../interface/Viewport.h" #include "../../profiling/Profiling.h" #include "../../ride/RideData.h" @@ -36,6 +35,7 @@ #include "Segment.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; static void BlankTilesPaint(PaintSession& session, int32_t x, int32_t y); static void PaintTileElementBase(PaintSession& session, const CoordsXY& origCoords); diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index ae9cf396b6..2c7d927bd1 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -12,7 +12,6 @@ #include "../../Game.h" #include "../../GameState.h" #include "../../config/Config.h" -#include "../../drawing/Drawing.h" #include "../../interface/Colour.h" #include "../../interface/Viewport.h" #include "../../localisation/Formatting.h" @@ -28,6 +27,7 @@ #include "Paint.TileElement.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; static constexpr uint8_t DirectionToDoorImageOffset0[] = { 2, 2, 22, 26, 30, 34, 34, 34, 34, 34, 30, 26, 22, 2, 6, 2, 2, 2, 6, 10, 14, 18, 18, 18, 18, 18, 14, 10, 6, 2, 22, 2, diff --git a/src/openrct2/paint/track/coaster/WoodenRollerCoaster.cpp b/src/openrct2/paint/track/coaster/WoodenRollerCoaster.cpp index ae0a5eb024..15d890dab3 100644 --- a/src/openrct2/paint/track/coaster/WoodenRollerCoaster.cpp +++ b/src/openrct2/paint/track/coaster/WoodenRollerCoaster.cpp @@ -27,6 +27,7 @@ #include "../../track/Support.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; // static constexpr TunnelGroup kTunnelGroup = TunnelGroup::Square; diff --git a/src/openrct2/paint/track/gentle/Dodgems.cpp b/src/openrct2/paint/track/gentle/Dodgems.cpp index 13e7ce1361..ca5e1ba711 100644 --- a/src/openrct2/paint/track/gentle/Dodgems.cpp +++ b/src/openrct2/paint/track/gentle/Dodgems.cpp @@ -18,6 +18,7 @@ #include "../../track/Segment.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; enum { diff --git a/src/openrct2/paint/track/transport/MiniatureRailway.cpp b/src/openrct2/paint/track/transport/MiniatureRailway.cpp index e3517fa882..15a6cb6cc0 100644 --- a/src/openrct2/paint/track/transport/MiniatureRailway.cpp +++ b/src/openrct2/paint/track/transport/MiniatureRailway.cpp @@ -22,6 +22,7 @@ #include "../../track/Support.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; static constexpr TunnelGroup kTunnelGroup = TunnelGroup::Square; diff --git a/src/openrct2/paint/vehicle/Vehicle.ObservationTower.cpp b/src/openrct2/paint/vehicle/Vehicle.ObservationTower.cpp index ee4e07e333..8046a52ed5 100644 --- a/src/openrct2/paint/vehicle/Vehicle.ObservationTower.cpp +++ b/src/openrct2/paint/vehicle/Vehicle.ObservationTower.cpp @@ -62,8 +62,8 @@ namespace OpenRCT2 auto imageId1 = ImageId(baseImageId + 1, vehicle->colours.Body, vehicle->colours.Trim, vehicle->colours.Tertiary); if (vehicle->IsGhost()) { - imageId0 = ImageId(baseImageId + 0).WithRemap(FilterPaletteID::paletteGhost); - imageId1 = ImageId(baseImageId + 1).WithRemap(FilterPaletteID::paletteGhost); + imageId0 = ImageId(baseImageId + 0).WithRemap(Drawing::FilterPaletteID::paletteGhost); + imageId1 = ImageId(baseImageId + 1).WithRemap(Drawing::FilterPaletteID::paletteGhost); } PaintAddImageAsParent(session, imageId0, { 0, 0, z }, { { -11, -11, z + 1 }, { 2, 2, 41 } }); diff --git a/src/openrct2/paint/vehicle/Vehicle.Submarine.cpp b/src/openrct2/paint/vehicle/Vehicle.Submarine.cpp index 483a078625..ec94b6fae8 100644 --- a/src/openrct2/paint/vehicle/Vehicle.Submarine.cpp +++ b/src/openrct2/paint/vehicle/Vehicle.Submarine.cpp @@ -51,8 +51,8 @@ namespace OpenRCT2 auto imageId1 = ImageId(baseImageId + 1, vehicle->colours.Body, vehicle->colours.Trim, vehicle->colours.Tertiary); if (vehicle->IsGhost()) { - imageId0 = ImageId(baseImageId + 0).WithRemap(FilterPaletteID::paletteGhost); - imageId1 = ImageId(baseImageId + 1).WithRemap(FilterPaletteID::paletteGhost); + imageId0 = ImageId(baseImageId + 0).WithRemap(Drawing::FilterPaletteID::paletteGhost); + imageId1 = ImageId(baseImageId + 1).WithRemap(Drawing::FilterPaletteID::paletteGhost); } const auto& bb = VehicleBoundboxes[carEntry->draw_order][OpenRCT2::Entity::Yaw::YawTo16(imageDirection)]; diff --git a/src/openrct2/paint/vehicle/VehiclePaint.cpp b/src/openrct2/paint/vehicle/VehiclePaint.cpp index c16d142812..4f9ad45d48 100644 --- a/src/openrct2/paint/vehicle/VehiclePaint.cpp +++ b/src/openrct2/paint/vehicle/VehiclePaint.cpp @@ -27,6 +27,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Entity::Yaw; #pragma region VehicleBoundboxes diff --git a/src/openrct2/park/ParkPreview.cpp b/src/openrct2/park/ParkPreview.cpp index cd7cbf6f6a..43c7810092 100644 --- a/src/openrct2/park/ParkPreview.cpp +++ b/src/openrct2/park/ParkPreview.cpp @@ -228,7 +228,7 @@ namespace OpenRCT2 drawingEngine->BeginDraw(); - RenderTarget rt{ + Drawing::RenderTarget rt{ .bits = static_cast(image.pixels), .x = 0, .y = 0, @@ -246,7 +246,7 @@ namespace OpenRCT2 return image; } - void drawPreviewImage(const PreviewImage& image, RenderTarget& rt, ScreenCoordsXY screenPos) + void drawPreviewImage(const PreviewImage& image, Drawing::RenderTarget& rt, ScreenCoordsXY screenPos) { G1Element g1temp = {}; g1temp.offset = const_cast(image.pixels); diff --git a/src/openrct2/park/ParkPreview.h b/src/openrct2/park/ParkPreview.h index d53a3fecad..90b6a6d173 100644 --- a/src/openrct2/park/ParkPreview.h +++ b/src/openrct2/park/ParkPreview.h @@ -16,7 +16,10 @@ #include #include -struct RenderTarget; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} namespace OpenRCT2 { @@ -54,5 +57,5 @@ namespace OpenRCT2 struct GameState_t; ParkPreview generatePreviewFromGameState(const GameState_t& gameState); - void drawPreviewImage(const PreviewImage& image, RenderTarget& rt, ScreenCoordsXY screenPos); + void drawPreviewImage(const PreviewImage& image, Drawing::RenderTarget& rt, ScreenCoordsXY screenPos); } // namespace OpenRCT2 diff --git a/src/openrct2/peep/PeepAnimations.cpp b/src/openrct2/peep/PeepAnimations.cpp index dad5851183..ba016cc6fd 100644 --- a/src/openrct2/peep/PeepAnimations.cpp +++ b/src/openrct2/peep/PeepAnimations.cpp @@ -289,7 +289,7 @@ namespace OpenRCT2 uint8_t bitmap[kHeight][kWidth] = { 0 }; - RenderTarget rt = { + Drawing::RenderTarget rt = { .bits = reinterpret_cast(bitmap), .x = -(kWidth / 2), .y = -(kHeight / 2), diff --git a/src/openrct2/ride/CarEntry.cpp b/src/openrct2/ride/CarEntry.cpp index 028978beb8..33736379ff 100644 --- a/src/openrct2/ride/CarEntry.cpp +++ b/src/openrct2/ride/CarEntry.cpp @@ -53,7 +53,7 @@ void CarEntrySetImageMaxSizes(CarEntry& carEntry, int32_t numImages) uint8_t bitmap[kHeight][kWidth] = { 0 }; - RenderTarget rt = { + OpenRCT2::Drawing::RenderTarget rt = { .bits = reinterpret_cast(bitmap), .x = -(kWidth / 2), .y = -(kHeight / 2), diff --git a/src/openrct2/scenes/intro/IntroScene.h b/src/openrct2/scenes/intro/IntroScene.h index 73fcffe0aa..fc8d72a3ba 100644 --- a/src/openrct2/scenes/intro/IntroScene.h +++ b/src/openrct2/scenes/intro/IntroScene.h @@ -13,7 +13,10 @@ #include -struct RenderTarget; +namespace OpenRCT2::Drawing +{ + struct RenderTarget; +} namespace OpenRCT2 { @@ -43,5 +46,5 @@ namespace OpenRCT2 bool IntroIsPlaying(); void IntroUpdate(); - void IntroDraw(RenderTarget& rt); + void IntroDraw(Drawing::RenderTarget& rt); } // namespace OpenRCT2 diff --git a/src/openrct2/ui/UiContext.h b/src/openrct2/ui/UiContext.h index 3dfe29b190..f422809635 100644 --- a/src/openrct2/ui/UiContext.h +++ b/src/openrct2/ui/UiContext.h @@ -18,7 +18,6 @@ #include struct ScreenCoordsXY; -struct RenderTarget; struct ITitleSequencePlayer; namespace OpenRCT2 @@ -27,9 +26,9 @@ namespace OpenRCT2 { struct IDrawingEngineFactory; struct IWeatherDrawer; + struct RenderTarget; using DrawWeatherFunc = void (*)( - RenderTarget& rt, OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, - int32_t height); + RenderTarget& rt, IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height); } // namespace Drawing namespace Ui @@ -106,7 +105,7 @@ namespace OpenRCT2 virtual void InitialiseScriptExtensions() = 0; virtual void Tick() = 0; - virtual void Draw(RenderTarget& rt) = 0; + virtual void Draw(Drawing::RenderTarget& rt) = 0; // Window virtual void CreateWindow() = 0; @@ -156,7 +155,7 @@ namespace OpenRCT2 // Drawing [[nodiscard]] virtual std::shared_ptr GetDrawingEngineFactory() = 0; virtual void DrawWeatherAnimation( - OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer, RenderTarget& rt, OpenRCT2::Drawing::DrawWeatherFunc drawFunc) + Drawing::IWeatherDrawer* weatherDrawer, Drawing::RenderTarget& rt, Drawing::DrawWeatherFunc drawFunc) = 0; // Text input diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index 11ed1c07cd..4110274125 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -30,6 +30,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Audio; struct WeatherTrait diff --git a/src/openrct2/world/Climate.h b/src/openrct2/world/Climate.h index 7b93fa5dc6..013676b7b8 100644 --- a/src/openrct2/world/Climate.h +++ b/src/openrct2/world/Climate.h @@ -85,7 +85,10 @@ void ClimateUpdateSound(); void ClimateStopWeatherSound(); void ClimateForceWeather(WeatherType weather); -enum class FilterPaletteID : int32_t; +namespace OpenRCT2::Drawing +{ + enum class FilterPaletteID : int32_t; +} bool ClimateIsRaining(); bool ClimateTransitioningToSnow(); @@ -94,5 +97,5 @@ bool ClimateIsSnowingHeavily(); bool ClimateIsPrecipitating(); bool WeatherIsDry(WeatherType); bool ClimateHasWeatherEffect(); -FilterPaletteID ClimateGetWeatherGloomPaletteId(const WeatherState& state); +OpenRCT2::Drawing::FilterPaletteID ClimateGetWeatherGloomPaletteId(const WeatherState& state); uint32_t ClimateGetWeatherSpriteId(const WeatherType weatherType);