-
-
Save ampatspell/62ea32ab4255bf4e06c1f14cee6e46d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Project: First | |
// World: First | |
// Scenes: 2 | |
#include <avr/pgmspace.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <tiny/scene/layer.h> | |
#include <tiny/scene/node.h> | |
#include <tiny/scene/scene.h> | |
namespace Tiny { | |
namespace Scenes { | |
// Scene: s1 | |
namespace Scene_0 { | |
const uint8_t scene[] PROGMEM = { | |
128, // width | |
64, // height | |
1 // background: black | |
}; | |
const uint8_t layer_0[] PROGMEM = { | |
8, // grid width | |
8, // grid height | |
}; | |
const uint8_t layer_0_node_0[] PROGMEM = { | |
104, // x | |
40, // y | |
3, // sprite | |
0 // frame | |
}; | |
const size_t layer_0_node_0_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1[] PROGMEM = { | |
8, // grid width | |
8, // grid height | |
}; | |
const uint8_t layer_1_node_0[] PROGMEM = { | |
0, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_0_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_1[] PROGMEM = { | |
16, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_1_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_2[] PROGMEM = { | |
32, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_2_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_3[] PROGMEM = { | |
48, // x | |
48, // y | |
4, // sprite | |
1 // frame | |
}; | |
const size_t layer_1_node_3_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_4[] PROGMEM = { | |
64, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_4_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_5[] PROGMEM = { | |
80, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_5_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_6[] PROGMEM = { | |
96, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_6_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_1_node_7[] PROGMEM = { | |
112, // x | |
48, // y | |
4, // sprite | |
0 // frame | |
}; | |
const size_t layer_1_node_7_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_2[] PROGMEM = { | |
}; | |
const uint8_t layer_2_node_0[] PROGMEM = { | |
33, // x | |
48, // y | |
1, // sprite | |
0 // loop | |
}; | |
const size_t layer_2_node_0_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_2_node_1[] PROGMEM = { | |
42, // x | |
37, // y | |
2, // sprite | |
0 // loop | |
}; | |
const size_t layer_2_node_1_size = sizeof(SpriteLoopNode); | |
const size_t scene_size = sizeof(Scene) + (sizeof(Layer *) * 3) + sizeof(GridLayer) + (sizeof(Node *) * 1) + sizeof(SpriteFrameNode) + sizeof(GridLayer) + (sizeof(Node *) * 8) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(SpriteFrameNode) + sizeof(PixelLayer) + (sizeof(Node *) * 2) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode); | |
} | |
// Scene: s2 | |
namespace Scene_1 { | |
const uint8_t scene[] PROGMEM = { | |
128, // width | |
64, // height | |
2 // background: white | |
}; | |
const uint8_t layer_0[] PROGMEM = { | |
}; | |
const uint8_t layer_0_node_0[] PROGMEM = { | |
58, // x | |
47, // y | |
1, // sprite | |
0 // frame | |
}; | |
const size_t layer_0_node_0_size = sizeof(SpriteFrameNode); | |
const uint8_t layer_0_node_1[] PROGMEM = { | |
56, // x | |
47, // y | |
0, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_1_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_2[] PROGMEM = { | |
76, // x | |
39, // y | |
3, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_2_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_3[] PROGMEM = { | |
0, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_3_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_4[] PROGMEM = { | |
16, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_4_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_5[] PROGMEM = { | |
32, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_5_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_6[] PROGMEM = { | |
48, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_6_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_7[] PROGMEM = { | |
64, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_7_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_8[] PROGMEM = { | |
80, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_8_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_9[] PROGMEM = { | |
96, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_9_size = sizeof(SpriteLoopNode); | |
const uint8_t layer_0_node_10[] PROGMEM = { | |
112, // x | |
48, // y | |
4, // sprite | |
0 // loop | |
}; | |
const size_t layer_0_node_10_size = sizeof(SpriteLoopNode); | |
const size_t scene_size = sizeof(Scene) + (sizeof(Layer *) * 1) + sizeof(PixelLayer) + (sizeof(Node *) * 11) + sizeof(SpriteFrameNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode) + sizeof(SpriteLoopNode); | |
} | |
union SceneSizes { | |
size_t scene_0[Scene_0::scene_size]; | |
size_t scene_1[Scene_1::scene_size]; | |
}; | |
const uint8_t numberOfScenes = 2; | |
const size_t storageSize = sizeof(SceneSizes); | |
size_t getStorageSize() { | |
return storageSize; | |
} | |
uint8_t getNumberOfScenes() { | |
return numberOfScenes; | |
} | |
uint8_t _storage[storageSize]; | |
Scene *instantiate(uint8_t index) { | |
if(index == 0) { | |
uint8_t *storage = _storage; | |
Layer **layers = reinterpret_cast<Layer **>(storage + sizeof(Scene)); | |
Scene *scene = new (storage) Scene(Scene_0::scene, layers); | |
storage += sizeof(Scene); | |
storage += (sizeof(Layer *) * 3); | |
{ | |
Node **nodes = reinterpret_cast<Node **>(storage + sizeof(GridLayer)); | |
GridLayer *layer = new (storage) GridLayer(Scene_0::layer_0, nodes); | |
storage += sizeof(GridLayer); | |
storage += (sizeof(Node *) * 1); | |
scene->addLayer(layer); | |
{ | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_0_node_0); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
} | |
} | |
{ | |
Node **nodes = reinterpret_cast<Node **>(storage + sizeof(GridLayer)); | |
GridLayer *layer = new (storage) GridLayer(Scene_0::layer_1, nodes); | |
storage += sizeof(GridLayer); | |
storage += (sizeof(Node *) * 8); | |
scene->addLayer(layer); | |
{ | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_0); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_1); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_2); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_3); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_4); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_5); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_6); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_0::layer_1_node_7); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
} | |
} | |
{ | |
Node **nodes = reinterpret_cast<Node **>(storage + sizeof(PixelLayer)); | |
PixelLayer *layer = new (storage) PixelLayer(Scene_0::layer_2, nodes); | |
storage += sizeof(PixelLayer); | |
storage += (sizeof(Node *) * 2); | |
scene->addLayer(layer); | |
{ | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_0::layer_2_node_0); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_0::layer_2_node_1); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
} | |
} | |
return scene; | |
} | |
if(index == 1) { | |
uint8_t *storage = _storage; | |
Layer **layers = reinterpret_cast<Layer **>(storage + sizeof(Scene)); | |
Scene *scene = new (storage) Scene(Scene_1::scene, layers); | |
storage += sizeof(Scene); | |
storage += (sizeof(Layer *) * 1); | |
{ | |
Node **nodes = reinterpret_cast<Node **>(storage + sizeof(PixelLayer)); | |
PixelLayer *layer = new (storage) PixelLayer(Scene_1::layer_0, nodes); | |
storage += sizeof(PixelLayer); | |
storage += (sizeof(Node *) * 11); | |
scene->addLayer(layer); | |
{ | |
{ | |
SpriteFrameNode *node = new (storage) SpriteFrameNode(Scene_1::layer_0_node_0); | |
storage += sizeof(SpriteFrameNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_1); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_2); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_3); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_4); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_5); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_6); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_7); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_8); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_9); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
{ | |
SpriteLoopNode *node = new (storage) SpriteLoopNode(Scene_1::layer_0_node_10); | |
storage += sizeof(SpriteLoopNode); | |
layer->addNode(node); | |
} | |
} | |
} | |
return scene; | |
} | |
return nullptr; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Project: First | |
// Sprites: 5 | |
#include <avr/pgmspace.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <tiny/sprite/loop.h> | |
#include <tiny/sprite/sprite.h> | |
namespace Tiny { | |
namespace Sprites { | |
const unsigned char _sprite_0[] PROGMEM = { | |
8, 8, | |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, | |
0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, | |
0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00 | |
}; | |
const uint8_t _sprite_0_loop_0[] PROGMEM = { | |
3, // indexes | |
0, 1, 2 | |
}; | |
const unsigned char _sprite_1[] PROGMEM = { | |
12, 16, | |
0xc0, 0xc0, 0x60, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0x60, 0xe0, 0xc0, 0xc0, 0x1f, 0x1f, 0x30, 0x3f, 0xef, 0xff, 0xaf, 0xff, 0x8f, 0xff, 0xef, 0xff, 0x2e, 0x3f, 0xef, 0xff, 0x8e, 0xff, 0xaf, 0xff, 0xf0, 0xff, 0x1f, 0x1f, | |
0xc0, 0xc0, 0x60, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0x60, 0xe0, 0xc0, 0xc0, 0x1f, 0x1f, 0x30, 0x3f, 0xef, 0xff, 0xaf, 0xff, 0x8f, 0xff, 0xef, 0xff, 0xee, 0xff, 0xaf, 0xff, 0x8e, 0xff, 0xef, 0xff, 0x10, 0x1f, 0x1f, 0x1f, | |
0xc0, 0xc0, 0x60, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0x60, 0xe0, 0xc0, 0xc0, 0x1f, 0x1f, 0x30, 0x3f, 0xef, 0xff, 0xaf, 0xff, 0x8f, 0xff, 0xef, 0xff, 0xee, 0xff, 0xaf, 0xff, 0x8f, 0xff, 0xef, 0xff, 0x10, 0x1f, 0x1f, 0x1f, | |
0xc0, 0xc0, 0x60, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0x60, 0xe0, 0xc0, 0xc0, 0x1f, 0x1f, 0x30, 0x3f, 0xef, 0xff, 0xaf, 0xff, 0x8f, 0xff, 0xef, 0xff, 0x2e, 0x3f, 0xef, 0xff, 0x8f, 0xff, 0xaf, 0xff, 0xf0, 0xff, 0x1f, 0x1f | |
}; | |
const uint8_t _sprite_1_loop_0[] PROGMEM = { | |
4, // indexes | |
0, 1, 0, 2 | |
}; | |
const unsigned char _sprite_2[] PROGMEM = { | |
23, 16, | |
0x00, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0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0xfe, 0xec, 0xfe, 0xfc, 0xfe, 0x0c, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0x0c, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xfc, 0xfe, 0xf8, 0xfc, 0x00, 0xf8, 0x00, 0x03, 0x03, 0x07, 0x07, 0xff, 0x3e, 0x7f, 0x1e, 0x3f, 0x0f, 0x1f, 0x06, 0x0f, 0x06, 0x0f, 0x07, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x07, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x07, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x07, 0x0f, 0x03, 0x07, 0x00, 0x03 | |
}; | |
const uint8_t _sprite_2_loop_0[] PROGMEM = { | |
9, // indexes | |
0, 0, 0, 1, 2, 3, 4, 4, 4 | |
}; | |
const unsigned char _sprite_3[] PROGMEM = { | |
14, 24, | |
0xe0, 0xe0, 0x20, 0xe0, 0xb0, 0xf0, 0x90, 0xf0, 0xb0, 0xf0, 0xa0, 0xe0, 0xbe, 0xfe, 0x82, 0xfe, 0xb6, 0xfe, 0xbc, 0xfc, 0xa0, 0xe0, 0x30, 0xf0, 0x90, 0xf0, 0xf0, 0xf0, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x20, 0xff, 0x2e, 0xff, 0x20, 0xff, 0xff, 0xff, 0x20, 0xff, 0x2e, 0xff, 0x20, 0xff, 0xff, 0xff, 0x00, 0xff, 0xef, 0xff, 0x84, 0x9c, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x84, 0xff, 0xb5, 0xff, 0x84, 0xff, 0xff, 0xff, 0x84, 0xff, 0xb4, 0xff, 0x84, 0xff, 0xff, 0xff, 0x00, 0xff, 0x3d, 0x7f, 0x14, 0x77, | |
0xe0, 0xe0, 0x20, 0xe0, 0xb0, 0xf0, 0x90, 0xf0, 0xb0, 0xf0, 0xa0, 0xe0, 0xbe, 0xfe, 0x82, 0xfe, 0xb6, 0xfe, 0xbc, 0xfc, 0xa0, 0xe0, 0x30, 0xf0, 0x90, 0xf0, 0xf0, 0xf0, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x20, 0xff, 0x2e, 0xff, 0x20, 0xff, 0xff, 0xff, 0x20, 0xff, 0x2e, 0xff, 0x20, 0xff, 0xff, 0xff, 0x00, 0xff, 0xef, 0xff, 0x84, 0x9c, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x84, 0xff, 0xb4, 0xff, 0x84, 0xff, 0xff, 0xff, 0x84, 0xff, 0xb4, 0xff, 0x84, 0xff, 0xff, 0xff, 0x00, 0xff, 0x3d, 0x7f, 0x14, 0x77 | |
}; | |
const uint8_t _sprite_3_loop_0[] PROGMEM = { | |
8, // indexes | |
0, 0, 0, 0, 1, 1, 1, 1 | |
}; | |
const unsigned char _sprite_4[] PROGMEM = { | |
16, 16, | |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xe0, 0xc0, 0xe0, 0x80, 0xe0, 0x80, 0xc0, 0x80, 0xf0, 0xe0, 0xf0, 0x80, 0xf0, 0x80, 0xe0, 0xc0, 0xe0, 0x80, 0xe0, 0x80, 0xc0, | |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xe0, 0xc0, 0xe0, 0x80, 0xe0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xf8, 0xf0, 0xf8, 0x80, 0xf8, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0, 0x80, 0xc0 | |
}; | |
const uint8_t _sprite_4_loop_0[] PROGMEM = { | |
2, // indexes | |
0, 1 | |
}; | |
const size_t _spritesStorageSize = (sizeof(Sprite) * 5); | |
const size_t _spritesLoopsStorageSize = (sizeof(Loop *) * 5); | |
const size_t _loopsStorageSize = sizeof(Loop) * 5; | |
const size_t _storageSize = _spritesStorageSize + _spritesLoopsStorageSize + _loopsStorageSize; | |
const uint8_t _numberOfSprites = 5; | |
uint8_t _storage[_storageSize]; | |
Sprite *_sprites[_numberOfSprites]; | |
bool initialized = false; | |
uint8_t getNumberOfSprites() { | |
return _numberOfSprites; | |
} | |
size_t getStorageSize() { | |
return _storageSize + sizeof(_sprites); | |
} | |
void initialize() { | |
if(initialized) { | |
return; | |
} | |
initialized = true; | |
uint8_t *storage = _storage; | |
{ | |
Loop **loops = reinterpret_cast<Loop **>(storage + sizeof(Sprite)); | |
Sprite *sprite = new (storage) Sprite(_sprite_0, loops); | |
storage += sizeof(Sprite); | |
storage += (sizeof(Loop *) * 1); | |
{ | |
Loop *loop = new (storage) Loop(_sprite_0_loop_0, sprite); | |
sprite->addLoop(loop); | |
storage += sizeof(Loop); | |
} | |
_sprites[0] = sprite; | |
} | |
{ | |
Loop **loops = reinterpret_cast<Loop **>(storage + sizeof(Sprite)); | |
Sprite *sprite = new (storage) Sprite(_sprite_1, loops); | |
storage += sizeof(Sprite); | |
storage += (sizeof(Loop *) * 1); | |
{ | |
Loop *loop = new (storage) Loop(_sprite_1_loop_0, sprite); | |
sprite->addLoop(loop); | |
storage += sizeof(Loop); | |
} | |
_sprites[1] = sprite; | |
} | |
{ | |
Loop **loops = reinterpret_cast<Loop **>(storage + sizeof(Sprite)); | |
Sprite *sprite = new (storage) Sprite(_sprite_2, loops); | |
storage += sizeof(Sprite); | |
storage += (sizeof(Loop *) * 1); | |
{ | |
Loop *loop = new (storage) Loop(_sprite_2_loop_0, sprite); | |
sprite->addLoop(loop); | |
storage += sizeof(Loop); | |
} | |
_sprites[2] = sprite; | |
} | |
{ | |
Loop **loops = reinterpret_cast<Loop **>(storage + sizeof(Sprite)); | |
Sprite *sprite = new (storage) Sprite(_sprite_3, loops); | |
storage += sizeof(Sprite); | |
storage += (sizeof(Loop *) * 1); | |
{ | |
Loop *loop = new (storage) Loop(_sprite_3_loop_0, sprite); | |
sprite->addLoop(loop); | |
storage += sizeof(Loop); | |
} | |
_sprites[3] = sprite; | |
} | |
{ | |
Loop **loops = reinterpret_cast<Loop **>(storage + sizeof(Sprite)); | |
Sprite *sprite = new (storage) Sprite(_sprite_4, loops); | |
storage += sizeof(Sprite); | |
storage += (sizeof(Loop *) * 1); | |
{ | |
Loop *loop = new (storage) Loop(_sprite_4_loop_0, sprite); | |
sprite->addLoop(loop); | |
storage += sizeof(Loop); | |
} | |
_sprites[4] = sprite; | |
} | |
} | |
Sprite *getSprite(uint8_t index) { | |
initialize(); | |
return _sprites[index]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment