diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp index f147f2f..cc21223 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,7 @@ +#include "cube.hpp" #include "palette.hpp" +#include "renderable.hpp" +#include "scene.hpp" #include "vector.hpp" #include <tonc.h> @@ -7,23 +10,27 @@ int main() { irq_init(NULL); irq_enable(II_VBLANK); REG_DISPCNT = DCNT_MODE4 | DCNT_BG2; - - // initialize our palette palette::put_palette((std::uint16_t *)MEM_PAL); - // begin - bmp16_line(1, 3, 1 + SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT, 0x0101, vid_page, - SCREEN_WIDTH); - vid_flip(); - bmp16_line(2, 3, 2 + SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT, 0x0101, vid_page, - SCREEN_WIDTH); + 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::uint32_t frame = 0; + std::uint8_t frame = 0; while (1) { - frame = (frame + 1) % 60; if (frame == 0) { + model_instance.add_pos({0, 0, float2fx(0.2)}); + M4_CLEAR(); + Scene::render(scene); vid_flip(); } + frame = (frame + 1) % 10; VBlankIntrWait(); } |