Difference between revisions of "SDK 6.3/C++/GFX Engine"

From WowWiki
Jump to navigation Jump to search
(GFX Engine: detailed per-method reference + usage patterns from official samples (WowBot))
(Fix ROBODoc typo parsing (LB_getInfo/LB_getScore restored), detailed Scramble+Splashscreen (WowBot))
Line 1: Line 1:
{{notice|'''Official WOWCube SDK documentation.''' SDK 6.3, C++ (WebAssembly) API. Signatures are extracted from the canonical SDK headers; usage notes and examples come from the official sample projects shipped with the WOWCube Development Kit. The headers remain authoritative.}}
+
{{notice|'''Official WOWCube SDK documentation.''' SDK 6.3, C++ (WebAssembly) API. Signatures are extracted from the canonical SDK headers shipped with the WOWCube Development Kit; the headers remain authoritative.}}
  
 
{{SDK 6.3 nav}}
 
{{SDK 6.3 nav}}
 +
  
 
''← [[SDK 6.3]] · C++ / GFX Engine''
 
''← [[SDK 6.3]] · C++ / GFX Engine''
  
The object-oriented retained layer of the C++ SDK (namespace <code>Cubios</code>): a scene graph with sprites, text, backgrounds, sounds and math primitives. It sits on top of the [[SDK 6.3/C++/Native API|native ABI]] and is driven by the [[SDK 6.3/C++/Application|Application framework]].
+
The object-oriented retained layer of the C++ SDK (namespace <code>Cubios</code>): a scene graph with sprites, text, backgrounds, sounds and math primitives. It sits on top of the [[SDK 6.3/C++/Native API|native ABI]] and is driven by the [[SDK 6.3/C++/Application|Application framework]]. Public signatures below are extracted from the SDK 6.3 headers.
 +
 
 +
=== Scene ===
 +
 
 +
The retained scene graph owned by every <code>Application</code> (field <code>app.Scene</code>). Holds scene objects and renders them per screen.
 +
 
 +
Public interface (<code>Scene.h</code>):
  
== The canonical pattern ==
+
Scene();
 +
virtual ~Scene();
 +
uint32_t CreateObject(SceneObject* obj);
 +
bool CreateObjectWithID(uint32_t id, SceneObject* obj);
 +
uint32_t CreateSound(Sound* obj);
 +
bool CreateSoundWithID(uint32_t id, Sound* obj);
 +
bool DisposeObjectWithID(uint32_t id);
 +
bool DisposeSoundWithID(uint32_t id);
 +
void DisposeAllObjects();
 +
void Play(uint32_t id, uint8_t volume);
  
Every official sample follows the same lifecycle:
+
=== SceneObject ===
  
# '''Create''' objects once at startup and register them in the application's <code>Scene</code> under integer IDs (usually an <code>enum</code>).
+
Base class of every visual object in the scene graph. Provides position, rotation, scale, opacity, z-order, per-screen placement and lifecycle.
# '''Render''' every frame: for each of the module's three <code>Screen</code>s open a <code>Begin()/End()</code> block and <code>Add()</code> the scene objects you want on that screen, chaining setters.
 
  
Resource creation (from the official ''Network/Messaging2'' sample):
+
Public interface (<code>SceneObject.h</code>):
  
  void Messaging2::InitializeResources()
+
  SceneObject():Parent(nullptr),ScreenAngle(0),Visible(true),InBegin(false);
  {
+
virtual ~SceneObject();
    this->Scene.CreateObjectWithID(GfxObjects::idle, new Sprite("idle.png", Transform(120,120,0)));
+
virtual void Render() = 0;
    this->Scene[GfxObjects::idle]->Color.Set(0xFFFFFFFF);
+
SceneObject* SetColor(uint32_t v);
    this->Scene.CreateObjectWithID(GfxObjects::background, new Sprite("background.png", Transform(120,120,0)));
+
SceneObject* SetA(uint8_t a);
    this->SetTimer(Timers::mainTimer, 30);
+
SceneObject* SetAf(float a);
  }
+
SceneObject* SetAfSafe(float a);
 +
SceneObject* SetR(uint8_t r);
 +
SceneObject* SetG(uint8_t g);
 +
SceneObject* SetB(uint8_t b);
 +
SceneObject* SetVisible(bool v);
 +
SceneObject* SetTransform(const Math::Transform& t);
 +
  SceneObject* SetPosition(const Math::Vec2& p);
 +
SceneObject* SetPosition(float x, float y);
 +
SceneObject* SetRotation(int r);
 +
SceneObject* SetMirroring(unsigned int m);
 +
SceneObject* SetScale(unsigned int s);
 +
SceneObject* SetScale(unsigned int sx, unsigned int sy);
 +
SceneObject* SetXScale(unsigned int s);
 +
SceneObject* SetYScale(unsigned int s);
 +
const Math::Vec2 ScreenPosition();
 +
if(this->Parent==nullptr) return pos;
 +
switch(ScreenAngle);
 +
pos.Set(this->Transform.Position.X,this->Transform.Position.Y);
 +
pos.Set(240-this->Transform.Position.Y,this->Transform.Position.X);
 +
pos.Set(240-this->Transform.Position.X,240-this->Transform.Position.Y);
 +
pos.Set(this->Transform.Position.Y,240-this->Transform.Position.X);
 +
SceneObject* Move(const Math::Vec2& v);
 +
SceneObject* Move(float dx, float dy);
 +
if(this->Parent==nullptr) return this;
 +
if(!this->InBegin);
 +
  LOG_w("SceneObject: Move() can only be called within Begin/End block!\n");
  
Per-frame rendering (from the official ''GFX Engine Sample 1 — Twinkle''):
+
=== Screen ===
  
void Twinkle::on_Render(std::array<Cubios::Screen, 3>& screens)
+
One of the three displays of the current module; passed to <code>on_Render()</code> / <code>on_PhysicsTick()</code>. Render target selector.
{
 
    Background* bkg = (Background*)this->Scene[Sprites::Clear];
 
    for(auto it = screens.begin(); it != screens.end(); ++it)
 
    {
 
        it->Begin(TOPOLOGY_orientation_mode_t::ORIENTATION_MODE_GRAVITY, true);
 
            it->Add(bkg->SetColor(0xFF000044));
 
            if(TOPOLOGY_isAssembled()==1)
 
            {
 
                switch(it->Position())  // screen's place on the cube face
 
                {
 
                    case 0: it->Add(this->Scene[Sprites::MyUfo])->SetPosition(pos.X-280, pos.Y-280); break;
 
                    case 1: it->Add(this->Scene[Sprites::MyUfo])->SetPosition(pos.X,    pos.Y-280); break;
 
                    case 2: it->Add(this->Scene[Sprites::MyUfo])->SetPosition(pos.X,    pos.Y);    break;
 
                }
 
            }
 
        it->End();
 
    }
 
}
 
  
'''Units and conventions''' (as used across all official samples): screens are 240×240 px; colors are packed '''0xAARRGGBB''' (<code>Math::Color</code>); <code>Transform</code> rotation is in degrees, scale is in percent (100 = 1:1); all <code>Set*</code> methods return <code>SceneObject*</code>, so calls chain: <code>screen.Add(obj)->SetPosition(x,y)->SetAf(0.5f)</code>. To make one logical object span several screens of a face, samples draw it on each screen with a ±280 px offset per screen position (as above).
+
Public interface (<code>Screen.h</code>):
  
