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. main.pwn
Mission NodeSDK 6.1PawnbasicsProject Included

main.pwn

Example: main.pwn

Examples / SDK 6.1 / Pawn / basics / Getting Started / project / src
main.pwn
C
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
18// Application defines
19// -----------------------------
20#define TEXT_SIZE 10
21
22// Application constants
23// ------------------------------
24new const Colors[.white, .black, .red, .green, .blue] =
25[
26 0xFFFFFFFF,
27 0xFF000000,
28 0xFFFF0000,
29 0xFF00FF00,
30 0xFF0000FF,
31];
32
33// WOWCube application callbacks
34// -----------------------------
35
36//Applicaton initialization callback. Called once when CUB application starts
37public ON_Init(id, size, const pkt[])
38{
39}
40
41//Saved application state data load callback. Gets called in response to loadState() function call
42public ON_Load(id, size, const pkt[])
43{
44}
45
46//Main run loop callback. Gets called recurrently by the CUB application as frequent as application code allows.
47public ON_Tick()
48{
49}
50
51//This callback is gets called immediately after ON_Tick(). Use it for calling your rendering code.
52public ON_Render()
53{
54
55 //get ready to render on screen 1
56 GFX_setRenderTarget(0);
57
58 //fill the screen with black color
59 GFX_clear(Colors.black);
60
61 //render text
62 GFX_drawText([ 120,100 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, Colors.white, "HELLO");
63 GFX_drawText([ 120,140 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, Colors.white, "WOWCUBE");
64
65 //render screen buffer
66 GFX_render();
67
68
69 //get ready to render on screen 2
70 GFX_setRenderTarget(1);
71
72 //fill the screen with black color
73 GFX_clear(Colors.black);
74
75 //render text
76 GFX_drawText([ 120,100 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, Colors.white, "HELLO");
77 GFX_drawText([ 120,140 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, Colors.white, "WOWCUBE");
78
79 //render screen buffer
80 GFX_render();
81
82
83 //get ready to render on screen 3
84 GFX_setRenderTarget(2);
85
86 //fill the screen with black color
87 GFX_clear(Colors.black);
88
89 //render text
90 GFX_drawText([ 120,100 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, Colors.white, "HELLO");
91 GFX_drawText([ 120,140 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, Colors.white, "WOWCUBE");
92
93 //render screen buffer
94 GFX_render();
95}
96
97//The "physics" callback. Gets called recurrently with 30ms resolution.
98public ON_PhysicsTick()
99{
100}
101
102//The "inner network" callback. Gets called when WOWCube module receives a data packet from other module
103public ON_Packet(type, size, const pkt[])
104{
105}
106
107//The cube topology change callback. Gets called when cube is twisted and its topological desctiption has been changed
108public ON_Twist(twist[TOPOLOGY_TWIST_INFO])
109{
110}
111
112//Device shake detection callback.
113public ON_Shake(const count)
114{
115}
116
117//Screen tap callback.
118public ON_Tap(const count, const display, const bool:opposite)
119{
120 if (SELF_ID == 0)
121 {
122 }
123 else
124 {
125 }
126}
127
128//Application quit callback.
129public ON_Quit()
130{
131 //
132 //Save game data here
133 //
134}
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Project files

main.pwn
project/src/main.pwn
wowcubeapp-build.json
project/wowcubeapp-build.json
Context Rail

Related nodes

Getting Started
Examples / SDK 6.1 / Pawn / basics
info.json
Examples / SDK 6.1 / Pawn / basics / Getting Started
wowcubeapp-build.json
Examples / SDK 6.1 / Pawn / basics / Getting Started / project
Time and Timers
Examples / SDK 6.1 / Pawn / basics
Previous Node
info.json
Examples / SDK 6.1 / Pawn / basics / Getting Started
Next Node
wowcubeapp-build.json
Examples / SDK 6.1 / Pawn / basics / Getting Started / project