summaryrefslogtreecommitdiff
path: root/code/game_main.h
diff options
context:
space:
mode:
Diffstat (limited to 'code/game_main.h')
-rw-r--r--code/game_main.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/code/game_main.h b/code/game_main.h
new file mode 100644
index 0000000..91c3054
--- /dev/null
+++ b/code/game_main.h
@@ -0,0 +1,75 @@
+#ifndef GAME_MAIN_H
+#define GAME_MAIN_H
+
+#define KB(b) (((u64)1024)*(b))
+#define MB(b) (((u64)1024)*(KB(b)))
+#define GB(b) (((u64)1024)*(MB(b)))
+
+typedef struct GameInput {
+ r32 LastMouseX;
+ r32 LastMouseY;
+ r64 MouseX;
+ r64 MouseY;
+ r32 Sensitivity;
+} GameInput;
+
+typedef struct GameCamera {
+ r32 MoveSpeed;
+ r32 PitchAngle;
+ r32 YawAngle;
+ Vec3 Pos;
+ Vec3 Front;
+ Vec3 Up;
+} GameCamera;
+
+typedef struct BufferO {
+ u32 VAO; // Vertex Array Object
+ u32 VBO; // Vertex Buffer Object
+ u32 EBO; // Element Buffer Object
+ u32 TexO; // Texture Buffer Object
+} BufferO;
+
+typedef struct Texture2D {
+ i32 width;
+ i32 height;
+ i32 nrChannels;
+ unsigned char* data;
+} Texture2D;
+
+typedef struct GameMemory {
+ void *PermanentStorage;
+ u64 PermanentStorageSize;
+ DebugArena Arena;
+} GameMemory;
+
+typedef struct Rect2 {
+ Vec2 tl;
+ Vec2 br;
+} Rect2;
+
+typedef struct debug_font_details {
+ i32 advance;
+ i32 lsb;
+ i32 x0, y0, x1, y1;
+ i32 kern;
+ r32 lx;
+ r32 ly;
+ i32 byte_offset;
+ i32 baseline;
+} debug_font_details;
+
+typedef struct GameState {
+ GameCamera Camera;
+ GameInput Input;
+ GameMemory Memory;
+ Vec2 WinDimsPx;
+ Vec2 FieldDimsPx; // play field dimensions
+ // screen placement management things
+ Vec2 px_ratio;
+ Vec2 ScrMidCoords;
+ Rect2 ScreenCoords;
+ Rect2 FieldCoords;
+} GameState;
+
+
+#endif