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.3C++splashscreen.h

Splashscreen.h

SDK Source File: Splashscreen.h

Source / SDK 6.3 / 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 uint32_t GetPersonalBest();
133 void SetRecord(uint32_t value);
134 void SetNamedValue(uint8_t idx, std::string name, uint32_t value, SplsParms::e_LeadersDataType type = SplsParms::e_LeadersDataType::typeNumber);
135
136 void SetSeparator(std::string s);
137 void SetLabel(SplsParms::e_LabelTypes idx, std::string text);
138 void SetApplicationName(std::string name);
139 void SetLeaderBoardTable(SplsParms::e_LeaderBoardType type);
140 void SetLeaderBoardTable(uint32_t (&lbTable)[TOPOLOGY_FACES_MAX][TOPOLOGY_POSITIONS_MAX]);
141 void SetPlaybackSpeed(SplsParms::e_LabelTypes idx, uint32_t speed);
142 void SetQRCodeLink(std::string link);
143 void SetColors(Cubios::Math::Color key, Cubios::Math::Color base);
144
145 void SetTopology(uint8_t screen, Cubios::TOPOLOGY_place_t p);
146 void GetTopology(TOPOLOGY_orientation_mode_t mode, bool replaceFaceToOrientation);
147
148 virtual void RenderUserDefinedScreen(uint8_t type) {};
149
150 protected:
151 virtual void RenderBackground(uint32_t type);
152
153 void ValueToShortString(uint32_t value, std::string &str, SplsParms::e_LeadersDataType dataType);
154 void ValueToLongString(uint32_t value, std::string &str, SplsParms::e_LeadersDataType dataType, uint8_t &fontSize);
155
156 void SetTransform(float x, float y, int rotation = 0);
157 void RotateTransformToPosition();
158
159 void RenderImage(Cubios::spriteID_t ID);
160 void RenderText(std::string content, uint8_t fontSize, Cubios::Math::Color c, Cubios::text_align_t alignment = Cubios::text_align_t::TEXT_ALIGN_CENTER);
161
162 void RenderScreen();
163
164 void SplitLabels(std::string from, std::vector<std::string> &to);
165
166 void GetApplicationVersion();
167
168 void RenderControlLabel(SplsParms::e_LabelTypes type);
169 void RenderControlIcon(SplsParms::e_animatedIcons type);
170
171 void RenderParameter(uint8_t idx);
172 void RenderBest();
173 void RenderResultsIcon();
174
175 void RenderBorderYou(uint8_t y);
176 void RenderLeaderGroup(bool isFirstGroup);
177
178 void RenderQRCode();
179 void RenderLeaderBoardIcon();
180 void RenderAppName();
181 void RenderMainImage();
182
183 private:
184 Cubios::LB_info_t splashscreen_basicInfo;
185 SplsParms::e_LeadersDataType leadersDataType;
186
187 SplsLeaderData leadersSplashScreen[SplsParms::SPLASH_SCREEN_MAX_LEADERS]{
188 {"Alex", "5000"},
189 {"Kim", "4000"},
190 {"Beth", "3000"},
191 {"Ethan", "2000"},
192 {"Mia", "1 000"},
193 {"Lucas", "900"},
194 {"Jonas", "800"},
195 {"Diego", "700"},
196 {"Chloe", "500"},
197 {"Simon", "100"},
198 };
199
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 protected:
219 Cubios::Application *app;
220 uint8_t renderScreen;
221
222 Cubios::Math::Color baseColor{Cubios::Gfx::Colors::white};
223 Cubios::Math::Color keyColor{Cubios::Gfx::Colors::white};
224
225 // Special sprites
226 SplsSpriteData sprites{-1, -1, -1, -1, -1, -1, -1};
227
228 uint32_t leaderBoardTable[TOPOLOGY_FACES_MAX][TOPOLOGY_POSITIONS_MAX];
229
230 Cubios::Math::Transform transform;
231 Cubios::TOPOLOGY_place_t place[SCREENS_MAX];
232
233 };
234}
235
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Related nodes

AppManager.cpp
Source / SDK 6.3 / C++ / Core
AppManager.h
Source / SDK 6.3 / C++ / Core
Gfx.h
Source / SDK 6.3 / C++ / Core
native access.h
Source / SDK 6.3 / C++ / Core
Previous Node
Splashscreen.cpp
Source / SDK 6.3 / C++ / Core
Next Node
fixed.inc
Source / SDK 6.1 / Pawn / Core