gbarubik/src/main.cpp

35 lines
794 B
C++
Raw Normal View History

2023-11-26 16:09:41 -07:00
#include "cube.hpp"
2023-11-24 18:19:30 -07:00
#include "palette.hpp"
2023-11-26 16:09:41 -07:00
#include "renderable.hpp"
#include "scene.hpp"
2023-11-24 18:19:30 -07:00
#include "vector.hpp"
2023-11-21 13:29:11 -07:00
#include <tonc.h>
2023-11-26 16:09:41 -07:00
class Box : public Renderable {
public:
virtual void render(std::shared_ptr<Scene> scene) {
scene->draw_line({0, 0}, {2 << FIX_SHIFT, 3 << FIX_SHIFT}, 1);
}
};
2023-11-21 13:29:11 -07:00
int main() {
2023-11-24 18:19:30 -07:00
// interrupt & mode 4 foo
2023-11-21 13:29:11 -07:00
irq_init(NULL);
irq_enable(II_VBLANK);
2023-11-24 18:19:30 -07:00
REG_DISPCNT = DCNT_MODE4 | DCNT_BG2;
palette::put_palette((std::uint16_t *)MEM_PAL);
2023-11-21 13:29:11 -07:00
2023-11-26 16:09:41 -07:00
auto scene = std::make_shared<Scene>();
// auto cube = std::shared_ptr<Renderable>((Renderable *)new Cube());
// scene->renderables.add(cube);
auto box = std::shared_ptr<Renderable>((Renderable *)new Box());
scene->renderables.add(box);
2023-11-24 18:19:30 -07:00
2023-11-21 13:29:11 -07:00
while (1) {
2023-11-26 16:09:41 -07:00
Scene::render(scene);
2023-11-24 18:19:30 -07:00
2023-11-21 13:29:11 -07:00
VBlankIntrWait();
}
}