Add game entity list rendering, create animations

This commit is contained in:
2016-06-23 18:40:00 +10:00
parent eda06bcfe9
commit 7a2dc3da41
4 changed files with 89 additions and 92 deletions
+2
View File
@@ -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
+22
View File
@@ -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
+5 -11
View File
@@ -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);