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

Function draw

src/OpenLoco/src/Ui/Windows/TimePanel.cpp:151–190  ·  view source on GitHub ↗

0x004397BE

Source from the content-addressed store, hash-verified

149
150 // 0x004397BE
151 static void draw(Ui::Window& self, Gfx::DrawingContext& drawingCtx)
152 {
153 auto tr = Gfx::TextRenderer(drawingCtx);
154
155 Widget& frame = self.widgets[Widx::outer_frame];
156 drawingCtx.drawRect(self.x + frame.left, self.y + frame.top, frame.width(), frame.height(), enumValue(ExtColour::unk34), Gfx::RectFlags::transparent);
157
158 // Draw widgets.
159 self.draw(drawingCtx);
160
161 drawingCtx.drawRectInset(self.x + frame.left + 1, self.y + frame.top + 1, frame.width() - 2, frame.height() - 2, self.getColour(WindowColour::secondary), Gfx::RectInsetFlags::borderInset | Gfx::RectInsetFlags::fillNone);
162
163 FormatArguments args{};
164 args.push<uint32_t>(getCurrentDay());
165
166 // Show "* Paused *" instead of the date half the time when paused, unless the browse prompt is pausing the game.
167 StringId format = StringIds::date_daymonthyear;
168 if (SceneManager::isPaused() && (SceneManager::getPauseFlags() & PauseFlags::browsePrompt) == PauseFlags::none)
169 {
170 if (self.numTicksVisible >= kPausedStatusTextDuration)
171 {
172 format = StringIds::toolbar_status_paused;
173 }
174 }
175
176 auto c = self.getColour(WindowColour::primary).opaque();
177 if (Input::isHovering(WindowType::timeToolbar, 0, Widx::date_btn))
178 {
179 c = Colour::white;
180 }
181
182 {
183 auto& widget = _widgets[Widx::date_btn];
184 auto point = Point(self.x + widget.midX(), self.y + widget.top + 1);
185 tr.drawStringCentred(point, c, format, args);
186 }
187
188 auto skin = ObjectManager::get<InterfaceSkinObject>();
189 drawingCtx.drawImage(self.x + _widgets[Widx::map_chat_menu].left - 2, self.y + _widgets[Widx::map_chat_menu].top - 1, skin->img + map_sprites_by_rotation[WindowManager::getCurrentRotation()]);
190 }
191
192 // 0x004398FB
193 static void onMouseUp([[maybe_unused]] Ui::Window& window, WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)

Callers

nothing calls this directly

Calls 15

TextRendererClass · 0.85
enumValueFunction · 0.85
getCurrentDayFunction · 0.85
getPauseFlagsFunction · 0.85
isHoveringFunction · 0.85
getCurrentRotationFunction · 0.85
getColourMethod · 0.80
opaqueMethod · 0.80
midXMethod · 0.80
drawStringCentredMethod · 0.80
isPausedFunction · 0.50
drawRectMethod · 0.45

Tested by

no test coverage detected