summaryrefslogtreecommitdiff
path: root/3de.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-07-17 21:29:29 +1000
committerquou <quou@disroot.org>2024-07-17 21:29:41 +1000
commitc67b409dd32e4aa795e5aa9868202c910fc9ffd0 (patch)
treed97724dee6a2e1369474403af6b0e00abe81e058 /3de.c
parentb8d2cf5610f0e0ef96ded0a5de5bda54c10c9552 (diff)
simple mouse look
Diffstat (limited to '3de.c')
-rw-r--r--3de.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/3de.c b/3de.c
index 23e4d13..6197321 100644
--- a/3de.c
+++ b/3de.c
@@ -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);