-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpriteEditor.ino
More file actions
68 lines (52 loc) · 1.49 KB
/
Copy pathSpriteEditor.ino
File metadata and controls
68 lines (52 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
SpriteEditor (M1 TER Project)
Click with a mouse on a grid with the color selected from a limited palette.
If time, save the sprite in a .json file and send it via Bluetooth or Wi-Fi.
*/
#include "fabgl.h"
#include "fabui.h"
#include "AppData.h"
#include "SpriteGridFrame.h"
#include "ColorPaletteFrame.h"
#include "SpriteMenuFrame.h"
fabgl::VGA16Controller DisplayController;
fabgl::PS2Controller PS2Controller;
/*
* Improvements:
*
* - take arguments for the screen resolution to make the UI adapt to screen sizes
*
*/
class MyApp : public uiApp
{
AppData *appData;
SpriteGridFrame *spriteGridFrame;
ColorPaletteFrame *colorPaletteFrame;
SpriteMenuFrame *spriteMenuFrame;
fabgl::Stack<uiFrame*> dynamicFrames;
void init()
{
rootWindow()->frameStyle().backgroundColor = RGB888(255, 255, 255);
// init app data
appData = new AppData();
// sprite grid frame
spriteGridFrame = new SpriteGridFrame(rootWindow(), appData);
// color palette frame
colorPaletteFrame = new ColorPaletteFrame(rootWindow(), appData);
// sprite menu frame
spriteMenuFrame = new SpriteMenuFrame(rootWindow(), appData, spriteGridFrame);
}
};
void setup()
{
Serial.begin(115200);
delay(500); // avoid garbage into the UART
Serial.write("\n\nReset\n");
PS2Controller.begin(PS2Preset::MousePort1);
DisplayController.begin();
DisplayController.setResolution(VGA_640x480_60Hz);
}
void loop()
{
MyApp().runAsync(&DisplayController, 3500).joinAsyncRun(); // why this? Just to use a larger stack!
}