summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index de7b5ff..d433ff1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,5 @@
#include <time.h>
+#include "player.h"
static int _main_loop(void *udata);
@@ -25,6 +26,16 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
.pixel_perfect=true,
.target_fps=60) == 0);
defer(TZR_Quit);
+ input_new_action("action");
+ input_bind_action_mb("action", SDL_BUTTON_LEFT);
+ input_bind_action_mb("action", SDL_BUTTON_RIGHT);
+ input_bind_action_mb("action", SDL_BUTTON_MIDDLE);
+ input_bind_action_sc("action", SDL_SCANCODE_SPACE);
+ input_bind_action_sc("action", SDL_SCANCODE_J);
+ input_bind_action_cb("action", SDL_CONTROLLER_BUTTON_A);
+ input_bind_action_cb("action", SDL_CONTROLLER_BUTTON_B);
+ input_bind_action_cb("action", SDL_CONTROLLER_BUTTON_X);
+ input_bind_action_cb("action", SDL_CONTROLLER_BUTTON_Y);
TZR_MainLoop(_main_loop, nullptr);
return 0;
}
@@ -32,8 +43,10 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
static int
_main_loop([[maybe_unused]] void *udata)
{
+ player_update();
+
assert(TZR_DrawBegin() == 0);
- if (rand() % 10 == 0) {
+ if (rand() % 1 == 0) {
int r; do r = rand(); while ((r & 7) == 0);
TZR_DrawSetColor(r & 1, (r & 2) != 0, (r & 4) != 0);
TZR_DrawClear();
@@ -60,8 +73,7 @@ _main_loop([[maybe_unused]] void *udata)
.sy=1.0+randf()*.1);
}
world_draw();
- //map_draw();
- //player_draw();
+ player_draw();
} else {
TZR_DrawSetColor(0, 0, 0);
TZR_DrawClear();