summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-11-28 13:58:18 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-11-28 13:58:18 -0700
commit1b96b0211ed98afba515f0ac9880116f79ead2e5 (patch)
tree2bfc5489fe4a937f87dbc56136eda35e5c5fc1b9 /src/main.cpp
parentdbccd866229a4b06d10fbafc3eb3343015caedba (diff)
downloadgbarubik-1b96b0211ed98afba515f0ac9880116f79ead2e5.tar.gz
gbarubik-1b96b0211ed98afba515f0ac9880116f79ead2e5.zip
render the front face of a cube
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0c91536..c08b584 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,13 +5,6 @@
#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);
@@ -20,14 +13,19 @@ int main() {
palette::put_palette((std::uint16_t *)MEM_PAL);
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);
+ auto cube = std::shared_ptr<Mesh>((Mesh *)new Cube);
+
+ ModelInstance modelInstance(cube, int2fx(2), {0x0C7F, 0x0000, 0},
+ {int2fx(0), 0, int2fx(0)});
+
+ auto modelInstancePtr = std::shared_ptr<Renderable>(&modelInstance);
+ scene->renderables.add(modelInstancePtr);
while (1) {
+
Scene::render(scene);
+ vid_flip();
VBlankIntrWait();
}