1
0
Fork 0
2022-untitled-game/code/src/common.h

71 lines
1.4 KiB
C
Raw Normal View History

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;
const size_t ENGINE_MEMORY_SIZE = 8U * 1024U * 1024U;
const size_t GAME_MEMORY_SIZE = 8U * 1024U * 1024U;
const size_t SCRATCH_MEMORY_SIZE = 8U * 1024U * 1024U;
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 {
bool up;
bool down;
bool left;
bool right;
bool select;
bool interact;
bool pause;
int mouse_x_delta;
int mouse_y_delta;
} input_t;
typedef struct memory {
struct {
size_t size;
void* begin;
void* current;
void* end;
} engine;
struct {
size_t size;
void* begin;
void* current;
void* end;
} game;
struct {
size_t size;
void* begin;
void* current;
void* end;
} scratch;
} memory_t;