699b896a |
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"; |
c8230524 |
23 | const int game_can_configure = FALSE; |
699b896a |
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 | |
c8230524 |
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 | |
48d70ca9 |
79 | char *new_game_seed(game_params *params, random_state *rs) |
699b896a |
80 | { |
81 | return dupstr("FIXME"); |
82 | } |
83 | |
5928817c |
84 | char *validate_seed(game_params *params, char *seed) |
85 | { |
86 | return NULL; |
87 | } |
88 | |
699b896a |
89 | game_state *new_game(game_params *params, char *seed) |
90 | { |
91 | game_state *state = snew(game_state); |
92 | |
93 | state->FIXME = 0; |
94 | |
95 | return state; |
96 | } |
97 | |
98 | game_state *dup_game(game_state *state) |
99 | { |
100 | game_state *ret = snew(game_state); |
101 | |
102 | ret->FIXME = state->FIXME; |
103 | |
104 | return ret; |
105 | } |
106 | |
107 | void free_game(game_state *state) |
108 | { |
109 | sfree(state); |
110 | } |
111 | |
74a4e547 |
112 | game_ui *new_ui(game_state *state) |
113 | { |
114 | return NULL; |
115 | } |
116 | |
117 | void free_ui(game_ui *ui) |
118 | { |
119 | } |
120 | |
121 | game_state *make_move(game_state *from, game_ui *ui, int x, int y, int button) |
699b896a |
122 | { |
123 | return NULL; |
124 | } |
125 | |
126 | /* ---------------------------------------------------------------------- |
127 | * Drawing routines. |
128 | */ |
129 | |
130 | struct game_drawstate { |
131 | int FIXME; |
132 | }; |
133 | |
134 | void game_size(game_params *params, int *x, int *y) |
135 | { |
136 | *x = *y = 200; /* FIXME */ |
137 | } |
138 | |
139 | float *game_colours(frontend *fe, game_state *state, int *ncolours) |
140 | { |
141 | float *ret = snewn(3 * NCOLOURS, float); |
142 | |
143 | frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]); |
144 | |
145 | *ncolours = NCOLOURS; |
146 | return ret; |
147 | } |
148 | |
149 | game_drawstate *game_new_drawstate(game_state *state) |
150 | { |
151 | struct game_drawstate *ds = snew(struct game_drawstate); |
152 | |
153 | ds->FIXME = 0; |
154 | |
155 | return ds; |
156 | } |
157 | |
158 | void game_free_drawstate(game_drawstate *ds) |
159 | { |
160 | sfree(ds); |
161 | } |
162 | |
163 | void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate, |
74a4e547 |
164 | game_state *state, game_ui *ui, |
165 | float animtime, float flashtime) |
699b896a |
166 | { |
1d30357e |
167 | /* |
168 | * The initial contents of the window are not guaranteed and |
169 | * can vary with front ends. To be on the safe side, all games |
170 | * should start by drawing a big background-colour rectangle |
171 | * covering the whole window. |
172 | */ |
173 | draw_rect(fe, 0, 0, 200, 200, COL_BACKGROUND); |
699b896a |
174 | } |
175 | |
176 | float game_anim_length(game_state *oldstate, game_state *newstate) |
177 | { |
178 | return 0.0F; |
179 | } |
180 | |
181 | float game_flash_length(game_state *oldstate, game_state *newstate) |
182 | { |
183 | return 0.0F; |
184 | } |
fd1a1a2b |
185 | |
186 | int game_wants_statusbar(void) |
187 | { |
188 | return FALSE; |
189 | } |