1// This PAWN script is generated by WOWCube SDK project wizard
2
3#define G2D
4
5#pragma warning disable 203
6#pragma warning disable 213
7#pragma warning disable 229
8
9// Includes
10// -----------------------------
11
12#include "wowcore.inc"
13#include "topology.inc"
14#include "graphics.inc"
15#include "motion_sensor.inc"
16#include "math.inc"
17#include "log.inc"
18
19// Application defines
20// -----------------------------
21#define TEXT_SIZE 8
22
23// Application variables
24// -----------------------------
25new images[TOPOLOGY_FACES_MAX * TOPOLOGY_POSITIONS_MAX];
26new offsets[TOPOLOGY_FACES_MAX] = [180, 270, 90, 270, 0, 0];
27
28// WOWCube application callbacks
29// -----------------------------
30
31//Applicaton initialization callback. Called once when CUB application starts
32public ON_Init(id, size, const pkt[])
33{
34 LOG_i("\n");
35 LOG_i("*** WOWCube SDK Example \"Topology - Cubemap\" ***\n\n");
36
37 LOG_i("Cubeapp is initializing...\n");
38 LOG_i("Cubeapp is started on module %d\n",SELF_ID);
39
40 //Load images that form a cubemap
41 images[0] = GFX_getAssetId("front1.png");
42 images[1] = GFX_getAssetId("front2.png");
43 images[2] = GFX_getAssetId("front3.png");
44 images[3] = GFX_getAssetId("front4.png");
45
46 images[4] = GFX_getAssetId("up4.png");
47 images[5] = GFX_getAssetId("up1.png");
48 images[6] = GFX_getAssetId("up2.png");
49 images[7] = GFX_getAssetId("up3.png");
50
51 images[8] = GFX_getAssetId("left2.png");
52 images[9] = GFX_getAssetId("left3.png");
53 images[10] = GFX_getAssetId("left4.png");
54 images[11] = GFX_getAssetId("left1.png");
55
56 images[12] = GFX_getAssetId("back4.png");
57 images[13] = GFX_getAssetId("back1.png");
58 images[14] = GFX_getAssetId("back2.png");
59 images[15] = GFX_getAssetId("back3.png");
60
61 images[16] = GFX_getAssetId("right3.png");
62 images[17] = GFX_getAssetId("right4.png");
63 images[18] = GFX_getAssetId("right1.png");
64 images[19] = GFX_getAssetId("right2.png");
65
66 images[20] = GFX_getAssetId("down3.png");
67 images[21] = GFX_getAssetId("down4.png");
68 images[22] = GFX_getAssetId("down1.png");
69 images[23] = GFX_getAssetId("down2.png");
70}
71
72//Saved application state data load callback. Gets called in response to loadState() function call
73public ON_Load(id, size, const pkt[])
74{
75}
76
77//Main run loop callback. Gets called recurrently by the CUB application as frequent as application code allows.
78public ON_Tick()
79{
80}
81
82//This callback is gets called immediately after ON_Tick(). Use it for calling your rendering code.
83public ON_Render()
84{
85 new facelet[TOPOLOGY_FACELET] = [0, 0];
86 new place[TOPOLOGY_PLACE];
87 facelet.module = SELF_ID;
88
89 //Iterate through all three displays to render the image
90 for (facelet.screen = 0; facelet.screen < SCREENS_MAX; facelet.screen++)
91 {
92 GFX_setRenderTarget(facelet.screen);
93
94 place = TOPOLOGY_getPlace(facelet);
95 //draw image at the center of a screen
96 GFX_drawImage([120, 120], 0xFF, 0, 100, 100, (360 + offsets[place.face] - place.position * 90) % 360, MIRROR_BLANK, images[place.face * TOPOLOGY_POSITIONS_MAX + place.position]);
97 GFX_render();
98 }
99}
100
101//The "physics" callback. Gets called recurrently with 30ms resolution.
102public ON_PhysicsTick()
103{
104}
105
106//The "inner network" callback. Gets called when WOWCube module receives a data packet from other module
107public ON_Packet(type, size, const pkt[])
108{
109}
110
111//The cube topology change callback. Gets called when cube is twisted and its topological desctiption has been changed
112public ON_Twist(twist[TOPOLOGY_TWIST_INFO])
113{
114 if (SELF_ID == 0)
115 {
116 }
117 else
118 {
119 }
120}
121
122//Screen pat callback.
123public ON_Pat(const count, const display, const bool:opposite)
124{
125 if (SELF_ID == 0)
126 {
127 }
128 else
129 {
130 }
131}
132
133//Application quit callback.
134public ON_Quit()
135{
136}
137
138// User-defined functions
139// -----------------------------