diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-05-11 17:44:30 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-05-11 17:44:30 +0000 |
| commit | 180802b362c715dfb22893021f3434834447e5b5 (patch) | |
| tree | a19141061c1ce27e17dbb3dda20eaf4cfbbf2cb6 /puzzles.h | |
| parent | a1c88470a30cf57226aa091f546da18d0dff07e1 (diff) | |
| download | puzzles-180802b362c715dfb22893021f3434834447e5b5.zip puzzles-180802b362c715dfb22893021f3434834447e5b5.tar.gz puzzles-180802b362c715dfb22893021f3434834447e5b5.tar.bz2 puzzles-180802b362c715dfb22893021f3434834447e5b5.tar.xz | |
Framework alteration: we now support a `game_ui' structure in
addition to the `game_state'. The new structure is intended to
contain ephemeral data pertaining to the game's user interface
rather than the actual game: things stored in the UI structure are
not restored in an Undo, for example.
make_move() is passed the UI to modify as it wishes; it is now
allowed to return the _same_ game_state it was passed, to indicate
that although no move has been made there has been a UI operation
requiring a redraw.
[originally from svn r4207]
Diffstat (limited to 'puzzles.h')
| -rw-r--r-- | puzzles.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -18,6 +18,12 @@ enum { LEFT_BUTTON = 0x1000, MIDDLE_BUTTON, RIGHT_BUTTON, + LEFT_DRAG, + MIDDLE_DRAG, + RIGHT_DRAG, + LEFT_RELEASE, + MIDDLE_RELEASE, + RIGHT_RELEASE, CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, @@ -36,6 +42,7 @@ typedef struct midend_data midend_data; typedef struct random_state random_state; typedef struct game_params game_params; typedef struct game_state game_state; +typedef struct game_ui game_ui; typedef struct game_drawstate game_drawstate; #define ALIGN_VNORMAL 0x000 @@ -165,13 +172,16 @@ char *validate_seed(game_params *params, char *seed); 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); +game_ui *new_ui(game_state *state); +void free_ui(game_ui *ui); +game_state *make_move(game_state *from, game_ui *ui, int x, int y, int button); void game_size(game_params *params, int *x, int *y); float *game_colours(frontend *fe, game_state *state, int *ncolours); game_drawstate *game_new_drawstate(game_state *state); void game_free_drawstate(game_drawstate *ds); void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate, - game_state *newstate, float anim_time, float flash_time); + game_state *newstate, game_ui *ui, float anim_time, + float flash_time); float game_anim_length(game_state *oldstate, game_state *newstate); float game_flash_length(game_state *oldstate, game_state *newstate); int game_wants_statusbar(void); |