shared struct and enum definitions file (maybe not the best idea)
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
#include "cat_api.h"
|
#include "cat_api.h"
|
||||||
|
#include "shared.h"
|
||||||
|
#include "rendering.c"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
@@ -62,24 +64,6 @@ int is_held(char k)
|
|||||||
return 0;
|
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;
|
struct entity* first_entity = NULL;
|
||||||
|
|
||||||
@@ -189,6 +173,7 @@ void draw_entity(struct entity* e)
|
|||||||
/* FIXME */
|
/* FIXME */
|
||||||
if (e->x < 0 || e->y < 0 || e->x >= screen_width || e->y >= screen_height) return;
|
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);
|
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 */
|
/* if out of bounds do not draw */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -1 +1,13 @@
|
|||||||
/* all of the stuff like texturing the wireframes of entities will go here */
|
/* 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 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user