MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / fillBaseBar

Method fillBaseBar

game/ui/base/recruitscreen.cpp:349–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void RecruitScreen::fillBaseBar(int percent)
350{
351 auto facilityBar = form->findControlTyped<Graphic>("FACILITY_FIRST_FILL");
352 facilityBar->setVisible(true);
353
354 auto progressImage = mksp<RGBImage>(facilityBar->Size);
355 int redHeight = progressImage->size.y * std::min(100, percent) / 100;
356 {
357 // FIXME: For some reason, there's no border here like in the research screen, so we
358 // have to make one manually, probably there's a better way
359 RGBImageLock l(progressImage);
360 for (int x = 0; x < 2; x++)
361 {
362 for (int y = 1; y <= progressImage->size.y; y++)
363 {
364 if (y < redHeight)
365 {
366 l.set({x, progressImage->size.y - y}, {255, 0, 0, 255});
367 }
368 }
369 }
370 }
371 facilityBar->setImage(progressImage);
372}
373
374/**
375 * Display stats of an agent

Callers

nothing calls this directly

Calls 3

setVisibleMethod · 0.45
setMethod · 0.45
setImageMethod · 0.45

Tested by

no test coverage detected