-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.h
More file actions
50 lines (35 loc) · 995 Bytes
/
engine.h
File metadata and controls
50 lines (35 loc) · 995 Bytes
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
#ifndef ENGINE_H
#define ENGINE_H
#include "SDL2/SDL.h"
#include "ff_stb.h"
#define ENGINE_VERSION "0.1"
#define MODE_EDITOR 2
#define MODE_GAME 1
#define DEBUG_TEXT_COLOR color(255, 150, 0, 200)
typedef struct Engine_
{
char* window_title;
bool is_running;
bool debug_flag;
uint32_t game_mode;
//Frame Timing Values.
bool show_fps;
//1000.0f / delta_time = FPS
//Delta time is in Seconds.
double delta_time;
//FPS_Samples/FPS_Samples_Num = Average FPS
double fps_samples;
double fps_samples_num;
double performance_freq;
} Engine;
extern Engine engine;
void engine_init();
void engine_quit();
void signal_quit(void* engine);
void engine_change_mode(uint32_t mode);
void engine_loop();
static inline double engine_average_fps() { return engine.fps_samples/engine.fps_samples_num; }
static inline double engine_fps() { return 1.0f/engine.delta_time; }
static inline double engine_delta_time() { return engine.delta_time; }
//int engine_blink_state();
#endif