diff options
Diffstat (limited to '3de.c')
-rw-r--r-- | 3de.c | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -3,7 +3,9 @@ #include "maths.h" #include "memory.h" #include "plat.h" +#include "player.h" #include "render.h" +#include "services.h" #include "tile.h" #include <stdio.h> @@ -21,13 +23,13 @@ void draw_monkey(Renderer* r) { static int a = 0; const Mesh* m = get_mesh(asset_id_monkey); Bitmap tex = { (Colour*)tile_pixels, 16, 16 }; - int p[] = { 0, 0, 5 << fbits, f1 }; + int p[] = { 0, 0, 0, f1 }; mtx_push_trans(p); - mtx_push_rot_x(a); + /*mtx_push_rot_x(a); mtx_push_rot_y(a); - mtx_push_rot_z(a); + mtx_push_rot_z(a);*/ ren_mesh(r, m, &tex); - mtx_popn(4); + mtx_popn(1); a++; } @@ -50,6 +52,8 @@ int entrypoint(int argc, const char** argv, Arena* a) { int* depth = 0; Arena preload; Colour blue = make_aliceblue(); + Player p; + Services s; (void)argc; (void)argv; init_maths(); @@ -72,11 +76,15 @@ int entrypoint(int argc, const char** argv, Arena* a) { return error_out_of_memory; } preload_assets(&preload); + s.a = app; + s.r = &r; cfg_mouse(app, 0); + init_player(&p); while (app->o) { fps_begin(&f); while (f.now >= f.next) { app_begin(app); + update_player(&p, &s); ren_begin(&r, app->fb, depth, app->w, app->h); ren_clear(&r); ren_cleard(&r, f1 * 300); @@ -86,8 +94,10 @@ int entrypoint(int argc, const char** argv, Arena* a) { ren_texts(&r, blue, 3, 8, buf); sprintf(buf, "MOUSE: %d, %d", app->mx, app->my); ren_texts(&r, blue, 3, 13, buf); + push_player_cam(&p); draw_monkey(&r); - draw_tri(&r, app->mx, app->my); + pop_player_cam(); + /*draw_tri(&r, app->mx, app->my);*/ ren_end(&r); app_end(app); fps_update(&f); |