chiark / gitweb /
Configuration dialog box, on the GTK front end only as yet.
[sgt-puzzles.git] / nullgame.c
1 /*
2  * nullgame.c [FIXME]: Template defining the null game (in which no
3  * moves are permitted and nothing is ever drawn). This file exists
4  * solely as a basis for constructing new game definitions - it
5  * helps to have something which will compile from the word go and
6  * merely doesn't _do_ very much yet.
7  * 
8  * Parts labelled FIXME actually want _removing_ (e.g. the dummy
9  * field in each of the required data structures, and this entire
10  * comment itself) when converting this source file into one
11  * describing a real game.
12  */
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
17 #include <assert.h>
18 #include <math.h>
19
20 #include "puzzles.h"
21
22 const char *const game_name = "Null Game";
23 const int game_can_configure = FALSE;
24
25 enum {
26     COL_BACKGROUND,
27     NCOLOURS
28 };
29
30 struct game_params {
31     int FIXME;
32 };
33
34 struct game_state {
35     int FIXME;
36 };
37
38 game_params *default_params(void)
39 {
40     game_params *ret = snew(game_params);
41
42     ret->FIXME = 0;
43
44     return ret;
45 }
46
47 int game_fetch_preset(int i, char **name, game_params **params)
48 {
49     return FALSE;
50 }
51
52 void free_params(game_params *params)
53 {
54     sfree(params);
55 }
56
57 game_params *dup_params(game_params *params)
58 {
59     game_params *ret = snew(game_params);
60     *ret = *params;                    /* structure copy */
61     return ret;
62 }
63
64 config_item *game_configure(game_params *params)
65 {
66     return NULL;
67 }
68
69 game_params *custom_params(config_item *cfg)
70 {
71     return NULL;
72 }
73
74 char *validate_params(game_params *params)
75 {
76     return NULL;
77 }
78
79 char *new_game_seed(game_params *params)
80 {
81     return dupstr("FIXME");
82 }
83
84 game_state *new_game(game_params *params, char *seed)
85 {
86     game_state *state = snew(game_state);
87
88     state->FIXME = 0;
89
90     return state;
91 }
92
93 game_state *dup_game(game_state *state)
94 {
95     game_state *ret = snew(game_state);
96
97     ret->FIXME = state->FIXME;
98
99     return ret;
100 }
101
102 void free_game(game_state *state)
103 {
104     sfree(state);
105 }
106
107 game_state *make_move(game_state *from, int x, int y, int button)
108 {
109     return NULL;
110 }
111
112 /* ----------------------------------------------------------------------
113  * Drawing routines.
114  */
115
116 struct game_drawstate {
117     int FIXME;
118 };
119
120 void game_size(game_params *params, int *x, int *y)
121 {
122     *x = *y = 200;                     /* FIXME */
123 }
124
125 float *game_colours(frontend *fe, game_state *state, int *ncolours)
126 {
127     float *ret = snewn(3 * NCOLOURS, float);
128
129     frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
130
131     *ncolours = NCOLOURS;
132     return ret;
133 }
134
135 game_drawstate *game_new_drawstate(game_state *state)
136 {
137     struct game_drawstate *ds = snew(struct game_drawstate);
138
139     ds->FIXME = 0;
140
141     return ds;
142 }
143
144 void game_free_drawstate(game_drawstate *ds)
145 {
146     sfree(ds);
147 }
148
149 void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
150                  game_state *state, float animtime, float flashtime)
151 {
152 }
153
154 float game_anim_length(game_state *oldstate, game_state *newstate)
155 {
156     return 0.0F;
157 }
158
159 float game_flash_length(game_state *oldstate, game_state *newstate)
160 {
161     return 0.0F;
162 }
163
164 int game_wants_statusbar(void)
165 {
166     return FALSE;
167 }