| 230 | } |
| 231 | |
| 232 | void updateLoadingScreen(real_t progress) { |
| 233 | std::lock_guard<std::mutex> lock(loading_mutex); |
| 234 | auto loading_frame = gui->findFrame("loading_frame"); |
| 235 | if (!loading_frame) |
| 236 | { |
| 237 | return; |
| 238 | } |
| 239 | |
| 240 | #if 0 |
| 241 | // update red progress bar (deprecated) |
| 242 | auto progress_filled = loading_frame->findImage("progress_filled"); |
| 243 | if (progress_filled) |
| 244 | { |
| 245 | progress_filled->pos = SDL_Rect{0, |
| 246 | Frame::virtualScreenY - 64, |
| 247 | (int)((Frame::virtualScreenX * progress) / (real_t)100), |
| 248 | 64}; |
| 249 | } |
| 250 | |
| 251 | // update percentage text (deprecated) |
| 252 | auto text = loading_frame->findField("text"); |
| 253 | if (text) { |
| 254 | char buf[8]; |
| 255 | snprintf(buf, sizeof(buf), "%d%%", (int)progress); |
| 256 | text->setText(buf); |
| 257 | } |
| 258 | #endif |
| 259 | |
| 260 | // update loading bar |
| 261 | auto loading_bar = loading_frame->findFrame("loading_bar"); |
| 262 | if (loading_bar) { |
| 263 | const int size = ((int)progress * 1062) / 100; |
| 264 | |
| 265 | // gas |
| 266 | auto gas = loading_bar->findImage("gas"); |
| 267 | if (gas) { |
| 268 | gas->pos.w = size; |
| 269 | } |
| 270 | |
| 271 | // bubbles |
| 272 | auto bubbles = loading_bar->findImage("bubbles"); |
| 273 | if (bubbles) { |
| 274 | bubbles->pos.w = size; |
| 275 | } |
| 276 | |
| 277 | // gungnir |
| 278 | auto gungnir = loading_bar->findImage("gungnir"); |
| 279 | if (gungnir) { |
| 280 | gungnir->pos.x = size - 16; |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | void destroyLoadingScreen() { |
| 286 | std::lock_guard<std::mutex> lock(loading_mutex); |
no test coverage detected