Add game entity list rendering, create animations
This commit is contained in:
@@ -22,5 +22,7 @@ typedef double f64;
|
||||
|
||||
#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
|
||||
#define CAST(type) (type)
|
||||
#define ASSERT(expr) if(!(expr)) { *(int *)0 = 0; }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,12 +4,34 @@
|
||||
#include <Dengine/Texture.h>
|
||||
#include <Dengine/Math.h>
|
||||
|
||||
enum Direction
|
||||
{
|
||||
direction_north,
|
||||
direction_west,
|
||||
direction_south,
|
||||
direction_east,
|
||||
direction_num,
|
||||
direction_null,
|
||||
};
|
||||
|
||||
typedef struct SpriteAnim
|
||||
{
|
||||
v4 *rect;
|
||||
i32 numRects;
|
||||
i32 currRectIndex;
|
||||
|
||||
f32 duration;
|
||||
f32 currDuration;
|
||||
} SpriteAnim;
|
||||
|
||||
typedef struct Entity
|
||||
{
|
||||
v2 pos; // Position
|
||||
v2 dPos; // Velocity
|
||||
v2 size;
|
||||
enum Direction direction;
|
||||
Texture *tex;
|
||||
SpriteAnim anim;
|
||||
} Entity;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,15 +15,6 @@ enum State
|
||||
state_win
|
||||
};
|
||||
|
||||
enum Direction
|
||||
{
|
||||
direction_north,
|
||||
direction_west,
|
||||
direction_south,
|
||||
direction_east,
|
||||
direction_num,
|
||||
};
|
||||
|
||||
typedef struct GameState
|
||||
{
|
||||
enum State state;
|
||||
@@ -31,8 +22,11 @@ typedef struct GameState
|
||||
i32 width, height;
|
||||
|
||||
Renderer renderer;
|
||||
Entity hero;
|
||||
enum Direction heroLastDirection;
|
||||
i32 heroIndex;
|
||||
|
||||
// TODO(doyle): Make size of list dynamic
|
||||
Entity entityList[256];
|
||||
i32 freeEntityIndex;
|
||||
} GameState;
|
||||
|
||||
void worldTraveller_gameInit(GameState *state);
|
||||
|
||||
Reference in New Issue
Block a user