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

Function prepareDraw

src/OpenLoco/src/Ui/Windows/Options.cpp:108–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 };
107
108 static void prepareDraw(Window& self)
109 {
110 self.activatedWidgets = 1ULL << (self.currentTab + 4);
111 self.disabledWidgets = 0;
112
113 self.widgets[Widx::frame].right = self.width - 1;
114 self.widgets[Widx::frame].bottom = self.height - 1;
115 self.widgets[Widx::panel].right = self.width - 1;
116 self.widgets[Widx::panel].bottom = self.height - 1;
117 self.widgets[Widx::caption].right = self.width - 2;
118 self.widgets[Widx::close_button].left = self.width - 15;
119 self.widgets[Widx::close_button].right = self.width - 15 + 12;
120
121 disableTabsByCurrentScene(self);
122
123 const auto* skin = ObjectManager::get<InterfaceSkinObject>();
124
125 // Rendering tab
126 {
127 static constexpr uint32_t kRedenderingTabImageIds[] = {
128 InterfaceSkin::ImageIds::tab_colour_scheme_frame0,
129 InterfaceSkin::ImageIds::tab_colour_scheme_frame1,
130 InterfaceSkin::ImageIds::tab_colour_scheme_frame2,
131 InterfaceSkin::ImageIds::tab_colour_scheme_frame3,
132 InterfaceSkin::ImageIds::tab_colour_scheme_frame4,
133 InterfaceSkin::ImageIds::tab_colour_scheme_frame5,
134 InterfaceSkin::ImageIds::tab_colour_scheme_frame6,
135 InterfaceSkin::ImageIds::tab_colour_scheme_frame7,
136 };
137
138 uint32_t imageId = skin->img;
139 if (self.currentTab == tab::rendering)
140 {
141 imageId += kRedenderingTabImageIds[(self.frameNo / 4) % std::size(kRedenderingTabImageIds)];
142 }
143 else
144 {
145 imageId += kRedenderingTabImageIds[0];
146 }
147
148 self.widgets[Widx::tab_rendering].image = imageId;
149 }
150
151 static constexpr uint32_t globe_tab_ids[] = {
152 ImageIds::tab_globe_0,
153 ImageIds::tab_globe_1,
154 ImageIds::tab_globe_2,
155 ImageIds::tab_globe_3,
156 ImageIds::tab_globe_4,
157 ImageIds::tab_globe_5,
158 ImageIds::tab_globe_6,
159 ImageIds::tab_globe_7,
160 ImageIds::tab_globe_8,
161 ImageIds::tab_globe_9,
162 ImageIds::tab_globe_10,
163 ImageIds::tab_globe_11,
164 ImageIds::tab_globe_12,
165 ImageIds::tab_globe_13,

Callers

nothing calls this directly

Calls 15

screenModeToggleEnabledFunction · 0.85
enumValueFunction · 0.85
getCurrentDeviceNameFunction · 0.85
isTitleModeFunction · 0.85
getStringFunction · 0.85
ImageIdClass · 0.85
loadPreferredFaceFunction · 0.85
toUInt32Method · 0.80
withPrimaryMethod · 0.80
withIndexOffsetMethod · 0.80

Tested by

no test coverage detected