blob: 248c475c1f0f6c0a3488049d7558e69fdad6b619 (
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
|
#ifndef __MICRO_CONTEXT_H__
#define __MICRO_CONTEXT_H__
#include <GLFW/glfw3.h>
#include "common.h"
#include "renderer.h"
struct ctx_hints {
int win_width;
int win_height;
const char *win_title;
int ticrate;
};
struct ctx {
struct ctx_hints creation_hints;
GLFWwindow *win;
double ticrate;
double prev_tic_ts;
struct renderer renderer;
};
void init_ctx(struct ctx *ctx, struct ctx_hints creation_hints);
void deinit_ctx(struct ctx *ctx);
// Whether or not the main loop should continue executing.
bool is_game_running(struct ctx *ctx);
// Handle events, tick game logic, etc. Returns the amount of times you should
// tic.
int game_tick(struct ctx *ctx);
// Draw stuff at an interpolated state.
void game_draw(struct ctx *ctx);
#endif // __MICRO_CONTEXT_H__
|