-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.c
61 lines (54 loc) · 1.22 KB
/
game.c
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
#include "game.h"
#include "render.h"
#include "common.h"
#include "tanto/m_math.h"
#include "tanto/t_utils.h"
#include <assert.h>
#include <string.h>
#include <tanto/t_def.h>
#include <tanto/i_input.h>
static Vec2 mousePos;
Parms parms;
struct ShaderParms* pShaderParms;
static float t;
void g_Init(void)
{
parms.shouldRun = true;
pShaderParms = r_GetParms();
t = 0.0;
}
void g_Responder(const Tanto_I_Event *event)
{
switch (event->type)
{
case TANTO_I_KEYDOWN: switch (event->data.keyCode)
{
case TANTO_KEY_ESC: parms.shouldRun = false; break;
default: return;
} break;
case TANTO_I_KEYUP: switch (event->data.keyCode)
{
default: return;
} break;
case TANTO_I_MOTION:
{
mousePos.x = (float)event->data.mouseData.x / TANTO_WINDOW_WIDTH;
mousePos.y = (float)event->data.mouseData.y / TANTO_WINDOW_HEIGHT;
} break;
case TANTO_I_MOUSEDOWN:
{
} break;
case TANTO_I_MOUSEUP:
{
} break;
case TANTO_I_RESIZE:
{
} break;
default: break;
}
}
void g_Update(void)
{
t += 0.016;
pShaderParms->time = t;
}