MCPcopy Create free account
hub / github.com/EasyRPG/Player / SetBattler

Method SetBattler

src/window_actorsp.cpp:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void Window_ActorSp::SetBattler(const Game_Battler& battler) {
32 int cx = 0;
33
34 int digits = (battler.MaxSpValue() >= 1000) ? 4 : 3;
35
36 int color = Font::ColorDefault;
37 if (battler.GetMaxSp() != 0 && battler.GetSp() <= battler.GetMaxSp() / 4) {
38 color = Font::ColorCritical;
39 }
40
41 contents->Clear();
42
43 // Draw current Sp
44 contents->TextDraw(cx + digits * 6, 2, color, std::to_string(battler.GetSp()), Text::AlignRight);
45
46 // Draw /
47 cx += digits * 6;
48 contents->TextDraw(cx, 2, Font::ColorDefault, "/");
49
50 // Draw Max Sp
51 cx += 6;
52 contents->TextDraw(cx + digits * 6, 2, Font::ColorDefault, std::to_string(battler.GetMaxSp()), Text::AlignRight);
53}

Callers

nothing calls this directly

Calls 5

GetMaxSpMethod · 0.80
TextDrawMethod · 0.80
MaxSpValueMethod · 0.45
GetSpMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected