summaryrefslogtreecommitdiff
path: root/code/game_main.h
blob: 2194e274a7e2cd7de4a8f1cc5559c60741b8062f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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 {
  f32 LastMouseX;
  f32 LastMouseY;
  f64 MouseX;
  f64 MouseY;
  f32 Sensitivity;
} GameInput;

typedef struct GameCamera {
  f32 MoveSpeed;
  f32 PitchAngle;
  f32 YawAngle;
  Vec3 Pos;
  Vec3 Front;
  Vec3 Up;
} GameCamera;

typedef struct GameMemory {
  void *PermanentStorage;
  u64 PermanentStorageSize;
  amr_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;
  f32 lx;
  f32 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