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

Method onRender

forms/ticker.cpp:27–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25void Ticker::eventOccured(Event *e) { Control::eventOccured(e); }
26
27void Ticker::onRender()
28{
29 Control::onRender();
30
31 int xpos;
32 int ypos;
33 if (!animating)
34 {
35 xpos = align(TextHAlign, Size.x, font->getFontWidth(text));
36 ypos = 0;
37
38 auto textImage = font->getString(text);
39 fw().renderer->draw(textImage, Vec2<float>{xpos, ypos});
40 }
41 else
42 {
43 UString out = text;
44 xpos = align(TextHAlign, Size.x, font->getFontWidth(out));
45 ypos = 0 - animTimer / 4;
46 auto outImage = font->getString(out);
47 fw().renderer->draw(outImage, Vec2<float>{xpos, ypos});
48
49 if (!messages.empty())
50 {
51 UString in = messages.front();
52 xpos = align(TextHAlign, Size.x, font->getFontWidth(in));
53 ypos = 15 - animTimer / 4;
54 auto inImage = font->getString(in);
55 fw().renderer->draw(inImage, Vec2<float>{xpos, ypos});
56 }
57 }
58}
59
60void Ticker::update()
61{

Callers

nothing calls this directly

Calls 4

getFontWidthMethod · 0.80
emptyMethod · 0.80
getStringMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected