freak-engine/src/main.c

37 lines
901 B
C
Raw Normal View History

2021-06-11 01:32:47 +02:00
#include "entity.h"
2021-06-11 11:10:10 +02:00
#include "layers.h"
2021-06-11 01:32:47 +02:00
#include "player.h"
#include "wall.h"
#include <gint/display.h>
#include <gint/keyboard.h>
void
main(void)
{
struct Player player;
2021-06-11 11:10:10 +02:00
struct Player newb;
2021-06-11 01:32:47 +02:00
struct Wall walls[5];
2021-06-11 12:47:16 +02:00
int collided = 0;
2021-06-11 01:32:47 +02:00
player_init(&player, 16, 32);
2021-06-11 11:10:10 +02:00
player_init(&newb, 64, 128);
2021-06-11 01:32:47 +02:00
wall_init(&walls[0], 16, 0, DWIDTH - 32, 16);
wall_init(&walls[1], 16, DHEIGHT - 16, DWIDTH - 32, 16);
wall_init(&walls[2], 0, 0, 16, DHEIGHT);
wall_init(&walls[3], DWIDTH - 16, 0, 16, DHEIGHT);
wall_init(&walls[4], DWIDTH / 2 - 24, DHEIGHT - 64, 48, 48);
do {
dclear(C_BLACK);
entity_grid_draw_hitboxes();
2021-06-11 12:47:16 +02:00
dprint(2, 2, C_WHITE, "%d", collided);
2021-06-11 01:32:47 +02:00
dupdate();
clearevents();
2021-06-11 12:47:16 +02:00
collided = entity_move(&player, L_SOLID,
keydown(KEY_RIGHT) - keydown(KEY_LEFT),
keydown(KEY_DOWN) - keydown(KEY_UP));
2021-06-11 01:32:47 +02:00
} while (!keydown(KEY_EXIT));
return;
}