summaryrefslogtreecommitdiff
path: root/prge_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'prge_types.h')
-rw-r--r--prge_types.h100
1 files changed, 74 insertions, 26 deletions
diff --git a/prge_types.h b/prge_types.h
index 1799870..a41d110 100644
--- a/prge_types.h
+++ b/prge_types.h
@@ -1,13 +1,9 @@
-#ifndef PRGE_TYPES_H
-#define PRGE_TYPES_H
-
-#define MAX_TEXTURE 5
-
typedef struct {
- S32 width;
- S32 height;
- Str8 name;
-} Window;
+ S32 w;
+ S32 h;
+ const char *name;
+ U32 flags;
+} PRGEWindow;
typedef enum {
KeyState_RELEASE = 0,
@@ -28,21 +24,23 @@ typedef struct {
Key mouse_left;
Key mouse_right;
- B32 is_running;
-
F32 dt;
Key move_right;
Key move_forward;
Key move_left;
Key move_backward;
+
Key move_up;
Key move_down;
+
Key jump;
+
Key action_right;
Key action_up;
Key action_left;
Key action_down;
+
Key exit;
} Input;
@@ -54,14 +52,14 @@ typedef enum {
typedef struct {
U32 id;
- Str8 name;
+ const char *name;
TextureTypeEnum type;
- S32 width;
- S32 height;
+ S32 w;
+ S32 h;
- void *data;
+ U8 *data;
} Texture;
typedef struct {
@@ -69,27 +67,44 @@ typedef struct {
V2 texc;
} Vertex;
+#define PRGE_MAX_TEXTURES 2
+#define PRGE_MAX_MESHES 8
+#define PRGE_MAX_MODELS 8
+
+typedef struct {
+ U32 id;
+ const char *name;
+} Shader;
+
+typedef struct {
+ V3 transl;
+ V3 rotate;
+ V3 scale;
+} Transform;
+
typedef struct {
V3 origin;
V3 rotate;
- U32 nverts;
+ S32 nverts;
Vertex *verts;
- U32 nindices;
+ S32 nindices;
U32 *indices;
- U32 ntextures;
- Texture textures[MAX_TEXTURE];
+ S32 ntextures;
+ Texture textures[PRGE_MAX_TEXTURES];
U32 vao, vbo, ebo;
} Mesh;
typedef struct {
+ U32 id;
+
V3 origin;
V3 rotate;
- U32 nmeshes;
+ S32 nmeshes;
Mesh *meshes;
} Model;
@@ -106,13 +121,46 @@ typedef struct {
F32 roll;
} Camera;
+#define PRGE_MAX_SOUNDS_LOADED 4
+#define PRGE_MAX_SOUNDS_PLAYING 2
+
+typedef struct {
+ S32 channels;
+ S32 sample_rate;
+ S32 bytes_per_sample;
+
+ S32 size;
+ U8 *data;
+
+ const char *name;
+} Sound;
+
+typedef struct SoundQueueNode {
+ Sound *snd;
+ struct SoundQueueNode *next;
+ struct SoundQueueNode *prev;
+} SoundQueueNode;
+
+typedef struct {
+ S32 cnt;
+ struct SoundQueueNode *first;
+ struct SoundQueueNode *last;
+} SoundQueue;
+
typedef struct {
- U32 nmodels;
- Model *models;
+ B32 should_close;
+
+ Arena *pa;
+ Arena *tmpa;
+
+ Input in;
- Camera camera;
+ /* TODO(pryazha): Probably a bad idea to have only one window 🙃*/
+ PRGEWindow wnd;
- Str8 bindir;
-} PRGEState;
+ Sound snds[PRGE_MAX_SOUNDS_LOADED];
+ SoundQueueNode nodes[PRGE_MAX_SOUNDS_PLAYING];
+ SoundQueue sndq;
-#endif /* PRGE_TYPES_H */
+ const char *bindir;
+} PRGEContext;