From d980dcd2b66e4879989ce18291d044d5a4ffc902 Mon Sep 17 00:00:00 2001 From: talha Date: Wed, 30 Aug 2023 11:04:00 +0500 Subject: setting up font-rendering repo --- code/game_main.h | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 code/game_main.h (limited to 'code/game_main.h') 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 -- cgit v1.2.3