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. Source
  4. Splashscreen.h
Mission NodeSDK 6.2C++splashscreen.h

Splashscreen.h

SDK Source File: Splashscreen.h

Source / SDK 6.2 / C++ / Core

Splashscreen.h

Splashscreen.h
CPP
1/* Copyright Statement:
2 *
3 * (C) 2021-2024 Cubios Inc. All rights reserved.
4 */
5
6#include "native.h"
7#include "AppManager.h"
8#include "Gfx.h"
9
10namespace Cubios
11{
12 namespace SplsParms
13 {
14 const uint8_t SPLASH_SCREEN_MAX_LEADERS = 10;
15 const uint8_t SPLASH_SCREEN_MAX_NAMED_VALUES = 3;
16 const uint8_t LEADERBOARD_SIZE = 120;
17 const uint8_t LEADER_TABLE_FONT_SIZE = 6;
18
19 enum e_LeadersDataType
20 {
21 typeNumber = 1,
22 typeTime = 2,
23 };
24
25 enum e_ScreensType
26 {
27 Empty = 0,
28 FirstLeaderGroup,
29 SecondLeaderGroup,
30 HighScore,
31 LeaderboardIcon,
32 AppName,
33 MainImage,
34 LastResultsIcon,
35 NamedValue1,
36 NamedValue2,
37 NamedValue3,
38 TwistIcon,
39 TwistLabelWithIcon,
40 TwistLabelWithoutIcon,
41 PatIcon,
42 PatLabelWithIcon,
43 PatLabelWithoutIcon,
44 QRCode,
45 TypeMax,
46 };
47
48 enum e_LabelTypes
49 {
50 LabelPatWithIcon = 0,
51 LabelPatWithoutIcon,
52 LabelTwistWithIcon,
53 LabelTwistWithoutIcon,
54 LabelsCount,
55 };
56
57 enum e_LeaderBoardType
58 {
59 LeaderBoardWithoutSaves = 0,
60 LeaderBoardWithSaves,
61 };
62
63 enum e_animatedIcons
64 {
65 iconPat = 0,
66 iconTwist,
67 iconsCount,
68 };
69 }
70
71 typedef struct
72 {
73 std::string name;
74 std::string value;
75 } SplsLeaderData;
76
77 typedef struct
78 {
79 std::string name;
80 std::string value;
81 uint8_t fontSize;
82 } SplsResultData;
83
84 typedef struct
85 {
86 std::string value;
87 std::string lbValue;
88 std::string label;
89 uint8_t fontSize;
90 } SplsRecordData;
91
92 typedef struct
93 {
94 Cubios::spriteID_t background;
95 Cubios::spriteID_t mainImage;
96 Cubios::spriteID_t name;
97 Cubios::spriteID_t resultsIcon;
98 Cubios::spriteID_t leaderboardIcon;
99 Cubios::spriteID_t QRcode;
100 Cubios::spriteID_t borderYou;
101 } SplsSpriteData;
102
103 typedef struct
104 {
105 uint8_t frame;
106 uint32_t time;
107 uint32_t playbackSpeed;
108 std::vector<Cubios::spriteID_t> spriteID;
109 } SplsAnimation;
110
111 class Splashscreen
112 {
113 public:
114 Splashscreen(Cubios::Application *app, SplsParms::e_LeadersDataType dataType);
115 ~Splashscreen();
116
117 void InitSplashScreenSprites(Cubios::spriteID_t backgroundSprite = -1,
118 Cubios::spriteID_t mainImageSprite = -1,
119 Cubios::spriteID_t gameNameSprite = -1,
120 Cubios::spriteID_t QRcodeSprite = -1,
121 Cubios::spriteID_t leaderboardIcon = -1,
122 Cubios::spriteID_t resultsIcon = -1,
123 Cubios::spriteID_t twistIcon_1 = -1,
124 Cubios::spriteID_t twistIcon_2 = -1,
125 Cubios::spriteID_t tapIcon_1 = -1,
126 Cubios::spriteID_t tapIcon_2 = -1,
127 Cubios::spriteID_t borderYou = -1);
128
129 virtual void Render(Cubios::Screen* screen);
130 virtual void Tick(uint32_t currentTime, uint32_t deltaTime);
131
132 void SetRecord(uint32_t value);
133 void SetNamedValue(uint8_t idx, std::string name, uint32_t value, SplsParms::e_LeadersDataType type = SplsParms::e_LeadersDataType::typeNumber);
134
135 void SetSeparator(std::string s);
136 void SetLabel(SplsParms::e_LabelTypes idx, std::string text);
137 void SetApplicationName(std::string name);
138 void SetLeaderBoardTable(SplsParms::e_LeaderBoardType type);
139 void SetLeaderBoardTable(uint32_t (&lbTable)[TOPOLOGY_FACES_MAX][TOPOLOGY_POSITIONS_MAX]);
140 void SetPlaybackSpeed(SplsParms::e_LabelTypes idx, uint32_t speed);
141 void SetQRCodeLink(std::string link);
142 void SetColors(Cubios::Math::Color key, Cubios::Math::Color base);
143
144 void SetTopology(uint8_t screen, Cubios::TOPOLOGY_place_t p);
145 void GetTopology(TOPOLOGY_orientation_mode_t mode, bool replaceFaceToOrientation);
146
147 virtual void RenderUserDefinedScreen(uint8_t type) {};
148
149 protected:
150 virtual void RenderBackground(uint32_t type);
151
152 void ValueToShortString(uint32_t value, std::string &str, SplsParms::e_LeadersDataType dataType);
153 void ValueToLongString(uint32_t value, std::string &str, SplsParms::e_LeadersDataType dataType, uint8_t &fontSize);
154
155 void SetTransform(float x, float y, int rotation = 0);
156 void RotateTransformToPosition();
157
158 void RenderImage(Cubios::spriteID_t ID);
159 void RenderText(std::string content, uint8_t fontSize, Cubios::Math::Color c, Cubios::text_align_t alignment = Cubios::text_align_t::TEXT_ALIGN_CENTER);
160
161 void RenderScreen();
162
163 void SplitLabels(std::string from, std::vector<std::string> &to);
164
165 void GetApplicationVersion();
166
167 void RenderControlLabel(SplsParms::e_LabelTypes type);
168 void RenderControlIcon(SplsParms::e_animatedIcons type);
169
170 void RenderParameter(uint8_t idx);
171 void RenderBest();
172 void RenderResultsIcon();
173
174 void RenderBorderYou(uint8_t y);
175 void RenderLeaderGroup(bool isFirstGroup);
176
177 void RenderQRCode();
178 void RenderLeaderBoardIcon();
179 void RenderAppName();
180 void RenderMainImage();
181
182 private:
183 Cubios::LB_info_t splashscreen_basicInfo;
184 SplsParms::e_LeadersDataType leadersDataType;
185
186 SplsLeaderData leadersSplashScreen[SplsParms::SPLASH_SCREEN_MAX_LEADERS]{
187 {"Alex", "5 000"},
188 {"Kim", "4 000"},
189 {"Beth", "3 000"},
190 {"Ethan", "2 000"},
191 {"Mia", "1 000"},
192 {"Lucas", "900"},
193 {"Jonas", "800"},
194 {"Diego", "700"},
195 {"Chloe", "500"},
196 {"Simon", "100"},
197 };
198
199 Cubios::Math::Transform transform;
200 Cubios::Math::Color color{Cubios::Math::Color(255, 0, 255)};
201
202 SplsRecordData record{"0", "0", "Top score", 10};
203 SplsResultData params[SplsParms::SPLASH_SCREEN_MAX_NAMED_VALUES];
204
205 std::string separator{"\n"};
206 std::vector<std::string> appName;
207
208 std::vector<std::string> labels[SplsParms::LabelsCount];
209
210 SplsAnimation animation[SplsParms::iconsCount];
211
212 std::string QRCode{""};
213 std::string version{""};
214
215 std::string leaderBoardText{"LEADERBOARD"};
216 std::string lastResultsText{"LAST RESULTS"};
217
218 Cubios::TOPOLOGY_place_t place[SCREENS_MAX];
219
220 protected:
221 Cubios::Application *app;
222 uint8_t renderScreen;
223
224 Cubios::Math::Color baseColor{Cubios::Gfx::Colors::white};
225 Cubios::Math::Color keyColor{Cubios::Gfx::Colors::white};
226
227 // Special sprites
228 SplsSpriteData sprites{-1, -1, -1, -1, -1, -1, -1};
229
230 uint32_t leaderBoardTable[TOPOLOGY_FACES_MAX][TOPOLOGY_POSITIONS_MAX];
231 };
232}
233
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Related nodes

AppManager.cpp
Source / SDK 6.2 / C++ / Core
AppManager.h
Source / SDK 6.2 / C++ / Core
Gfx.h
Source / SDK 6.2 / C++ / Core
native access.h
Source / SDK 6.2 / C++ / Core
Previous Node
Splashscreen.cpp
Source / SDK 6.2 / C++ / Core
Next Node
AppManager.cpp
Source / SDK 6.3 / C++ / Core