Added animations
Added new assets for the player Added lookups for assets Initial sound testing Re-enabled temp world drawing
This commit is contained in:
@@ -48,8 +48,33 @@ struct D_Rect {
|
||||
|
||||
StaticAssert(sizeof(D_Rect) == 64);
|
||||
|
||||
typedef struct D_Animation D_Animation;
|
||||
struct D_Animation {
|
||||
U32 id;
|
||||
|
||||
U32 rows;
|
||||
U32 cols;
|
||||
F32 frame_time;
|
||||
F32 time;
|
||||
|
||||
V2f frame; // size of one frame
|
||||
|
||||
U32 index;
|
||||
};
|
||||
|
||||
struct G_Camera;
|
||||
|
||||
#define D_ASSET_HASH_COUNT 128
|
||||
|
||||
typedef struct D_AssetHash D_AssetHash;
|
||||
struct D_AssetHash {
|
||||
D_AssetHash *next;
|
||||
|
||||
Str8 value;
|
||||
U64 hash;
|
||||
U32 id; // texture id
|
||||
};
|
||||
|
||||
typedef struct D_Context D_Context;
|
||||
struct D_Context {
|
||||
Vk_Buffer *rbo;
|
||||
@@ -73,6 +98,8 @@ struct D_Context {
|
||||
U32 window_width;
|
||||
U32 window_height;
|
||||
|
||||
D_AssetHash *lookup[D_ASSET_HASH_COUNT];
|
||||
|
||||
struct G_Camera *camera;
|
||||
};
|
||||
|
||||
@@ -80,6 +107,7 @@ typedef U32 D_RectFlags;
|
||||
enum D_RectFlags {
|
||||
D_RECT_IGNORE_ASPECT = (1 << 0), // by default only width is used as a "dimension"
|
||||
D_RECT_PER_VERTEX_COLOUR = (1 << 1), // split colours per vertex
|
||||
D_RECT_UV_ASPECT = (1 << 2), // get the aspect from the uv rect rather than the full image
|
||||
};
|
||||
|
||||
typedef struct D_RectOpts D_RectOpts;
|
||||
@@ -111,6 +139,12 @@ struct D_RectOpts {
|
||||
};
|
||||
};
|
||||
|
||||
function U32 D_ImageHandle(D_Context *draw, Str8 name);
|
||||
|
||||
function void D_AnimationInit(D_Animation *a, U32 id, U32 rows, U32 cols, F32 time);
|
||||
function R2f D_AnimationFrame(D_Animation *a);
|
||||
function void D_AnimationUpdate(D_Animation *a, F32 dt);
|
||||
|
||||
function void D_Begin(D_Context *draw, Vk_Frame *frame, U32 max_rects);
|
||||
function void D_End(D_Context *draw, Vk_Frame *frame);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user