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.
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.
22 const char *const game_name = "Null Game";
23 const int game_can_configure = FALSE;
38 game_params *default_params(void)
40 game_params *ret = snew(game_params);
47 int game_fetch_preset(int i, char **name, game_params **params)
52 void free_params(game_params *params)
57 game_params *dup_params(game_params *params)
59 game_params *ret = snew(game_params);
60 *ret = *params; /* structure copy */
64 config_item *game_configure(game_params *params)
69 game_params *custom_params(config_item *cfg)
74 char *validate_params(game_params *params)
79 char *new_game_seed(game_params *params, random_state *rs)
81 return dupstr("FIXME");
84 char *validate_seed(game_params *params, char *seed)
89 game_state *new_game(game_params *params, char *seed)
91 game_state *state = snew(game_state);
98 game_state *dup_game(game_state *state)
100 game_state *ret = snew(game_state);
102 ret->FIXME = state->FIXME;
107 void free_game(game_state *state)
112 game_ui *new_ui(game_state *state)
117 void free_ui(game_ui *ui)
121 game_state *make_move(game_state *from, game_ui *ui, int x, int y, int button)
126 /* ----------------------------------------------------------------------
130 struct game_drawstate {
134 void game_size(game_params *params, int *x, int *y)
136 *x = *y = 200; /* FIXME */
139 float *game_colours(frontend *fe, game_state *state, int *ncolours)
141 float *ret = snewn(3 * NCOLOURS, float);
143 frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
145 *ncolours = NCOLOURS;
149 game_drawstate *game_new_drawstate(game_state *state)
151 struct game_drawstate *ds = snew(struct game_drawstate);
158 void game_free_drawstate(game_drawstate *ds)
163 void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
164 game_state *state, game_ui *ui,
165 float animtime, float flashtime)
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.
173 draw_rect(fe, 0, 0, 200, 200, COL_BACKGROUND);
176 float game_anim_length(game_state *oldstate, game_state *newstate)
181 float game_flash_length(game_state *oldstate, game_state *newstate)
186 int game_wants_statusbar(void)