WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. Examples
  4. Countdown.cpp
Mission NodeSDK 6.3C++GFX SamplesProject Included

Countdown.cpp

Example: Countdown.cpp

Examples / SDK 6.3 / C++ / GFX Samples / Jukebox / project / src
Countdown.cpp
CPP
1#include <cstdarg>
2#include "Countdown.h"
3
4Countdown::Countdown()
5{
6 this->Transform.Position.X = 120;
7 this->Transform.Position.Y = 120;
8 this->Color.Set(0xFFFFFFFF);
9
10 this->Alignment = Cubios::text_align_t::TEXT_ALIGN_CENTER;
11 this->FontSize = 50;
12 this->Visible = false;
13
14 this->Content = "";
15}
16
17Countdown::~Countdown()
18{
19
20}
21
22Countdown* Countdown::Tick(uint32_t dt)
23{
24 if(!this->Visible) return this;
25
26 int32_t v = (int32_t)this->Color.R();
27 float dec = this->fadeSpeed*dt;
28
29 if(v-int(dec)>0)
30 {
31 this->Color.Set(this->Color.R()-int(dec),this->Color.G()-int(dec),this->Color.B()-int(dec));
32 }
33 else
34 {
35 this->Color.Set(0xFF000000);
36 this->Visible = false;
37 }
38
39 return this;
40}
41
42Countdown* Countdown::RenderStep()
43{
44 return this;
45}
46
47Cubios::SceneObject* Countdown::SetContent(std::string text)
48{
49 this->Content = text;
50 this->Visible = true;
51 this->Color.Set(0xFFFFFFFF);
52
53 return this;
54}
55
56void Countdown::Render()
57{
58 Cubios::GFX_drawText(Transform.Position.X, Transform.Position.Y, this->FontSize, Transform.SafeRotation()+ScreenAngle, this->Alignment, Color.Value(), this->Content.c_str());
59}
60
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Project files

Countdown.cpp
project/src/Countdown.cpp
Countdown.h
project/src/Countdown.h
Jukebox.cpp
project/src/Jukebox.cpp
Jukebox.h
project/src/Jukebox.h
wowcubeapp-build.json
project/wowcubeapp-build.json
Context Rail

Related nodes

Countdown.h
Examples / SDK 6.3 / C++ / GFX Samples / Jukebox / project / src
Jukebox.cpp
Examples / SDK 6.3 / C++ / GFX Samples / Jukebox / project / src
Jukebox.h
Examples / SDK 6.3 / C++ / GFX Samples / Jukebox / project / src
Jukebox
Examples / SDK 6.3 / C++ / GFX Samples
Previous Node
info.json
Examples / SDK 6.3 / C++ / GFX Samples / Jukebox
Next Node
Countdown.h
Examples / SDK 6.3 / C++ / GFX Samples / Jukebox / project / src