diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-04-25 20:15:22 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-04-25 20:15:22 +0000 |
| commit | a87bb0576073849b4d316e13132bb6c39c92e78d (patch) | |
| tree | 1900e8f445473da8c33c1f01e807dc43228e2d08 /puzzles.h | |
| parent | 3663603627809a11908dc1dfadd158cfde8e0672 (diff) | |
| download | puzzles-a87bb0576073849b4d316e13132bb6c39c92e78d.zip puzzles-a87bb0576073849b4d316e13132bb6c39c92e78d.tar.gz puzzles-a87bb0576073849b4d316e13132bb6c39c92e78d.tar.bz2 puzzles-a87bb0576073849b4d316e13132bb6c39c92e78d.tar.xz | |
General further development. Sketched out the mid-end, added more
GTK code, rudiments of event passing.
[originally from svn r4141]
Diffstat (limited to 'puzzles.h')
| -rw-r--r-- | puzzles.h | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -20,12 +20,32 @@ enum { RIGHT_BUTTON }; +#define IGNORE(x) ( (x) = (x) ) + +typedef struct midend_data midend_data; +typedef struct random_state random_state; +typedef struct game_params game_params; +typedef struct game_state game_state; + /* * Platform routines */ void fatal(char *fmt, ...); /* + * midend.c + */ +midend_data *midend_new(void); +void midend_free(midend_data *me); +void midend_set_params(midend_data *me, game_params *params); +void midend_size(midend_data *me, int *x, int *y); +void midend_new_game(midend_data *me, char *seed); +void midend_restart_game(midend_data *me); +void midend_undo(midend_data *me); +void midend_redo(midend_data *me); +int midend_process_key(midend_data *me, int x, int y, int button); + +/* * malloc.c */ void *smalloc(int size); @@ -37,12 +57,11 @@ char *dupstr(char *s); #define snewn(number, type) \ ( (type *) smalloc ((number) * sizeof (type)) ) #define sresize(array, number, type) \ - ( (type *) srealloc ((array), (len) * sizeof (type)) ) + ( (type *) srealloc ((array), (number) * sizeof (type)) ) /* * random.c */ -typedef struct random_state random_state; random_state *random_init(char *seed, int len); unsigned long random_upto(random_state *state, unsigned long limit); void random_free(random_state *state); @@ -50,12 +69,13 @@ void random_free(random_state *state); /* * Game-specific routines */ -typedef struct game_params game_params; -typedef struct game_state game_state; +game_params *default_params(void); +void free_params(game_params *params); char *new_game_seed(game_params *params); game_state *new_game(game_params *params, char *seed); game_state *dup_game(game_state *state); void free_game(game_state *state); game_state *make_move(game_state *from, int x, int y, int button); +void game_size(game_params *params, int *x, int *y); #endif /* PUZZLES_PUZZLES_H */ |