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. Circles.h
Mission NodeSDK 6.1C++renderingProject Included

Circles.h

Example: Circles.h

Examples / SDK 6.1 / C++ / rendering / Simple Shapes - Circles / project / src
Circles.h
CPP
1// This header file is generated by WOWCube SDK project wizard
2#pragma once
3#include "Gfx.h"
4
5#define DISPLAY_CENTER_X 120
6#define DISPLAY_CENTER_Y 120
7
8#define SCREEN_WIDTH 240
9#define SCREEN_HEIGHT 240
10
11#define NUM_MAGNETS 4
12#define PARTICLES_PER_MAGNET 15
13#define MAGNETIC_FORCE_THRESHOLD 300
14
15enum MyColors
16{
17 marsh=0xFF161D24
18};
19
20typedef struct
21{
22 float x;
23 float y;
24 float size;
25 float orbit;
26} Magnet_t;
27
28typedef struct
29{
30 float x;
31 float y;
32 float shx;
33 float shy;
34 float angle;
35 float size;
36 float speed;
37 float force;
38 int magnet;
39 float orbit;
40} Particle_t;
41
42class Circles: public Cubios::Application
43{
44public:
45 Circles();
46 virtual ~Circles();
47
48 virtual void on_PhysicsTick(const std::array<Cubios::Screen, 3>& screens) override;
49 virtual void on_Twist(const Cubios::TOPOLOGY_twistInfo_t& twist) override;
50 virtual void on_Message(uint32_t type, uint8_t* pkt, u32_t size) override;
51 virtual void on_ExternalMessage(uint8_t* pkt, u32_t size) override;
52 virtual void on_Tap(uint32_t count) override;
53 virtual void on_Render(std::array<Cubios::Screen, 3>& screens) override;
54 virtual void on_Tick(uint32_t currentTime, uint32_t deltaTime) override;
55 virtual void on_Timer(uint8_t timerID) override;
56
57 void InitializeResources();
58
59private:
60 void createMagnet(float x,float y);
61 void moveMagnets();
62 void createParticles(float x, float y, int magnet);
63 void renderParticles();
64
65 float distanceSquared(float x1, float y1, float x2, float y2);
66private:
67 //array of attractors ("magnets")
68 Magnet_t magnets[NUM_MAGNETS];
69 int numMagnets;
70 int magnetsShift;
71
72 //array of particles
73 Particle_t particles[NUM_MAGNETS*PARTICLES_PER_MAGNET];
74 int numParticles;
75};
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Project files

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

Related nodes

Circles.cpp
Examples / SDK 6.1 / C++ / rendering / Simple Shapes - Circles / project / src
Simple Shapes - Circles
Examples / SDK 6.1 / C++ / rendering
info.json
Examples / SDK 6.1 / C++ / rendering / Simple Shapes - Circles
wowcubeapp-build.json
Examples / SDK 6.1 / C++ / rendering / Simple Shapes - Circles / project
Previous Node
Circles.cpp
Examples / SDK 6.1 / C++ / rendering / Simple Shapes - Circles / project / src
Next Node
wowcubeapp-build.json
Examples / SDK 6.1 / C++ / rendering / Simple Shapes - Circles / project