-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
80 lines (54 loc) · 1.41 KB
/
main.cpp
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
69
70
71
72
73
74
75
76
77
78
79
#include "pico/stdlib.h"
#include "pico/time.h"
#include "pico/multicore.h"
#include "common.h"
#include "time.hpp"
#include "mathematics.h"
#include "hardware/st7789.h"
#include "hardware/input.h"
#include "rendering/renderer.h"
#include "rendering/postprocessing.h"
#include "tests/rendering_tests.h"
#include <iostream>
extern void game_init();
extern void game_update();
extern void game_mesh_render();
extern void game_ui_render();
void core1() {
while (true) {
multicore_fifo_pop_blocking();
while (Renderer::Render());
Renderer::Finish();
}
}
int main() {
stdio_init_all();
gpio_init(25);
gpio_set_dir(25, GPIO_OUT);
multicore_launch_core1(core1);
#ifdef ENABLE_OVERCLOCK
vreg_set_voltage(VREG_VOLTAGE_1_20);
set_sys_clock_khz(250000, true);
#endif
ST7789::Init();
ST7789::SetBrightness(65535);
Time::Init();
Input::Init();
Renderer::Init();
game_init();
while (true) {
Time::Tick();
Input::Poll();
game_update();
while(ST7789::IsFlipping());
Renderer::Prepare();
multicore_fifo_push_blocking(0);
game_mesh_render();
while(Renderer::Render());
Renderer::Finish();
PostProcessing::Apply((Color565*)&Renderer::FrameBuffer, vec2i16(120, 120));
game_ui_render();
ST7789::Flip((Color565*)&Renderer::FrameBuffer);
}
return 0;
}