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

Method update

game/ui/components/equipscreen.cpp:61–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void EquipmentPaperDoll::update()
62{
63 // Only draw highlight if one of the colours isn't 100% transparent
64 if (slotHighlightColours[0].a != 0 || slotHighlightColours[1].a != 0)
65 {
66 this->slotHighlightCounter += slotHighlightIncrement;
67 while (this->slotHighlightCounter > 2.0f * M_PI)
68 {
69 this->slotHighlightCounter -= 2.0f * M_PI;
70 }
71 // Scale the sin curve from (-1, 1) to (0, 1)
72 float glowFactor = (sin(this->slotHighlightCounter) + 1.0f) / 2.0f;
73
74 this->highlightColour.r =
75 mix(slotHighlightColours[0].r, slotHighlightColours[1].r, glowFactor);
76 this->highlightColour.g =
77 mix(slotHighlightColours[0].g, slotHighlightColours[1].g, glowFactor);
78 this->highlightColour.b =
79 mix(slotHighlightColours[0].b, slotHighlightColours[1].b, glowFactor);
80 this->highlightColour.a =
81 mix(slotHighlightColours[0].a, slotHighlightColours[1].a, glowFactor);
82
83 this->setDirty();
84 }
85}
86
87static const EquipmentLayoutSlot *getSlotAtPosition(Vec2<int> pos,
88 const std::list<EquipmentLayoutSlot> &slots)

Callers

nothing calls this directly

Calls 2

mixFunction · 0.85
setDirtyMethod · 0.80

Tested by

no test coverage detected