== Scene ==
+
Screen(uint8_t id);
 +
void SetOrientation(TOPOLOGY_orientation_mode_t mode);
 +
uint8_t Position() const;
 +
TOPOLOGY_orientation_t Direction() const;
 +
uint8_t OppositeFace() const;
 +
uint8_t Face() const;
 +
inline uint8_t ID() const;
 +
inline uint32_t Angle() const;
 +
SceneObject* Add(SceneObject* obj);
 +
SceneObject* AddCopy(SceneObject* obj);
 +
void Begin(TOPOLOGY_orientation_mode_t mode = Cubios::ORIENTATION_MODE_MENU,bool autorotation = false);
 +
void End();
 +
inline bool IsAutorotation();
  
The retained scene graph owned by every <code>Application</code> (field <code>app.Scene</code>). It is an ID-addressed registry of objects and sounds; it owns them and disposes them for you.
+
=== Object ===
  
; <code>uint32_t CreateObject(SceneObject* obj);</code>
+
Minimal reference-counted base class for engine resources.
: Register an object; returns its auto-assigned ID. The scene takes ownership.
 
; <code>bool CreateObjectWithID(uint32_t id, SceneObject* obj);</code>
 
: Register under an explicit ID (usually an <code>enum</code> value). Fails (returns <code>false</code>) if the ID is taken. ''The most common way to build a scene in the official samples.''
 
; <code>uint32_t CreateSound(Sound* obj);</code> / <code>bool CreateSoundWithID(uint32_t id, Sound* obj);</code>
 
: Same, for [[#Sound and SoundCollection|sounds]].
 
; <code>SceneObject* operator[](uint32_t);</code>
 
: Look an object up by ID: <code>this->Scene[Sprites::MyUfo]</code>.
 
; <code>bool DisposeObjectWithID(uint32_t id);</code> / <code>bool DisposeSoundWithID(uint32_t id);</code> / <code>void DisposeAllObjects();</code>
 
: Remove and delete objects/sounds.
 
; <code>void Play(uint32_t id, uint8_t volume);</code>
 
: Play a registered sound by ID.
 
  
== SceneObject ==
+
Public interface (<code>Object.h</code>):
  
Base class of every visual object. Holds a <code>Math::Transform</code>, a <code>Math::Color</code> and a <code>Visible</code> flag. All setters are '''chainable''' (return <code>SceneObject*</code>).
+
Object();
 +
virtual ~Object();
 +
inline void SetId(int16_t id);
  
; <code>virtual void Render() = 0;</code>
+
=== Gfx::Background ===
: Implemented by each concrete object; called by the engine when the object was <code>Add()</code>-ed to a screen in the current frame.
 
; <code>SetPosition(float x, float y)</code> / <code>SetPosition(const Math::Vec2&)</code> / <code>SetTransform(const Math::Transform&)</code>
 
: Place the object (240×240 screen space). ''The most-used call in the official samples.''
 
; <code>SetRotation(int r)</code>
 
: Rotation in degrees; normalized into 0–359 (negative values allowed).
 
; <code>SetScale(unsigned s)</code> / <code>SetScale(sx, sy)</code> / <code>SetXScale(s)</code> / <code>SetYScale(s)</code>
 
: Scale in percent (100 = original size).
 
; <code>SetMirroring(unsigned m)</code>
 
: Mirror mode (<code>GFX_mirror_t</code>: BLANK/X/Y/XY).
 
; <code>SetColor(uint32_t argb)</code> / <code>SetR/SetG/SetB(uint8_t)</code> / <code>SetA(uint8_t)</code> / <code>SetAf(float)</code> / <code>SetAfSafe(float)</code>
 
: Tint/opacity. <code>SetAf</code> takes 0.0–1.0; <code>SetAfSafe</code> clamps out-of-range values (added in SDK 5.1).
 
; <code>SetVisible(bool)</code>
 
: Hide without removing from the scene.
 
; <code>const Math::Vec2 ScreenPosition();</code>
 
: The object's position converted to physical-screen space, taking the screen's current rotation angle (0/90/180/270°) into account.
 
; <code>Move(float dx, float dy)</code> / <code>Move(const Math::Vec2&)</code>
 
: Screen-angle-aware relative move. '''Only valid inside a <code>Screen::Begin()/End()</code> block''' — otherwise it logs a warning and does nothing.
 
  
Public fields: <code>Math::Transform Transform; Math::Color Color; bool Visible;</code>
+
Full-screen background image object.
  
== Screen ==
+
Public interface (<code>Gfx/Background.h</code>):
  
One of the three displays of the current module; an array <code>std::array&lt;Screen, 3&gt;</code> is passed to <code>on_Render()</code> / <code>on_PhysicsTick()</code>.
+
Background(uint32_t color);
 +
Background(uint8_t R, uint8_t G, uint8_t B);
 +
Background(uint8_t R, uint8_t G, uint8_t B, uint8_t A);
 +
virtual ~Background();
 +
void Render() override;
 +
Cubios::SceneObject* SetColor(uint32_t color);
 +
Cubios::SceneObject* SetColor(uint8_t R, uint8_t G, uint8_t B);
 +
Cubios::SceneObject* SetColor(uint8_t R, uint8_t G, uint8_t B, uint8_t A);
  
; <code>void Begin(TOPOLOGY_orientation_mode_t mode = ORIENTATION_MODE_MENU, bool autorotation = false);</code> / <code>void End();</code>
+
=== Gfx::Sprite ===
: Open/close the frame block for this screen. <code>mode</code> selects the orientation reference (MENU / GRAVITY / SPLASH); with <code>autorotation = true</code> content is auto-rotated as the cube is turned (samples use <code>ORIENTATION_MODE_GRAVITY, true</code>).
 
; <code>SceneObject* Add(SceneObject* obj);</code>
 
: Queue a scene object for rendering on this screen this frame; returns the object for chaining.
 
; <code>SceneObject* AddCopy(SceneObject* obj);</code>
 
: Queue an independent ''copy'' — the standard way to draw the same object several times with different positions in one frame (heavily used in the samples).
 
; <code>uint8_t ID();</code>
 
: Physical display index — pass to native calls such as <code>MS_getFaceAccelX(screen.ID())</code>.
 
; <code>uint8_t Position();</code>
 
: The screen's place on its cube face (see the render sample above — used to compute cross-screen offsets).
 
; <code>uint8_t Face();</code> / <code>uint8_t OppositeFace();</code> / <code>TOPOLOGY_orientation_t Direction();</code>
 
: Topology of the screen: which face it belongs to, the opposite face, and the facing direction (UP/DOWN/FRONT/…).
 
; <code>void SetOrientation(TOPOLOGY_orientation_mode_t mode);</code> / <code>uint32_t Angle();</code> / <code>bool IsAutorotation();</code>
 
: Orientation control and current rotation angle of the content.
 
  
== Gfx::Sprite ==
+
Static image sprite bound to an image asset by name.
  
Static image sprite bound to an image asset by file name (from the app's packed <code>assets/</code>).
+
Public interface (<code>Gfx/Sprite.h</code>):
  
 +
Sprite(std::string name, const Cubios::Math::Transform& t);
 +
Sprite(std::string name, float x, float y);
 
  Sprite(std::string name);
 
  Sprite(std::string name);
Sprite(std::string name, float x, float y);
 
Sprite(std::string name, const Cubios::Math::Transform& t);
 
 
  Sprite(const Sprite& sprite);
 
  Sprite(const Sprite& sprite);
 +
virtual ~Sprite();
 +
void Render() override;
 +
 +
=== Gfx::AnimatedSprite ===
 +
 +
Frame-animated sprite.
 +
 +
Public interface (<code>Gfx/AnimatedSprite.h</code>):
 +
 +
AnimatedSprite(std::vector<std::string>& names, const Cubios::Math::Transform& t);
 +
AnimatedSprite(std::vector<std::string>& names, float x, float y);
 +
AnimatedSprite(std::vector<std::string>& names);
 +
AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame, const Cubios::Math::Transform& t);
 +
AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame, float x, float y);
 +
AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame);
 +
