blob: cc212237c985dd3350bb60b3c02cf047b581e46c (
plain)
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
|
#include "cube.hpp"
#include "palette.hpp"
#include "renderable.hpp"
#include "scene.hpp"
#include "vector.hpp"
#include <tonc.h>
int main() {
// interrupt & mode 4 foo
irq_init(NULL);
irq_enable(II_VBLANK);
REG_DISPCNT = DCNT_MODE4 | DCNT_BG2;
palette::put_palette((std::uint16_t *)MEM_PAL);
auto scene = std::make_shared<Scene>();
auto cube = std::shared_ptr<Mesh>((Mesh *)new Cube);
ModelInstance model_instance(cube, float2fx(0.25), {0, 0x0C00, 0},
{int2fx(3), int2fx(3), int2fx(3)});
auto model_instance_ptr = std::shared_ptr<Renderable>(&model_instance);
scene->renderables.add(model_instance_ptr);
std::uint8_t frame = 0;
while (1) {
if (frame == 0) {
model_instance.add_pos({0, 0, float2fx(0.2)});
M4_CLEAR();
Scene::render(scene);
vid_flip();
}
frame = (frame + 1) % 10;
VBlankIntrWait();
}
}
|