2022-08-01 23:11:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// System
|
|
|
|
#include <assert.h>
|
|
|
|
#include <float.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
// 3rd Party
|
|
|
|
#include <glad/gl.h>
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
const char* WINDOW_TITLE = "Untitled Game";
|
|
|
|
const int TARGET_FRAME_TIME = 16;
|
|
|
|
const int WINDOW_WIDTH = 1280;
|
|
|
|
const int WINDOW_HEIGHT = 960;
|
|
|
|
const int RENDER_WIDTH = 320;
|
|
|
|
const int RENDER_HEIGHT = 240;
|
2022-08-02 16:35:50 +00:00
|
|
|
const size_t ENGINE_MEMORY_SIZE = 1U * 1024U * 1024U;
|
|
|
|
const size_t GAME_MEMORY_SIZE = 1U * 1024U * 1024U;
|
|
|
|
const size_t DATA1_MEMORY_SIZE = 8U * 1024U * 1024U;
|
|
|
|
const size_t DATA2_MEMORY_SIZE = 8U * 1024U * 1024U;
|
|
|
|
const size_t SCRATCH_MEMORY_SIZE = 1U * 1024U * 1024U;
|
|
|
|
|
|
|
|
#ifdef BUILD_DEBUG
|
|
|
|
const size_t DEBUG_MEMORY_SIZE = 1U * 1024U * 1024U;
|
|
|
|
#endif
|
2022-08-01 23:11:10 +00:00
|
|
|
|
|
|
|
const float VIEWPORT_WIDTH = (float)RENDER_WIDTH * WINDOW_HEIGHT / RENDER_HEIGHT;
|
|
|
|
const float VIEWPORT_HEIGHT = (float)RENDER_HEIGHT * WINDOW_HEIGHT / RENDER_HEIGHT;
|
|
|
|
const float VIEWPORT_X = WINDOW_WIDTH/2 - VIEWPORT_WIDTH/2;
|
|
|
|
const float VIEWPORT_Y = WINDOW_HEIGHT/2 - VIEWPORT_HEIGHT/2;
|
|
|
|
|
|
|
|
typedef struct input {
|
2022-08-02 16:35:50 +00:00
|
|
|
bool forward; bool backward;
|
|
|
|
bool strafe_left; bool strafe_right;
|
|
|
|
bool up; bool down;
|
|
|
|
bool left; bool right;
|
2022-08-01 23:11:10 +00:00
|
|
|
bool select;
|
|
|
|
bool interact;
|
|
|
|
bool pause;
|
|
|
|
int mouse_x_delta;
|
|
|
|
int mouse_y_delta;
|
|
|
|
|
2022-08-02 16:35:50 +00:00
|
|
|
#ifdef BUILD_DEBUG
|
2022-08-01 23:11:10 +00:00
|
|
|
struct {
|
2022-08-02 16:35:50 +00:00
|
|
|
bool enable;
|
|
|
|
bool speed;
|
|
|
|
bool up;
|
|
|
|
bool down;
|
|
|
|
} debug;
|
|
|
|
#endif
|
|
|
|
} input_t;
|
2022-08-01 23:11:10 +00:00
|
|
|
|
2022-08-02 16:35:50 +00:00
|
|
|
typedef struct memory_region {
|
|
|
|
void* begin;
|
|
|
|
void* current;
|
|
|
|
void* end;
|
|
|
|
} memory_region_t;
|
2022-08-01 23:11:10 +00:00
|
|
|
|
2022-08-02 16:35:50 +00:00
|
|
|
typedef struct memory {
|
|
|
|
memory_region_t engine;
|
|
|
|
memory_region_t game;
|
|
|
|
memory_region_t data1;
|
|
|
|
memory_region_t data2;
|
|
|
|
memory_region_t scratch;
|
|
|
|
|
|
|
|
#ifdef BUILD_DEBUG
|
|
|
|
memory_region_t debug;
|
|
|
|
#endif
|
2022-08-01 23:11:10 +00:00
|
|
|
} memory_t;
|
|
|
|
|