aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-03 07:32:34 +1000
committerquou <quou@disroot.org>2023-05-03 07:32:34 +1000
commit199a5e6e9ddb13af0bb557b6ebbb2c4b8f4ce873 (patch)
tree2253af9926b3d0d1e3065d910cf16db957b2eedf /main.c
parent65fa1051585f5345c3270db73ab53b7a0dbbaa50 (diff)
Basic player movement.
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/main.c b/main.c
index 499f313..b106978 100644
--- a/main.c
+++ b/main.c
@@ -1,14 +1,14 @@
#include "asset.h"
+#include "player.h"
#include "render.h"
+#include "standard.h"
#include "systems.h"
#include "world.h"
World world;
-Entity player;
void on_init(int argc, char** argv) {
- CSprite* sprite;
- CPosition* pos;
+ seed_rng(500);
init_renderer();
@@ -16,17 +16,12 @@ void on_init(int argc, char** argv) {
init_world(&world);
- player = new_entity(&world);
- add_components(&world, player, ctype_sprite | ctype_position);
- sprite = &world.sprites[player];
- pos = &world.positions[player];
- pos->x = 32;
- pos->y = 70;
- sprite->id = asset_id_char;
- sprite->rect = make_rect(0, 16, 16, 16);
+ init_player(&world.player, &world);
}
void on_update() {
+ renderer_begin_frame();
+ update_player(&world.player, &world);
sprite_system(&world);
}