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.
23 const char *const game_name
= "Null Game";
24 const int game_can_configure
= FALSE
;
39 game_params
*default_params(void)
41 game_params
*ret
= snew(game_params
);
48 int game_fetch_preset(int i
, char **name
, game_params
**params
)
53 void free_params(game_params
*params
)
58 game_params
*dup_params(game_params
*params
)
60 game_params
*ret
= snew(game_params
);
61 *ret
= *params
; /* structure copy */
65 game_params
*decode_params(char const *string
)
67 game_params
*ret
= snew(game_params
);
74 char *encode_params(game_params
*params
)
76 return dupstr("FIXME");
79 config_item
*game_configure(game_params
*params
)
84 game_params
*custom_params(config_item
*cfg
)
89 char *validate_params(game_params
*params
)
94 char *new_game_seed(game_params
*params
, random_state
*rs
)
96 return dupstr("FIXME");
99 char *validate_seed(game_params
*params
, char *seed
)
104 game_state
*new_game(game_params
*params
, char *seed
)
106 game_state
*state
= snew(game_state
);
113 game_state
*dup_game(game_state
*state
)
115 game_state
*ret
= snew(game_state
);
117 ret
->FIXME
= state
->FIXME
;
122 void free_game(game_state
*state
)
127 game_ui
*new_ui(game_state
*state
)
132 void free_ui(game_ui
*ui
)
136 game_state
*make_move(game_state
*from
, game_ui
*ui
, int x
, int y
, int button
)
141 /* ----------------------------------------------------------------------
145 struct game_drawstate
{
149 void game_size(game_params
*params
, int *x
, int *y
)
151 *x
= *y
= 200; /* FIXME */
154 float *game_colours(frontend
*fe
, game_state
*state
, int *ncolours
)
156 float *ret
= snewn(3 * NCOLOURS
, float);
158 frontend_default_colour(fe
, &ret
[COL_BACKGROUND
* 3]);
160 *ncolours
= NCOLOURS
;
164 game_drawstate
*game_new_drawstate(game_state
*state
)
166 struct game_drawstate
*ds
= snew(struct game_drawstate
);
173 void game_free_drawstate(game_drawstate
*ds
)
178 void game_redraw(frontend
*fe
, game_drawstate
*ds
, game_state
*oldstate
,
179 game_state
*state
, game_ui
*ui
,
180 float animtime
, float flashtime
)
183 * The initial contents of the window are not guaranteed and
184 * can vary with front ends. To be on the safe side, all games
185 * should start by drawing a big background-colour rectangle
186 * covering the whole window.
188 draw_rect(fe
, 0, 0, 200, 200, COL_BACKGROUND
);
191 float game_anim_length(game_state
*oldstate
, game_state
*newstate
)
196 float game_flash_length(game_state
*oldstate
, game_state
*newstate
)
201 int game_wants_statusbar(void)