X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/be8d5aa175777c6b6b5a90342afbd8f77c615911..6ae3730169b0c020d90fe20ace77262d19d26a2b:/puzzles.h diff --git a/puzzles.h b/puzzles.h index a9f1a92..e873351 100644 --- a/puzzles.h +++ b/puzzles.h @@ -14,6 +14,9 @@ #define lenof(array) ( sizeof(array) / sizeof(*(array)) ) +#define STR_INT(x) #x +#define STR(x) STR_INT(x) + enum { LEFT_BUTTON = 0x1000, MIDDLE_BUTTON, @@ -34,6 +37,13 @@ enum { CURSOR_DOWN_RIGHT }; +#define IS_MOUSE_DOWN(m) ( (unsigned)((m) - LEFT_BUTTON) <= \ + (unsigned)(RIGHT_BUTTON - LEFT_BUTTON)) +#define IS_MOUSE_DRAG(m) ( (unsigned)((m) - LEFT_DRAG) <= \ + (unsigned)(RIGHT_DRAG - LEFT_DRAG)) +#define IS_MOUSE_RELEASE(m) ( (unsigned)((m) - LEFT_RELEASE) <= \ + (unsigned)(RIGHT_RELEASE - LEFT_RELEASE)) + #define IGNOREARG(x) ( (x) = (x) ) typedef struct frontend frontend; @@ -201,9 +211,13 @@ struct game { /* * For one-game-at-a-time platforms, there's a single structure - * like the above, under a fixed name. + * like the above, under a fixed name. For all-at-once platforms, + * there's a list of all available puzzles in array form. */ -#ifndef COMBINED +#ifdef COMBINED +extern const game *gamelist[]; +extern const int gamecount; +#else extern const game thegame; #endif