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

GfxBitmaps.h

Example: GfxBitmaps.h

Examples / SDK 6.2 / C++ / rendering / Gfx Engine - Bitmaps / project / src
GfxBitmaps.h
CPP
1// This header file is generated by WOWCube SDK project wizard
2#pragma once
3
4#include "Gfx.h"
5
6enum GfxObjects
7{
8 myBackground=0,
9 mySide11,mySide12,mySide13,mySide14,
10 mySide21,mySide22,mySide23,mySide24,
11 mySide31,mySide32,mySide33,mySide34,
12 mySide41,mySide42,mySide43,mySide44,
13 myText
14};
15
16typedef struct
17{
18 int side;
19 int place;
20 int xOffset;
21}Sprite_t;
22
23class Aperture
24{
25 public:
26 Aperture():Offset(0),
27 top {{0,2,0},{0,3,240},{1,2,480},{1,3,720},{2,2,960},{2,3,1200},{3,2,1440},{3,3,1680},{0,2,1920},{0,3,2160},{1,2,2400},{1,3,2640}},
28 bottom{{0,1,0},{0,0,240},{1,1,480},{1,0,720},{2,1,960},{2,0,1200},{3,1,1440},{3,0,1680},{0,1,1920},{0,0,2160},{1,1,2400},{1,0,2640}}
29 {
30
31 }
32
33 void Tick()
34 {
35 this->Offset+=2;
36 if(this->Offset>1920) this->Offset = this->Offset-1920;
37 }
38
39 void GetSprites(Cubios::TOPOLOGY_orientation_t side, int position, std::vector<Sprite_t>* sprites )
40 {
41 int first;
42 int last;
43 int offset = this->Offset;
44 int pos_offset = 0;
45
46 if(position==0 || position==3) pos_offset = 240;
47
48 switch(side)
49 {
50 case Cubios::TOPOLOGY_orientation_t::ORIENTATION_FRONT:
51 break;
52 case Cubios::TOPOLOGY_orientation_t::ORIENTATION_RIGHT:
53 offset+=480;
54 break;
55 case Cubios::TOPOLOGY_orientation_t::ORIENTATION_BACK:
56 offset+=480*2;
57 break;
58 case Cubios::TOPOLOGY_orientation_t::ORIENTATION_LEFT:
59 offset+=480*3;
60 break;
61 default:
62 break;
63 }
64
65
66 if(offset>1920) offset = offset-1920;
67
68 first = (offset+pos_offset) / 240;
69 last = ((offset+480+pos_offset) / 240);
70
71 if(position==2 || position==3)
72 {
73 for(int i=first;i<last+1;i++)
74 {
75 Sprite_t st = this->top[i];
76 st.xOffset = this->top[i].xOffset-(offset+pos_offset);
77 sprites->push_back(st);
78 }
79 }
80 else
81 {
82 for(int i=first;i<last+1;i++)
83 {
84 Sprite_t st = this->bottom[i];
85 st.xOffset = this->bottom[i].xOffset-(offset+pos_offset);
86 sprites->push_back(st);
87 }
88 }
89 }
90
91 uint32_t Sides[4][4];
92
93 Sprite_t top[12];
94 Sprite_t bottom[12];
95
96 int Offset;
97};
98
99class GfxBitmaps: public Cubios::Application
100{
101public:
102 GfxBitmaps();
103 virtual ~GfxBitmaps();
104
105 virtual void on_PhysicsTick(const std::array<Cubios::Screen, 3>& screens) override;
106 virtual void on_Twist(const Cubios::TOPOLOGY_twistInfo_t& twist) override;
107 virtual void on_Message(uint32_t type, uint8_t* pkt, u32_t size) override;
108 virtual void on_ExternalMessage(uint8_t* pkt, u32_t size) override;
109 virtual void on_Pat(uint32_t count) override;
110 virtual void on_Render(std::array<Cubios::Screen, 3>& screens) override;
111 virtual void on_Tick(uint32_t currentTime, uint32_t deltaTime) override;
112 virtual void on_Timer(uint8_t timerID) override;
113
114 void InitializeResources();
115
116private:
117 Cubios::Math::Vec2 offsets[4];
118
119 uint32_t frontSide[4];
120 uint32_t rightSide[4];
121 uint32_t backSide[4];
122 uint32_t leftSide[4];
123
124 Aperture scroller;
125
126 Cubios::NetworkMessage networkMessage;
127
128};
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Project files

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

Related nodes

GfxBitmaps.cpp
Examples / SDK 6.2 / C++ / rendering / Gfx Engine - Bitmaps / project / src
Gfx Engine - Bitmaps
Examples / SDK 6.2 / C++ / rendering
info.json
Examples / SDK 6.2 / C++ / rendering / Gfx Engine - Bitmaps
wowcubeapp-build.json
Examples / SDK 6.2 / C++ / rendering / Gfx Engine - Bitmaps / project
Previous Node
GfxBitmaps.cpp
Examples / SDK 6.2 / C++ / rendering / Gfx Engine - Bitmaps / project / src
Next Node
wowcubeapp-build.json
Examples / SDK 6.2 / C++ / rendering / Gfx Engine - Bitmaps / project