-
Notifications
You must be signed in to change notification settings - Fork 4
/
dessert-stroke.c
50 lines (42 loc) · 990 Bytes
/
dessert-stroke.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
/* This file is part of punani-strike
* Copyright (c) 2011 Gianni Tedesco
* Released under the terms of GPLv3
*/
#include <punani/punani.h>
#include <punani/game.h>
#include <punani/renderer.h>
#include <punani/tex.h>
#include "dessert-stroke.h"
#include "game-modes.h"
static const struct game_ops *game_modes[DS_NUM_STATES] = {
[GAME_STATE_STOPPED] = NULL,
[DS_STATE_LOBBY] = &lobby_ops,
[DS_STATE_ON] = &world_ops,
};
static void mode_exit(struct _game *g, int code)
{
switch(game_state(g)) {
case DS_STATE_LOBBY:
game_set_state(g, DS_STATE_ON);
break;
case DS_STATE_ON:
game_exit(g);
break;
default:
abort();
}
}
int main(int argc, char **argv)
{
game_t g;
g = game_new(game_modes, DS_NUM_STATES, mode_exit, NULL);
if ( NULL == g )
return EXIT_FAILURE;
if ( !game_mode(g, "Dessert Stroke", 960, 540, 24, 0) )
return EXIT_FAILURE;
game_set_state(g, DS_STATE_LOBBY);
if ( !game_main(g) )
return EXIT_FAILURE;
game_free(g);
return EXIT_SUCCESS;
}