diff --git a/main.c b/main.c index 138c8d4..63dd9f1 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,6 @@ #include "cat_api.h" +#include "shared.h" +#include "rendering.c" #include /* TODO: @@ -62,24 +64,6 @@ int is_held(char k) return 0; } -struct entity -{ - int is_player; - int is_static; - int in_freefall; - float x; - float y; - int width; /**/ - int height; /**/ - unsigned char r; /* replace this with sprite TODO */ - unsigned char g; /**/ - unsigned char b; /**/ - float vx; - float vy; - float ax; - float ay; - struct entity* next; -}; struct entity* first_entity = NULL; @@ -189,6 +173,7 @@ void draw_entity(struct entity* e) /* FIXME */ if (e->x < 0 || e->y < 0 || e->x >= screen_width || e->y >= screen_height) return; cat_wireframe(1, 1, e->x, e->y, e->width, e->height, e->r, e->g, e->b); + render_entity(e); /* if out of bounds do not draw */ } diff --git a/rendering.c b/rendering.c index b480f21..3543e8e 100644 --- a/rendering.c +++ b/rendering.c @@ -1 +1,13 @@ /* all of the stuff like texturing the wireframes of entities will go here */ + +void render_entity(struct entity* e) +{ + switch (e->texture) + { + case VOID_CAT: + /* TODO draw a bunch of black blobs around the hitbox */ + printf("TODO: apply void cat texture to entity \n"); + break; + default: /* error */ + } +} diff --git a/shared.h b/shared.h new file mode 100644 index 0000000..bc4d807 --- /dev/null +++ b/shared.h @@ -0,0 +1,25 @@ + +enum textures /* or call this skin? */ +{ + VOID_CAT +}; + +struct entity +{ + int is_player; + int is_static; + int in_freefall; + float x; + float y; + int width; /**/ + int height; /**/ + unsigned char r; /* replace this with sprite TODO */ + unsigned char g; /**/ + unsigned char b; /**/ + float vx; + float vy; + float ax; + float ay; + enum textures texture; /* or skin? */ + struct entity* next; +};