+ char *(*encode_ui)(const game_ui *ui);
+ void (*decode_ui)(game_ui *ui, const char *encoding);
+ void (*changed_state)(game_ui *ui, const game_state *oldstate,
+ const game_state *newstate);
+ char *(*interpret_move)(const game_state *state, game_ui *ui,
+ const game_drawstate *ds, int x, int y, int button);
+ game_state *(*execute_move)(const game_state *state, const char *move);
+ int preferred_tilesize;
+ void (*compute_size)(const game_params *params, int tilesize,
+ int *x, int *y);
+ void (*set_size)(drawing *dr, game_drawstate *ds,
+ const game_params *params, int tilesize);
+ float *(*colours)(frontend *fe, int *ncolours);
+ game_drawstate *(*new_drawstate)(drawing *dr, const game_state *state);
+ void (*free_drawstate)(drawing *dr, game_drawstate *ds);
+ void (*redraw)(drawing *dr, game_drawstate *ds, const game_state *oldstate,
+ const game_state *newstate, int dir, const game_ui *ui,
+ float anim_time, float flash_time);
+ float (*anim_length)(const game_state *oldstate,
+ const game_state *newstate, int dir, game_ui *ui);
+ float (*flash_length)(const game_state *oldstate,
+ const game_state *newstate, int dir, game_ui *ui);
+ int (*status)(const game_state *state);
+ int can_print, can_print_in_colour;
+ void (*print_size)(const game_params *params, float *x, float *y);
+ void (*print)(drawing *dr, const game_state *state, int tilesize);
+ int wants_statusbar;
+ int is_timed;
+ int (*timing_state)(const game_state *state, game_ui *ui);
+ int flags;
+};
+
+/*
+ * Data structure containing the drawing API implemented by the
+ * front end and also by cross-platform printing modules such as
+ * PostScript.
+ */
+struct drawing_api {
+ void (*draw_text)(void *handle, int x, int y, int fonttype, int fontsize,
+ int align, int colour, char *text);
+ void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour);
+ void (*draw_line)(void *handle, int x1, int y1, int x2, int y2,
+ int colour);
+ void (*draw_polygon)(void *handle, int *coords, int npoints,
+ int fillcolour, int outlinecolour);
+ void (*draw_circle)(void *handle, int cx, int cy, int radius,
+ int fillcolour, int outlinecolour);
+ void (*draw_update)(void *handle, int x, int y, int w, int h);
+ void (*clip)(void *handle, int x, int y, int w, int h);
+ void (*unclip)(void *handle);
+ void (*start_draw)(void *handle);
+ void (*end_draw)(void *handle);
+ void (*status_bar)(void *handle, char *text);
+ blitter *(*blitter_new)(void *handle, int w, int h);
+ void (*blitter_free)(void *handle, blitter *bl);
+ void (*blitter_save)(void *handle, blitter *bl, int x, int y);
+ void (*blitter_load)(void *handle, blitter *bl, int x, int y);
+ void (*begin_doc)(void *handle, int pages);
+ void (*begin_page)(void *handle, int number);
+ void (*begin_puzzle)(void *handle, float xm, float xc,
+ float ym, float yc, int pw, int ph, float wmm);
+ void (*end_puzzle)(void *handle);
+ void (*end_page)(void *handle, int number);
+ void (*end_doc)(void *handle);
+ void (*line_width)(void *handle, float width);
+ void (*line_dotted)(void *handle, int dotted);
+ char *(*text_fallback)(void *handle, const char *const *strings,
+ int nstrings);
+ void (*draw_thick_line)(void *handle, float thickness,
+ float x1, float y1, float x2, float y2,
+ int colour);