AnimatedSprite(const AnimatedSprite& sprite);
 +
AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas, const Cubios::Math::Transform& t);
 +
AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas, float x, float y);
 +
AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas);
 +
virtual ~AnimatedSprite();
 
  void Render() override;
 
  void Render() override;
 +
int16_t Tick(uint32_t dt);
 +
Cubios::SceneObject* SetFrame(int16_t frameNumber);
 +
Cubios::SceneObject* SetPlaybackSpeed(int16_t speed);
 +
Cubios::SceneObject* SetPlaybackMode(playbackMode_t mode);
 +
int16_t PrevFrame();
 +
int16_t NextFrame();
 +
 +
=== Gfx::SpriteAtlas ===
 +
 +
Sprite atlas: a sheet of sub-images rendered via <code>SpriteAtlasElement</code>. Added in SDK 6.2.
 +
 +
Public interface (<code>Gfx/SpriteAtlas.h</code>):
 +
 +
SpriteAtlas(std::string name, Cubios::Scene* scene);
 +
virtual ~SpriteAtlas();
 +
bool AddSprite(uint32_t id, const Cubios::Math::Rect2& rc);
 +
bool RemoveSprite(uint32_t id);
 +
T* Get(uint32_t ind);
 +
inline size_t Count();
 +
inline std::vector<uint32_t>* ElementsInsertionOrder();
 +
 +
=== Gfx::SpriteAtlasElement ===
  
Typical use: <code>new Sprite("idle.png", Transform(120,120,0))</code> — center of a 240×240 screen.
+
One element (sub-rectangle) of a <code>SpriteAtlas</code>.
  
== Gfx::Background ==
+
Public interface (<code>Gfx/SpriteAtlas.h</code>):
 +
 
 +
SpriteAtlasElement(SpriteAtlasBase* host, const Cubios::Math::Rect2& rc);
 +
virtual ~SpriteAtlasElement();
 +
void Render() override;
 +
virtual SpriteAtlasElement* Copy();
 +
inline Cubios::Math::Rect2* Rect();
  
Full-screen fill. <code>Background(uint32_t argb)</code> or <code>Background(R,G,B[,A])</code>; recolor at render time via <code>SetColor(...)</code> (see the Twinkle sample above — one shared background object recolored per screen).
+
=== Gfx::Text ===
  
== Gfx::Text ==
+
Text object with scale, alignment and color.
  
Text object.
+
Public interface (<code>Gfx/Text.h</code>):
  
 +
Text(std::string text, const Cubios::Math::Transform& t, uint32_t fontSize, const Cubios::Math::Color& color, Cubios::text_align_t al = Cubios::text_align_t::TEXT_ALIGN_CENTER);
 +
Text(std::string text, const Cubios::Math::Transform& t, uint32_t fontSize = 10, Cubios::text_align_t al = Cubios::text_align_t::TEXT_ALIGN_CENTER);
 
  Text(std::string text, float x, float y, uint32_t fontSize = 10);
 
  Text(std::string text, float x, float y, uint32_t fontSize = 10);
  Text(std::string text, float x, float y, uint32_t fontSize, const Math::Color& color);
+
  Text(std::string text, float x, float y, uint32_t fontSize, const Cubios::Math::Color& color);
  Text(std::string text, const Math::Transform& t, uint32_t fontSize, const Math::Color& color,
+
  virtual ~Text();
      text_align_t al = TEXT_ALIGN_CENTER);
+
void Render() override;
 +
Cubios::SceneObject* SetContent(std::string text);
 +
Cubios::SceneObject* FormatContent(char const* format,...);
 +
Cubios::SceneObject* SetFontSize(uint32_t fontSize);
 +
 
 +
=== Gfx::QRCode ===
 +
 
 +
QR-code object rendered on screen. Added in SDK 6.0.
 +
 
 +
Public interface (<code>Gfx/QRCode.h</code>):
 +
 
 +
QRCode(std::string data, const Cubios::Math::Transform& t);
 +
QRCode(std::string data, float x, float y);
 +
QRCode(std::string data, const Cubios::Math::Transform& t, u32_t size);
 +
QRCode(std::string data, float x, float y, u32_t size);
 +
QRCode(const QRCode& qr);
 +
virtual ~QRCode();
 +
Cubios::SceneObject* SetSize(u32_t size);
 +
Cubios::SceneObject* SetColor(const Math::Color& color);
 +
Cubios::SceneObject* SetBackgroundColor(const Math::Color& color);
 +
Cubios::SceneObject* SetData(std::string data);
 +
void Render() override;
 +
 
 +
=== Gfx::OffscreenRenderTarget ===
 +
 
 +
Offscreen render target (baked image) usable as a scene object.
 +
 
 +
Public interface (<code>Gfx/OffscreenRenderTarget.h</code>):
 +
 
 +
OffscreenRenderTarget(u32_t width, u32_t height, Cubios::GFX_PixelFormat_t format);
 +
virtual ~OffscreenRenderTarget();
 +
Cubios::SceneObject* Add(Cubios::SceneObject* obj);
 +
Cubios::SceneObject* AddCopy(Cubios::SceneObject* obj);
 +
void Begin(bool overwrite=false);
 +
void End();
 +
void Render() override;
 +
virtual void RenderLayer(renderLayerOrder_t order);
 +
 
 +
