summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-11-26 16:09:41 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-11-26 16:09:41 -0700
commitdbccd866229a4b06d10fbafc3eb3343015caedba (patch)
treebffb0d36f48d5c1defd877fdbebd58a1b7eb7fde /src/main.cpp
parentf4a7739a40c095e0c837d78d00f13a1ef47d3a11 (diff)
downloadgbarubik-dbccd866229a4b06d10fbafc3eb3343015caedba.tar.gz
gbarubik-dbccd866229a4b06d10fbafc3eb3343015caedba.zip
checkpoint
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f147f2f..0c91536 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,29 +1,33 @@
+#include "cube.hpp"
#include "palette.hpp"
+#include "renderable.hpp"
+#include "scene.hpp"
#include "vector.hpp"
#include <tonc.h>
+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);
+ }
+};
+
int main() {
// interrupt & mode 4 foo
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<Renderable>((Renderable *)new Cube());
+ // scene->renderables.add(cube);
+ auto box = std::shared_ptr<Renderable>((Renderable *)new Box());
+
+ scene->renderables.add(box);
- std::uint32_t frame = 0;
while (1) {
- frame = (frame + 1) % 60;
- if (frame == 0) {
- vid_flip();
- }
+ Scene::render(scene);
VBlankIntrWait();
}