MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / drawDatDetails

Function drawDatDetails

src/OpenLoco/src/Ui/Windows/ObjectSelectionWindow.cpp:956–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954 }
955
956 static void drawDatDetails(const ObjectManager::ObjectIndexEntry& indexEntry, Window* self, Gfx::DrawingContext& drawingCtx, int16_t x, int16_t y)
957 {
958 int16_t width = self->x + self->width - x;
959 int16_t height = self->y + self->height - y;
960
961 // Clip the draw area to simplify image draw
962 const auto& rt = drawingCtx.currentRenderTarget();
963 auto clipped = Gfx::clipRenderTarget(rt, Ui::Rect(x, y, width, height));
964 if (!clipped)
965 {
966 return;
967 }
968
969 drawingCtx.pushRenderTarget(*clipped);
970
971 auto tr = Gfx::TextRenderer(drawingCtx);
972
973 // Draw object filename
974 {
975 auto filename = fs::u8path(indexEntry._filepath).filename().u8string();
976 auto buffer = const_cast<char*>(StringManager::getString(StringIds::buffer_1250));
977 strncpy(buffer, filename.c_str(), filename.length() + 1);
978
979 FormatArguments args{};
980 args.push<StringId>(StringIds::buffer_1250);
981
982 auto point = Point(18, height - kDescriptionRowHeight * 3 - 4);
983 tr.drawStringLeft(point, Colour::black, StringIds::object_selection_filename, args);
984 }
985
986 drawingCtx.popRenderTarget();
987 }
988
989 static void drawSearchBox(Window& self, Gfx::DrawingContext& drawingCtx)
990 {

Callers 1

drawFunction · 0.85

Calls 7

clipRenderTargetFunction · 0.85
RectClass · 0.85
TextRendererClass · 0.85
getStringFunction · 0.85
pushRenderTargetMethod · 0.80
drawStringLeftMethod · 0.80
popRenderTargetMethod · 0.80

Tested by

no test coverage detected