wireframe! and music!
This commit is contained in:
@@ -164,6 +164,7 @@ void mouse_up(unsigned char button)
|
||||
|
||||
void process_input(void)
|
||||
{
|
||||
/* mode switch game or menus */
|
||||
struct cat_event* e = cat_get_event();
|
||||
if (e == NULL) return;
|
||||
if (e->type == QUIT) bye();
|
||||
@@ -179,7 +180,7 @@ void erase_entity(struct entity* e)
|
||||
/* get sprite info, etc */
|
||||
/* FIXME */
|
||||
if (e->x < 0 || e->y < 0 || e->x >= screen_width || e->y >= screen_height) return;
|
||||
cat_fill(1, 0, e->x, e->y, e->width, e->height, 0, 0, 0);
|
||||
cat_wireframe(1, 0, e->x, e->y, e->width, e->height, 0, 0, 0);
|
||||
}
|
||||
|
||||
void draw_entity(struct entity* e)
|
||||
@@ -187,7 +188,7 @@ void draw_entity(struct entity* e)
|
||||
/* get sprite info, etc */
|
||||
/* FIXME */
|
||||
if (e->x < 0 || e->y < 0 || e->x >= screen_width || e->y >= screen_height) return;
|
||||
cat_fill(1, 1, e->x, e->y, e->width, e->height, e->r, e->g, e->b);
|
||||
cat_wireframe(1, 1, e->x, e->y, e->width, e->height, e->r, e->g, e->b);
|
||||
/* if out of bounds do not draw */
|
||||
}
|
||||
|
||||
@@ -236,6 +237,8 @@ void tick(void)
|
||||
printf("tick %d!\n", tick_count++);
|
||||
|
||||
/* code to run every tick goes here */
|
||||
/* something like "for i in fns_to_run_per_tick (linked list) run ->fn()
|
||||
and somewhere there's an add_fn_to_run_every_tick() thing... or every n ticks... idk */
|
||||
erase_entities();
|
||||
struct entity* p = get_player();
|
||||
if (is_held(' ')) p->ay = -5;
|
||||
@@ -252,6 +255,7 @@ void game_loop(void)
|
||||
{
|
||||
cat_render();
|
||||
process_input();
|
||||
/* mode check for in game or in menu */
|
||||
tick();
|
||||
}
|
||||
|
||||
@@ -261,7 +265,8 @@ int main(int argc, char** argv)
|
||||
cat_create_window(1920, 1080);
|
||||
//cat_play_wav("etc/example.wav");
|
||||
//cat_play_wav("etc/cat_quick.wav");
|
||||
cat_play_wav("etc/cat_beep_box.wav");
|
||||
//cat_play_wav("etc/cat_beep_box.wav");
|
||||
cat_play_wav("etc/cat_beep_slower.wav");
|
||||
/* layer, visibility, x, y, width, height, r, g, b */
|
||||
cat_fill(0, 1, 0, 0, screen_width - 1, screen_height - 1, 132, 155, 132);
|
||||
/* create the player */ add_entity(1, 0, 0, 0, 50, 50, 100, 50, 0, 0, 0, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user