MCPcopy Create free account
hub / github.com/Cpasjuste/pplay / Battery

Method Battery

src/status_bar.cpp:26–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24public:
25
26 explicit Battery(const FloatRect &rect, const Vector2f &scaling) : RectangleShape({0, 0}) {
27
28 float outline = std::ceil(scaling.x);
29 Battery::setFillColor(Color::Transparent);
30 Battery::setOutlineColor(COLOR_FONT);
31 Battery::setOutlineThickness(outline);
32 Battery::setOrigin(Origin::Right);
33 Battery::setPosition((rect.width - (8 * scaling.x)) + outline, (rect.height / 2) + outline);
34 Battery::setSize(32 * scaling.x, rect.height - (scaling.y * 16));
35
36 maxWidth = Battery::getSize().x - (4 * scaling.x);
37 Vector2f size = {maxWidth, Battery::getSize().y - (4 * scaling.y)};
38 batteryRect = new RectangleShape(size);
39 batteryRect->setFillColor(COLOR_FONT);
40 batteryRect->setOrigin(Origin::Right);
41 batteryRect->setPosition(Battery::getSize().x - (2 * scaling.x),
42 (Battery::getSize().y + (outline / 2)) / 2);
43 Battery::add(batteryRect);
44
45 auto leftRect = new RectangleShape({scaling.x * 6, rect.height / 3});
46 leftRect->setFillColor(COLOR_FONT);
47 leftRect->setOrigin(Origin::Right);
48 leftRect->setPosition(0, batteryRect->getPosition().y);
49 Battery::add(leftRect);
50 }
51
52 void onUpdate() override {
53

Callers

nothing calls this directly

Calls 2

getPositionMethod · 0.80
setFillColorMethod · 0.45

Tested by

no test coverage detected