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 /net.c | |
| 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 'net.c')
| -rw-r--r-- | net.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -90,6 +90,26 @@ static struct xyd *new_xyd(int x, int y, int direction) } /* ---------------------------------------------------------------------- + * Manage game parameters. + */ +game_params *default_params(void) +{ + game_params *ret = snew(game_params); + + ret->width = 5; + ret->height = 5; + ret->wrapping = FALSE; + ret->barrier_probability = 0.0; + + return ret; +} + +void free_params(game_params *params) +{ + sfree(params); +} + +/* ---------------------------------------------------------------------- * Randomly select a new game seed. */ @@ -511,8 +531,8 @@ game_state *make_move(game_state *state, int x, int y, int button) /* * The button must have been clicked on a valid tile. */ - x -= WINDOW_OFFSET; - y -= WINDOW_OFFSET; + x -= WINDOW_OFFSET + TILE_BORDER; + y -= WINDOW_OFFSET + TILE_BORDER; if (x < 0 || y < 0) return NULL; tx = x / TILE_SIZE; @@ -586,6 +606,12 @@ game_state *make_move(game_state *state, int x, int y, int button) * Routines for drawing the game position on the screen. */ +void game_size(game_params *params, int *x, int *y) +{ + *x = WINDOW_OFFSET * 2 + TILE_SIZE * params->width + TILE_BORDER; + *y = WINDOW_OFFSET * 2 + TILE_SIZE * params->height + TILE_BORDER; +} + /* ---------------------------------------------------------------------- * Test code. */ |