=== Sound ===
 +
 
 +
A sound asset; play, stop and query state.
 +
 
 +
Public interface (<code>Sound.h</code>):
 +
 
 +
explicit Sound(const std::string& name);
 +
~Sound();
 +
void Play(uint8_t volume = 100);
 +
static void Stop();
 +
static bool IsPlaying();
 +
 
 +
=== SoundCollection ===
 +
 
 +
A set of sounds with random playback helpers. Added in SDK 6.2.
 +
 
 +
Public interface (<code>Sound.h</code>):
 +
 
 +
SoundCollection(std::vector<std::string>& names);
 +
SoundCollection(std::vector<Cubios::Sound*>& sounds);
 +
virtual ~SoundCollection();
 +
bool PlayRandomSound(uint8_t volume = 100, bool stopCurrent = true);
 +
bool RepeatRandomSounds(uint8_t volume, int delayMin, int delayMax, int deltaTime);
 +
void Stop();
 +
bool IsPlaying();
 +
 
 +
=== NetworkMessage ===
 +
 
 +
Bit-packed serializer for inter-module messages (write/read ints, signed ints, floats).
 +
 
 +
Public interface (<code>NetworkMessage.h</code>):
 +
 
 +
NetworkMessage(uint8_t* data=NULL,int length=MESSAGE_SIZE_MAX);
 +
virtual ~NetworkMessage();
 +
void Print();
 +
void WriteInt(int value, int bits);
 +
void WriteByte(uint8_t value);
 +
void WriteSignedInt(int value, int bits);
 +
void WriteBool(bool value);
 +
void WriteFloat(float value);
 +
int ReadInt(int bits);
 +
int ReadSignedInt(int bits);
 +
uint8_t ReadByte();
 +
bool ReadBool();
 +
float ReadFloat();
 +
uint8_t* GetData(int& length);
 +
void SetData(uint8_t* data, int length);
 +
inline void Reset(bool zero=false);
 +
 
 +
=== SaveMessage ===
 +
 
 +
Serializer for persistent state (used with <code>SaveState()</code> / <code>LoadState()</code>). Added in SDK 6.0.
 +
 
 +
Public interface (<code>SaveMessage.h</code>):
 +
 
 +
SaveMessage(uint8_t* data=NULL,int length=GAME_SAVE_SIZE);
 +
virtual ~SaveMessage();
 +
void Print();
 +
void WriteInt(int value, int bits);
 +
void WriteByte(uint8_t value);
 +
void WriteSignedInt(int value, int bits);
 +
void WriteBool(bool value);
 +
void WriteFloat(float value);
 +
int ReadInt(int bits);
 +
int ReadSignedInt(int bits);
 +
uint8_t ReadByte();
 +
bool ReadBool();
 +
float ReadFloat();
 +
uint8_t* GetData(int& length);
 +
void SetData(uint8_t* data, int length);
 +
inline void Reset(bool zero=false);
  
; <code>SetContent(std::string)</code> / <code>FormatContent(const char* fmt, ...)</code>
+
=== Scramble ===
: Replace the text; <code>FormatContent</code> is printf-style — handy for scores/counters.
 
; <code>SetFontSize(uint32_t)</code>
 
: Change size. Alignment via the public <code>Alignment</code> field (<code>text_align_t</code>, 9 anchors).
 
  
== Gfx::AnimatedSprite ==
+
Cube-scramble helper. Added in SDK 6.0.
  
