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
|
#include <time.h>
#include "time.h"
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <rlgl.h>
#include "all.h"
void Root(char * filename) {
char path[PATH_MAX], * terminator;
if (!realpath(filename, path)) { return; }
if ((terminator = strrchr(path, '/'))) {
*terminator = '\0';
if(chdir(path)) { abort(); }
}
}
int Update(game_t * game, struct timespec now) {
(void) now;
PollInputEvents();
if (IsWindowResized()) {
game->horizontal = GetScreenWidth(), game->vertical = GetScreenHeight();
GameFrameReset(game);
}
switch (GetKeyPressed()) {
case KEY_ESCAPE: return 1;
}
return 0;
}
void Frame(game_t * game, double interpolation) {
(void)interpolation;
BeginDrawing();
ClearBackground(BLACK);
DrawCenteredText(game, 0, 20, WHITE, "Snails are now preparing! %d", rand());
rlDrawRenderBatchActive();
SwapScreenBuffer();
}
int Main(int count, char ** arguments)
{
(void)count;
game_t game[1] = {0};
char * program_name = arguments[0];
srand(time(NULL));
Root(program_name);
GameInitialize(game, program_name);
GameLoop(game);
GameDeinitialize(game);
return 0;
}
int main (int count, char ** arguments) __attribute__((alias("Main")));
|