Frame-animated sprite. Three ways to construct: an explicit list of asset names; a name pattern (<code>name + frameNumber + extension</code>) with a first/last frame range; or a [[#Gfx::SpriteAtlas|SpriteAtlas]].
+
Public interface (<code>Scramble.h</code>):
  
; <code>int16_t Tick(uint32_t dt);</code>
+
Scramble();
: Advance the animation; call from <code>on_Tick(time, dt)</code> for every animated sprite. Returns the current frame.
+
~Scramble();
; <code>SetPlaybackMode(playbackMode_t)</code>
+
void StartScramble(uint8_t twistsCount);
: <code>Loop</code> (wrap around), <code>Bounce</code> (ping-pong), <code>Set</code> (manual frame control).
+
void VirtualTwist(uint8_t screen, uint8_t direction);
; <code>SetPlaybackSpeed(int16_t)</code> / <code>SetFrame(int16_t)</code> / <code>NextFrame()</code> / <code>PrevFrame()</code>
+
virtual void on_BeforeTwist() = 0;
: Speed and manual frame stepping.
+
virtual void on_MappingChanged(uint8_t moduleTo, uint8_t screenTo, uint8_t moduleFrom, uint8_t screenFrom) = 0;
 +
virtual void on_Twist(const Cubios::TOPOLOGY_twistInfo_t twist) = 0;
  
== Gfx::SpriteAtlas ==
+
=== Splashscreen ===
  
A sprite sheet: one image asset cut into sub-rectangles, each rendered by a <code>SpriteAtlasElement</code> registered in the scene. Added in SDK 6.2 — saves memory versus per-frame images.
+
Standard splash screen with leaderboard support (reworked in SDK 6.2).
  
SpriteAtlas<SpriteAtlasElement> atlas("sheet.png", &this->Scene);
+
Public interface (<code>Splashscreen.h</code>):
atlas.AddSprite(MyIds::run0, Math::Rect2(0,  0, 64, 64));
 
atlas.AddSprite(MyIds::run1, Math::Rect2(64,  0, 64, 64));
 
  
; <code>bool AddSprite(uint32_t id, const Math::Rect2& rc);</code>
+
Splashscreen(Cubios::Application *app, SplsParms::e_LeadersDataType dataType);
: Create an element for sub-rectangle <code>rc</code> and register it in the scene under <code>id</code> (fails if the ID is taken).
+
~Splashscreen();
; <code>T* Get(uint32_t)</code> / <code>T* operator[](uint32_t)</code> / <code>size_t Count()</code> / <code>ElementsInsertionOrder()</code>
+
virtual void Render(Cubios::Screen* screen);
: Element access. <code>SpriteAtlasElement</code> itself is a normal <code>SceneObject</code> (position/scale/color) plus <code>Rect()</code> and <code>Copy()</code>. An atlas can also feed an [[#Gfx::AnimatedSprite|AnimatedSprite]].
+
virtual void Tick(uint32_t currentTime, uint32_t deltaTime);
 +
uint32_t GetPersonalBest();
 +
void SetRecord(uint32_t value);
 +
void SetNamedValue(uint8_t idx, std::string name, uint32_t value, SplsParms::e_LeadersDataType type = SplsParms::e_LeadersDataType::typeNumber);
 +
void SetSeparator(std::string s);
 +
void SetLabel(SplsParms::e_LabelTypes idx, std::string text);
 +
void SetApplicationName(std::string name);
 +
void SetLeaderBoardTable(SplsParms::e_LeaderBoardType type);
 +
void SetLeaderBoardTable(uint32_t (&lbTable)[TOPOLOGY_FACES_MAX][TOPOLOGY_POSITIONS_MAX]);
 +
void SetPlaybackSpeed(SplsParms::e_LabelTypes idx, uint32_t speed);
 +
void SetQRCodeLink(std::string link);
 +
void SetColors(Cubios::Math::Color key, Cubios::Math::Color base);
 +
void SetTopology(uint8_t screen, Cubios::TOPOLOGY_place_t p);
 +
void GetTopology(TOPOLOGY_orientation_mode_t mode, bool replaceFaceToOrientation);
 +
virtual void RenderUserDefinedScreen(uint8_t type);
  
== Gfx::OffscreenRenderTarget ==
+
=== Math::Vec2 ===
  
Render-to-texture: draw objects into an offscreen buffer once, then use the result as a single scene object (a "baked image").
+
2D float vector.
  
OffscreenRenderTarget(u32_t width, u32_t height, GFX_PixelFormat_t format);
+
Public interface (<code>Math/Vec2.h</code>):
  
; <code>void Begin(bool overwrite = false);</code> / <code>void End();</code> / <code>Add()</code> / <code>AddCopy()</code>
+
Vec2();
: Same block pattern as <code>Screen</code>, but drawing goes into the buffer. <code>overwrite=true</code> re-bakes.
+
Vec2(const float _x, const float _y);
; <code>virtual void RenderLayer(renderLayerOrder_t)</code>
+
Vec2(const Vec2& vec);
: Hook to inject drawing <code>BeforeQueue</code>/<code>AfterQueue</code>. Pixel formats: RGB565 / ARGB6666 / ARGB8888.
+
Vec2(const float* p);
 +
void Set(const float _x, const float _y);
 +
void Set(const Vec2& vec);
 +
void Set(const float* p);
 +
float Len() const;
 +
void Norm();
 +
bool IsEqual(const Vec2& v, const float tol) const;
 +
int Compare(const Vec2& v, float tol) const;
  
== Gfx::QRCode ==
+
=== Math::Vec2i ===
  
QR-code scene object (SDK 6.0+). <code>QRCode(std::string data, x, y[, size])</code>; <code>SetData()</code>, <code>SetSize()</code>, <code>SetColor()</code> / <code>SetBackgroundColor()</code> (fields <code>ColorOnes</code>/<code>ColorZeros</code>). Used by system apps to link the cube with the mobile app.
+
2D integer vector.
  
== Sound and SoundCollection ==
+
Public interface (<code>Math/Vec2.h</code>):
  
; <code>Sound(const std::string& name);</code> → <code>void Play(uint8_t volume = 100);</code>
+
Vec2i();
: One sound asset. <code>static Stop()</code> / <code>static bool IsPlaying()</code> control the playback channel.
+
Vec2i(const int16_t _x, const int16_t _y);
; <code>SoundCollection(std::vector&lt;std::string&gt;&)</code> or <code>(std::vector&lt;Sound*&gt;&)</code>
+
Vec2i(const Vec2i& vec);
: A set of sounds (SDK 6.2+):
+
Vec2i(const int16_t* p);
:; <code>bool PlayRandomSound(uint8_t volume = 100, bool stopCurrent = true);</code>
+
void Set(const int16_t _x, const int16_t _y);
:: Play a random one — the idiom behind varied game SFX.
+
void Set(const Vec2i& vec);
:; <code>bool RepeatRandomSounds(uint8_t volume, int delayMin, int delayMax, int deltaTime);</code>
+
void Set(const int16_t* p);
:: Keep playing random sounds with a random delay in [min,max]; call it periodically passing the tick delta.
+
float Len() const;
:; <code>Stop()</code> / <code>IsPlaying()</code>
+
void Norm();
 +
bool IsEqual(const Vec2i& v, const float tol) const;
 +
int Compare(const Vec2i& v, float tol) const;
  
== NetworkMessage and SaveMessage ==
+
=== Math::Transform ===
  
Two identical bit-packing serializers with different buffers: <code>NetworkMessage</code> (max <code>MESSAGE_SIZE_MAX</code>) for inter-module packets, <code>SaveMessage</code> (max <code>GAME_SAVE_SIZE</code>) for persistent state (SDK 6.0+).
+
Position + rotation + mirroring transform of a scene object.
  
; <code>WriteInt(int value, int bits)</code> / <code>WriteSignedInt(int value, int bits)</code> (signed added in 5.1) / <code>WriteByte</code> / <code>WriteBool</code> / <code>WriteFloat</code>
+
Public interface (<code>Math/Transform.h</code>):
: Append a value using exactly <code>bits</code> bits — pack a whole game state into one packet.
 
; <code>ReadInt(int bits)</code> / <code>ReadSignedInt</code> / <code>ReadByte</code> / <code>ReadBool</code> / <code>ReadFloat</code>
 
: Read back '''in the same order'''.
 
; <code>GetData(int& length)</code> / <code>SetData(uint8_t*, int)</code> / <code>Reset(bool zero = false)</code>
 
: Raw buffer access and cursor reset.
 
  
Canonical flow: master module packs → <code>SendNetworkMessage(type, &msg)</code> → other modules unpack in <code>on_Message()</code>. For saves: pack → <code>SaveState(&msg)</code>; restore via <code>LoadState(&id, &msg)</code>.
+
Transform():Position(0,0),Rotation(0),Mirroring(0),ScaleX(100),ScaleY(100);
 +
Transform(float x, float y): Position(x,y),Rotation(0),Mirroring(0),ScaleX(100),ScaleY(100);
 +
Transform(float x, float y, unsigned int a): Position(x,y),Rotation(a),Mirroring(0),ScaleX(100),ScaleY(100);
 +
Transform(float x, float y, unsigned int a, unsigned int sx, unsigned int sy ): Position(x,y),Rotation(a),Mirroring(0),ScaleX(sx),ScaleY(sy);
 +
Transform(float x, float y, unsigned int a, unsigned int m): Position(x,y),Rotation(a),Mirroring(m),ScaleX(100),ScaleY(100);
 +
Transform(float x, float y, unsigned int a, unsigned int sx, unsigned int sy, unsigned int m): Position(x,y),Rotation(a),Mirroring(m),ScaleX(sx),ScaleY(sy);
 +
Transform(const Transform& t): Position(t.Position),Rotation(t.Rotation),Mirroring(t.Mirroring),ScaleX(t.ScaleX),ScaleY(t.ScaleY);
 +
int SafeRotation();
  
== Scramble ==
+
=== Math::Color ===
  
Cube-scramble helper (SDK 6.0+), used by puzzle titles to generate and track a scrambled state (<code>Scramble.h</code>). Used across the official ''Topology'' samples.
+
RGBA color with float/byte accessors (see also <code>Gfx/Colors.h</code> named constants).
  
== Splashscreen ==
+
Public interface (<code>Math/Color.h</code>):
  
Standard splash screen with leaderboard integration (<code>Splashscreen.h</code>; reworked in SDK 6.2). Shows the app title screen and player scores before the game starts.
+
Color():_R(255),_G(255),_B(255),_A(255),_Value(0xFFFFFFFF);
 +
Color(uint8_t r, uint8_t g, uint32_t b):_R(r),_G(g),_B(b),_A(255);
 +
Color(uint8_t r, uint8_t g, uint32_t b, uint8_t a):_R(r),_G(g),_B(b),_A(a);
 +
Color(uint32_t v):_Value(v);
 +
this->_B = (v & 0x000000ff);
 +
this->_G = (v & 0x0000ff00) >> 8;
 +
this->_R = (v & 0x00ff0000) >> 16;
 +
this->_A = (v & 0xff000000) >> 24;
 +
void Set(uint8_t r, uint8_t g, uint32_t b, uint8_t a);
 +
void Set(uint8_t r, uint8_t g, uint32_t b);
 +
void Set(uint32_t v);
 +
inline void SetA(uint8_t a);
 +
inline void SetAf(float a);
 +
inline void SetAfSafe(float a);
 +
inline void SetR(uint8_t r);
 +
inline void SetG(uint8_t g);
 +
inline void SetB(uint8_t b);
 +
inline uint8_t A();
 +
inline float Af();
 +
inline uint8_t R();
 +
inline uint8_t G();
 +
inline uint8_t B();
 +
inline uint32_t Value();
  
== Math ==
+
=== Math::Rect2 ===
  
; <code>Math::Vec2</code> / <code>Math::Vec2i</code>
+
2D rectangle.
: 2D float/int vectors with arithmetic.
 
; <code>Math::Transform</code>
 
: <code>{ Vec2 Position; int Rotation; unsigned ScaleX, ScaleY; unsigned Mirroring; }</code> — rotation in degrees (<code>SafeRotation()</code> normalizes), scale in percent (100 = 1:1). Constructors: <code>(x,y)</code>, <code>(x,y,angle)</code>, <code>(x,y,angle,sx,sy)</code>, <code>(x,y,angle,mirror)</code>, <code>(x,y,angle,sx,sy,mirror)</code>.
 
; <code>Math::Color</code>
 
: ARGB color; <code>Set(0xAARRGGBB)</code>, per-channel <code>SetA/R/G/B</code>, float alpha <code>SetAf</code>/<code>SetAfSafe</code>. Named constants in <code>Gfx/Colors.h</code> (<code>Colors::black</code>, <code>Colors::white</code>, …).
 
; <code>Math::Rect2</code>
 
: 2D rectangle — used for [[#Gfx::SpriteAtlas|atlas]] sub-rectangles.
 
  
== Where to see it all together ==
+
Public interface (<code>Math/Rect2.h</code>):
  
The Development Kit ships complete buildable projects using every class above: ''Basics'' (1–4), ''Rendering'', ''Topology'', ''Network'' (messaging between modules), and ''GFX Engine Sample Projects'' (1–3: Twinkle, SnotFlow, …) — create them via the [https://marketplace.visualstudio.com/items?itemName=cubios-inc.WOWCubeSDK WOWCube SDK extension for VS Code].
+
Rect2();
 +
Rect2(const Vec2i& topLeft, const Vec2i& bottomRight);
 +
Rect2(int16_t x, int16_t y, int16_t width, int16_t height);
 +
void Set(const Vec2i& topLeft, const Vec2i& bottomRight);
 +
bool IsInside(const Vec2i& p) const;
 +
Vec2i Midpoint() const;
  
 
[[Category:SDK 6.3]]
 
[[Category:SDK 6.3]]
 
[[Category:C++ API]]
 
[[Category:C++ API]]

Revision as of 09:39, 26 July 2026

Official WOWCube SDK documentation. SDK 6.3, C++ (WebAssembly) API. Signatures are extracted from the canonical SDK headers shipped with the WOWCube Development Kit; the headers remain authoritative.

SDK 6.3 · PAWN API: Core · Graphics · Topology · Sound · Motion Sensor · Leaderboard · Splash Screen · Physics · Network · Save · Scramble · Logging
C++: Native API · Application · GFX Engine  ·  Rust: Rust API (experimental)  ·  Changelog


SDK 6.3 · C++ / GFX Engine

The object-oriented retained layer of the C++ SDK (namespace Cubios): a scene graph with sprites, text, backgrounds, sounds and math primitives. It sits on top of the native ABI and is driven by the Application framework. Public signatures below are extracted from the SDK 6.3 headers.

Scene

The retained scene graph owned by every Application (field app.Scene). Holds scene objects and renders them per screen.

Public interface (Scene.h):

Scene();
virtual ~Scene();
uint32_t CreateObject(SceneObject* obj);
bool CreateObjectWithID(uint32_t id, SceneObject* obj);
uint32_t CreateSound(Sound* obj);
bool CreateSoundWithID(uint32_t id, Sound* obj);
bool DisposeObjectWithID(uint32_t id);
bool DisposeSoundWithID(uint32_t id);
void DisposeAllObjects();
void Play(uint32_t id, uint8_t volume);

SceneObject

Base class of every visual object in the scene graph. Provides position, rotation, scale, opacity, z-order, per-screen placement and lifecycle.

Public interface (SceneObject.h):

SceneObject():Parent(nullptr),ScreenAngle(0),Visible(true),InBegin(false);
virtual ~SceneObject();
virtual void Render() = 0;
SceneObject* SetColor(uint32_t v);
SceneObject* SetA(uint8_t a);
SceneObject* SetAf(float a);
SceneObject* SetAfSafe(float a);
SceneObject* SetR(uint8_t r);
SceneObject* SetG(uint8_t g);
SceneObject* SetB(uint8_t b);
SceneObject* SetVisible(bool v);
SceneObject* SetTransform(const Math::Transform& t);
SceneObject* SetPosition(const Math::Vec2& p);
SceneObject* SetPosition(float x, float y);
SceneObject* SetRotation(int r);
SceneObject* SetMirroring(unsigned int m);
SceneObject* SetScale(unsigned int s);
SceneObject* SetScale(unsigned int sx, unsigned int sy);
SceneObject* SetXScale(unsigned int s);
SceneObject* SetYScale(unsigned int s);
const Math::Vec2 ScreenPosition();
if(this->Parent==nullptr) return pos;
switch(ScreenAngle);
pos.Set(this->Transform.Position.X,this->Transform.Position.Y);
pos.Set(240-this->Transform.Position.Y,this->Transform.Position.X);
pos.Set(240-this->Transform.Position.X,240-this->Transform.Position.Y);
pos.Set(this->Transform.Position.Y,240-this->Transform.Position.X);
SceneObject* Move(const Math::Vec2& v);
SceneObject* Move(float dx, float dy);
if(this->Parent==nullptr) return this;
if(!this->InBegin);
LOG_w("SceneObject: Move() can only be called within Begin/End block!\n");

Screen

One of the three displays of the current module; passed to on_Render() / on_PhysicsTick(). Render target selector.

Public interface (Screen.h):

Screen(uint8_t id);
void SetOrientation(TOPOLOGY_orientation_mode_t mode);
uint8_t Position() const;
TOPOLOGY_orientation_t Direction() const;
uint8_t OppositeFace() const;
uint8_t Face() const;
inline uint8_t ID() const;
inline uint32_t Angle() const;
SceneObject* Add(SceneObject* obj);
SceneObject* AddCopy(SceneObject* obj);
void Begin(TOPOLOGY_orientation_mode_t mode = Cubios::ORIENTATION_MODE_MENU,bool autorotation = false);
void End();
inline bool IsAutorotation();

Object

Minimal reference-counted base class for engine resources.

Public interface (Object.h):

Object();
virtual ~Object();
inline void SetId(int16_t id);

Gfx::Background

Full-screen background image object.

Public interface (Gfx/Background.h):

Background(uint32_t color);
Background(uint8_t R, uint8_t G, uint8_t B);
Background(uint8_t R, uint8_t G, uint8_t B, uint8_t A);
virtual ~Background();
void Render() override;
Cubios::SceneObject* SetColor(uint32_t color);
Cubios::SceneObject* SetColor(uint8_t R, uint8_t G, uint8_t B);
Cubios::SceneObject* SetColor(uint8_t R, uint8_t G, uint8_t B, uint8_t A);

Gfx::Sprite

Static image sprite bound to an image asset by name.

Public interface (Gfx/Sprite.h):

Sprite(std::string name, const Cubios::Math::Transform& t);
Sprite(std::string name, float x, float y);
Sprite(std::string name);
Sprite(const Sprite& sprite);
virtual ~Sprite();
void Render() override;

Gfx::AnimatedSprite

Frame-animated sprite.

Public interface (Gfx/AnimatedSprite.h):

AnimatedSprite(std::vector<std::string>& names, const Cubios::Math::Transform& t);
AnimatedSprite(std::vector<std::string>& names, float x, float y);
AnimatedSprite(std::vector<std::string>& names);
AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame, const Cubios::Math::Transform& t);
AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame, float x, float y);
AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame);
AnimatedSprite(const AnimatedSprite& sprite);
AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas, const Cubios::Math::Transform& t);
AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas, float x, float y);
AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas);
virtual ~AnimatedSprite();
void Render() override;
int16_t Tick(uint32_t dt);
Cubios::SceneObject* SetFrame(int16_t frameNumber);
Cubios::SceneObject* SetPlaybackSpeed(int16_t speed);
Cubios::SceneObject* SetPlaybackMode(playbackMode_t mode);
int16_t PrevFrame();
int16_t NextFrame();

Gfx::SpriteAtlas

Sprite atlas: a sheet of sub-images rendered via SpriteAtlasElement. Added in SDK 6.2.

Public interface (Gfx/SpriteAtlas.h):

SpriteAtlas(std::string name, Cubios::Scene* scene);
virtual ~SpriteAtlas();
bool AddSprite(uint32_t id, const Cubios::Math::Rect2& rc);
bool RemoveSprite(uint32_t id);
T* Get(uint32_t ind);
inline size_t Count();
inline std::vector<uint32_t>* ElementsInsertionOrder();

Gfx::SpriteAtlasElement

One element (sub-rectangle) of a SpriteAtlas.

Public interface (Gfx/SpriteAtlas.h):

SpriteAtlasElement(SpriteAtlasBase* host, const Cubios::Math::Rect2& rc);
virtual ~SpriteAtlasElement();
void Render() override;
virtual SpriteAtlasElement* Copy();
inline Cubios::Math::Rect2* Rect();

Gfx::Text

Text object with scale, alignment and color.

Public interface (Gfx/Text.h):

Text(std::string text, const Cubios::Math::Transform& t, uint32_t fontSize, const Cubios::Math::Color& color, Cubios::text_align_t al = Cubios::text_align_t::TEXT_ALIGN_CENTER);
Text(std::string text, const Cubios::Math::Transform& t, uint32_t fontSize = 10, Cubios::text_align_t al = Cubios::text_align_t::TEXT_ALIGN_CENTER);
Text(std::string text, float x, float y, uint32_t fontSize = 10);
Text(std::string text, float x, float y, uint32_t fontSize, const Cubios::Math::Color& color);
virtual ~Text();
void Render() override;
Cubios::SceneObject* SetContent(std::string text);
Cubios::SceneObject* FormatContent(char const* format,...);
Cubios::SceneObject* SetFontSize(uint32_t fontSize);

Gfx::QRCode

QR-code object rendered on screen. Added in SDK 6.0.

Public interface (Gfx/QRCode.h):

QRCode(std::string data, const Cubios::Math::Transform& t);
QRCode(std::string data, float x, float y);
QRCode(std::string data, const Cubios::Math::Transform& t, u32_t size);
QRCode(std::string data, float x, float y, u32_t size);
QRCode(const QRCode& qr);
virtual ~QRCode();
Cubios::SceneObject* SetSize(u32_t size);
Cubios::SceneObject* SetColor(const Math::Color& color);
Cubios::SceneObject* SetBackgroundColor(const Math::Color& color);
Cubios::SceneObject* SetData(std::string data);
void Render() override;

Gfx::OffscreenRenderTarget

Offscreen render target (baked image) usable as a scene object.

Public interface (Gfx/OffscreenRenderTarget.h):

OffscreenRenderTarget(u32_t width, u32_t height, Cubios::GFX_PixelFormat_t format);
virtual ~OffscreenRenderTarget();
Cubios::SceneObject* Add(Cubios::SceneObject* obj);
Cubios::SceneObject* AddCopy(Cubios::SceneObject* obj);
void Begin(bool overwrite=false);
void End();
void Render() override;
virtual void RenderLayer(renderLayerOrder_t order);

Sound

A sound asset; play, stop and query state.

Public interface (Sound.h):

explicit Sound(const std::string& name);
~Sound();
void Play(uint8_t volume = 100);
static void Stop();
static bool IsPlaying();

SoundCollection

A set of sounds with random playback helpers. Added in SDK 6.2.

Public interface (Sound.h):

SoundCollection(std::vector<std::string>& names);
SoundCollection(std::vector<Cubios::Sound*>& sounds);
virtual ~SoundCollection();
bool PlayRandomSound(uint8_t volume = 100, bool stopCurrent = true);
bool RepeatRandomSounds(uint8_t volume, int delayMin, int delayMax, int deltaTime);
void Stop();
bool IsPlaying();

NetworkMessage

Bit-packed serializer for inter-module messages (write/read ints, signed ints, floats).

Public interface (NetworkMessage.h):

NetworkMessage(uint8_t* data=NULL,int length=MESSAGE_SIZE_MAX);
virtual ~NetworkMessage();
void Print();
void WriteInt(int value, int bits);
void WriteByte(uint8_t value);
void WriteSignedInt(int value, int bits);
void WriteBool(bool value);
void WriteFloat(float value);
int ReadInt(int bits);
int ReadSignedInt(int bits);
uint8_t ReadByte();
bool ReadBool();
float ReadFloat();
uint8_t* GetData(int& length);
void SetData(uint8_t* data, int length);
inline void Reset(bool zero=false);

SaveMessage

Serializer for persistent state (used with SaveState() / LoadState()). Added in SDK 6.0.

Public interface (SaveMessage.h):

SaveMessage(uint8_t* data=NULL,int length=GAME_SAVE_SIZE);
virtual ~SaveMessage();
void Print();
void WriteInt(int value, int bits);
void WriteByte(uint8_t value);
void WriteSignedInt(int value, int bits);
void WriteBool(bool value);
void WriteFloat(float value);
int ReadInt(int bits);
int ReadSignedInt(int bits);
uint8_t ReadByte();
bool ReadBool();
float ReadFloat();
uint8_t* GetData(int& length);
void SetData(uint8_t* data, int length);
inline void Reset(bool zero=false);

Scramble

Cube-scramble helper. Added in SDK 6.0.

Public interface (Scramble.h):

Scramble();
~Scramble();
void StartScramble(uint8_t twistsCount);
void VirtualTwist(uint8_t screen, uint8_t direction);
virtual void on_BeforeTwist() = 0;
virtual void on_MappingChanged(uint8_t moduleTo, uint8_t screenTo, uint8_t moduleFrom, uint8_t screenFrom) = 0;
virtual void on_Twist(const Cubios::TOPOLOGY_twistInfo_t twist) = 0;

Splashscreen

Standard splash screen with leaderboard support (reworked in SDK 6.2).

Public interface (Splashscreen.h):

Splashscreen(Cubios::Application *app, SplsParms::e_LeadersDataType dataType);
~Splashscreen();
virtual void Render(Cubios::Screen* screen);
virtual void Tick(uint32_t currentTime, uint32_t deltaTime);
uint32_t GetPersonalBest();
void SetRecord(uint32_t value);
void SetNamedValue(uint8_t idx, std::string name, uint32_t value, SplsParms::e_LeadersDataType type = SplsParms::e_LeadersDataType::typeNumber);
void SetSeparator(std::string s);
void SetLabel(SplsParms::e_LabelTypes idx, std::string text);
void SetApplicationName(std::string name);
void SetLeaderBoardTable(SplsParms::e_LeaderBoardType type);
void SetLeaderBoardTable(uint32_t (&lbTable)[TOPOLOGY_FACES_MAX][TOPOLOGY_POSITIONS_MAX]);
void SetPlaybackSpeed(SplsParms::e_LabelTypes idx, uint32_t speed);
void SetQRCodeLink(std::string link);
void SetColors(Cubios::Math::Color key, Cubios::Math::Color base);
void SetTopology(uint8_t screen, Cubios::TOPOLOGY_place_t p);
void GetTopology(TOPOLOGY_orientation_mode_t mode, bool replaceFaceToOrientation);
virtual void RenderUserDefinedScreen(uint8_t type);

Math::Vec2

2D float vector.

Public interface (Math/Vec2.h):

Vec2();
Vec2(const float _x, const float _y);
Vec2(const Vec2& vec);
Vec2(const float* p);
void Set(const float _x, const float _y);
void Set(const Vec2& vec);
void Set(const float* p);
float Len() const;
void Norm();
bool IsEqual(const Vec2& v, const float tol) const;
int Compare(const Vec2& v, float tol) const;

Math::Vec2i

2D integer vector.

Public interface (Math/Vec2.h):

Vec2i();
Vec2i(const int16_t _x, const int16_t _y);
Vec2i(const Vec2i& vec);
Vec2i(const int16_t* p);
void Set(const int16_t _x, const int16_t _y);
void Set(const Vec2i& vec);
void Set(const int16_t* p);
float Len() const;
void Norm();
bool IsEqual(const Vec2i& v, const float tol) const;
int Compare(const Vec2i& v, float tol) const;

Math::Transform

Position + rotation + mirroring transform of a scene object.

Public interface (Math/Transform.h):

Transform():Position(0,0),Rotation(0),Mirroring(0),ScaleX(100),ScaleY(100);
Transform(float x, float y): Position(x,y),Rotation(0),Mirroring(0),ScaleX(100),ScaleY(100);
Transform(float x, float y, unsigned int a): Position(x,y),Rotation(a),Mirroring(0),ScaleX(100),ScaleY(100);
Transform(float x, float y, unsigned int a, unsigned int sx, unsigned int sy ): Position(x,y),Rotation(a),Mirroring(0),ScaleX(sx),ScaleY(sy);
Transform(float x, float y, unsigned int a, unsigned int m): Position(x,y),Rotation(a),Mirroring(m),ScaleX(100),ScaleY(100);
Transform(float x, float y, unsigned int a, unsigned int sx, unsigned int sy, unsigned int m): Position(x,y),Rotation(a),Mirroring(m),ScaleX(sx),ScaleY(sy);
Transform(const Transform& t): Position(t.Position),Rotation(t.Rotation),Mirroring(t.Mirroring),ScaleX(t.ScaleX),ScaleY(t.ScaleY);
int SafeRotation();

Math::Color

RGBA color with float/byte accessors (see also Gfx/Colors.h named constants).

Public interface (Math/Color.h):

Color():_R(255),_G(255),_B(255),_A(255),_Value(0xFFFFFFFF);
Color(uint8_t r, uint8_t g, uint32_t b):_R(r),_G(g),_B(b),_A(255);
Color(uint8_t r, uint8_t g, uint32_t b, uint8_t a):_R(r),_G(g),_B(b),_A(a);
Color(uint32_t v):_Value(v);
this->_B = (v & 0x000000ff);
this->_G = (v & 0x0000ff00) >> 8;
this->_R = (v & 0x00ff0000) >> 16;
this->_A = (v & 0xff000000) >> 24;
void Set(uint8_t r, uint8_t g, uint32_t b, uint8_t a);
void Set(uint8_t r, uint8_t g, uint32_t b);
void Set(uint32_t v);
inline void SetA(uint8_t a);
inline void SetAf(float a);
inline void SetAfSafe(float a);
inline void SetR(uint8_t r);
inline void SetG(uint8_t g);
inline void SetB(uint8_t b);
inline uint8_t A();
inline float Af();
inline uint8_t R();
inline uint8_t G();
inline uint8_t B();
inline uint32_t Value();

Math::Rect2

2D rectangle.

Public interface (Math/Rect2.h):

Rect2();
Rect2(const Vec2i& topLeft, const Vec2i& bottomRight);
Rect2(int16_t x, int16_t y, int16_t width, int16_t height);
void Set(const Vec2i& topLeft, const Vec2i& bottomRight);
bool IsInside(const Vec2i& p) const;
Vec2i Midpoint() const;