+#define MODE_READ "rb"
+#define MODE_WRITE "wb"
+#define MODE_APPEND "ab"
+
+#define DEFAULT_DEPTH 0
+
+#define BLIT_OPAQUE 0
+#define BLIT_MASKED 1
+#define BLIT_INVERSE 2
+#define BLIT_ON_BACKGROUND 3
+
+#define FULLSCREEN_NOT_AVAILABLE FALSE
+#define FULLSCREEN_AVAILABLE TRUE
+
+#define CREATE_SPECIAL_EDITION FALSE
+#define CREATE_SPECIAL_EDITION_RND_JUE FALSE
+
+/* default input keys */
+#define DEFAULT_KEY_LEFT KSYM_Left
+#define DEFAULT_KEY_RIGHT KSYM_Right
+#define DEFAULT_KEY_UP KSYM_Up
+#define DEFAULT_KEY_DOWN KSYM_Down
+#if defined(PLATFORM_MACOSX)
+#define DEFAULT_KEY_SNAP KSYM_Control_L
+#define DEFAULT_KEY_DROP KSYM_KP_Enter
+#else
+#define DEFAULT_KEY_SNAP KSYM_Control_L
+#define DEFAULT_KEY_DROP KSYM_Control_R
+#endif
+#define DEFAULT_KEY_OKAY KSYM_Return
+#define DEFAULT_KEY_CANCEL KSYM_Escape
+
+/* default shortcut keys */
+#define DEFAULT_KEY_SAVE_GAME KSYM_F1
+#define DEFAULT_KEY_LOAD_GAME KSYM_F2
+#define DEFAULT_KEY_TOGGLE_PAUSE KSYM_space
+#define DEFAULT_KEY_FOCUS_PLAYER_1 KSYM_F5
+#define DEFAULT_KEY_FOCUS_PLAYER_2 KSYM_F6
+#define DEFAULT_KEY_FOCUS_PLAYER_3 KSYM_F7
+#define DEFAULT_KEY_FOCUS_PLAYER_4 KSYM_F8
+#define DEFAULT_KEY_FOCUS_PLAYER_ALL KSYM_F9
+
+/* values for key_status */
+#define KEY_NOT_PRESSED FALSE
+#define KEY_RELEASED FALSE
+#define KEY_PRESSED TRUE
+
+/* values for button status */
+#define MB_NOT_PRESSED FALSE
+#define MB_NOT_RELEASED TRUE
+#define MB_RELEASED FALSE
+#define MB_PRESSED TRUE
+#define MB_MENU_CHOICE FALSE
+#define MB_MENU_MARK TRUE
+#define MB_MENU_INITIALIZE (-1)
+#define MB_MENU_LEAVE (-2)
+#define MB_LEFTBUTTON 1
+#define MB_MIDDLEBUTTON 2
+#define MB_RIGHTBUTTON 3
+#define MB_WHEEL_UP 4
+#define MB_WHEEL_DOWN 5
+#define MB_WHEEL_LEFT 6
+#define MB_WHEEL_RIGHT 7
+#define IS_WHEEL_BUTTON_VERTICAL(b) ((b) >= MB_WHEEL_UP && \
+ (b) <= MB_WHEEL_DOWN)
+#define IS_WHEEL_BUTTON_HORIZONTAL(b) ((b) >= MB_WHEEL_LEFT && \
+ (b) <= MB_WHEEL_RIGHT)
+#define IS_WHEEL_BUTTON(b) ((b) >= MB_WHEEL_UP && \
+ (b) <= MB_WHEEL_DOWN)
+#define DEFAULT_WHEEL_STEPS 3
+
+/* values for move directions */
+#define MV_BIT_LEFT 0
+#define MV_BIT_RIGHT 1
+#define MV_BIT_UP 2
+#define MV_BIT_DOWN 3
+
+#define NUM_DIRECTIONS 4
+
+/* diagonal movement directions are used in a different contect than buttons */
+#define MV_BIT_UPLEFT 4
+#define MV_BIT_UPRIGHT 5
+#define MV_BIT_DOWNLEFT 6
+#define MV_BIT_DOWNRIGHT 7
+
+#define NUM_DIRECTIONS_FULL 8
+
+/* values for special "button" bitmasks */
+#define BUTTON_1 4
+#define BUTTON_2 5
+
+/* values for special "focus player" bitmasks */
+#define BIT_SET_FOCUS 6
+
+/* values for move directions and special "button" key bitmasks */
+#define MV_NONE 0
+#define MV_LEFT (1 << MV_BIT_LEFT)
+#define MV_RIGHT (1 << MV_BIT_RIGHT)
+#define MV_UP (1 << MV_BIT_UP)
+#define MV_DOWN (1 << MV_BIT_DOWN)
+
+#define MV_UPLEFT (MV_UP | MV_LEFT)
+#define MV_UPRIGHT (MV_UP | MV_RIGHT)
+#define MV_DOWNLEFT (MV_DOWN | MV_LEFT)
+#define MV_DOWNRIGHT (MV_DOWN | MV_RIGHT)
+
+#define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
+#define MV_VERTICAL (MV_UP | MV_DOWN)
+#define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
+#define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
+#define MV_NO_DIRECTION (MV_NONE)
+
+#define KEY_BUTTON_1 (1 << BUTTON_1)
+#define KEY_BUTTON_2 (1 << BUTTON_2)
+#define KEY_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
+#define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
+#define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
+
+#define KEY_SET_FOCUS (1 << BIT_SET_FOCUS)
+
+#define MV_DIR_FROM_BIT(x) ((x) < NUM_DIRECTIONS ? 1 << (x) : \
+ (x) == MV_BIT_UPLEFT ? MV_UPLEFT : \
+ (x) == MV_BIT_UPRIGHT ? MV_UPRIGHT : \
+ (x) == MV_BIT_DOWNLEFT ? MV_DOWNLEFT : \
+ (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \
+ MV_NONE)
+
+#define MV_DIR_TO_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
+ (x) == MV_RIGHT ? MV_BIT_RIGHT : \
+ (x) == MV_UP ? MV_BIT_UP : \
+ (x) == MV_DOWN ? MV_BIT_DOWN : \
+ (x) == MV_UPLEFT ? MV_BIT_UPLEFT : \
+ (x) == MV_UPRIGHT ? MV_BIT_UPRIGHT : \
+ (x) == MV_DOWNLEFT ? MV_BIT_DOWNLEFT : \
+ (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \
+ MV_BIT_DOWN)
+
+#define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \
+ (x) == MV_RIGHT ? MV_LEFT : \
+ (x) == MV_UP ? MV_DOWN : \
+ (x) == MV_DOWN ? MV_UP : \
+ (x) == MV_UPLEFT ? MV_DOWNRIGHT : \
+ (x) == MV_UPRIGHT ? MV_DOWNLEFT : \
+ (x) == MV_DOWNLEFT ? MV_UPRIGHT : \
+ (x) == MV_DOWNRIGHT ? MV_UPLEFT : \
+ MV_NONE)
+
+/* values for animation mode (frame order and direction) */
+#define ANIM_NONE 0
+#define ANIM_LOOP (1 << 0)
+#define ANIM_LINEAR (1 << 1)
+#define ANIM_PINGPONG (1 << 2)
+#define ANIM_PINGPONG2 (1 << 3)
+#define ANIM_RANDOM (1 << 4)
+#define ANIM_CE_VALUE (1 << 5)
+#define ANIM_CE_SCORE (1 << 6)
+#define ANIM_CE_DELAY (1 << 7)
+#define ANIM_REVERSE (1 << 8)
+#define ANIM_OPAQUE_PLAYER (1 << 9)
+
+/* values for special (non game element) animation modes */
+#define ANIM_HORIZONTAL (1 << 10)
+#define ANIM_VERTICAL (1 << 11)
+#define ANIM_CENTERED (1 << 12)
+#define ANIM_STATIC_PANEL (1 << 13)
+
+#define ANIM_DEFAULT ANIM_LOOP
+
+/* values for fade mode */
+#define FADE_TYPE_NONE 0
+#define FADE_TYPE_FADE_IN (1 << 0)
+#define FADE_TYPE_FADE_OUT (1 << 1)
+#define FADE_TYPE_TRANSFORM (1 << 2)
+#define FADE_TYPE_CROSSFADE (1 << 3)
+#define FADE_TYPE_MELT (1 << 4)
+#define FADE_TYPE_SKIP (1 << 5)
+
+#define FADE_MODE_NONE (FADE_TYPE_NONE)
+#define FADE_MODE_FADE_IN (FADE_TYPE_FADE_IN)
+#define FADE_MODE_FADE_OUT (FADE_TYPE_FADE_OUT)
+#define FADE_MODE_FADE (FADE_TYPE_FADE_IN | FADE_TYPE_FADE_OUT)
+#define FADE_MODE_TRANSFORM (FADE_TYPE_TRANSFORM | FADE_TYPE_FADE_IN)
+#define FADE_MODE_CROSSFADE (FADE_MODE_TRANSFORM | FADE_TYPE_CROSSFADE)
+#define FADE_MODE_MELT (FADE_MODE_TRANSFORM | FADE_TYPE_MELT)
+#define FADE_MODE_SKIP_FADE_IN (FADE_TYPE_SKIP | FADE_TYPE_FADE_IN)
+#define FADE_MODE_SKIP_FADE_OUT (FADE_TYPE_SKIP | FADE_TYPE_FADE_OUT)
+
+#define FADE_MODE_DEFAULT FADE_MODE_FADE
+
+/* values for text alignment */
+#define ALIGN_LEFT (1 << 0)
+#define ALIGN_RIGHT (1 << 1)
+#define ALIGN_CENTER (1 << 2)
+#define ALIGN_DEFAULT ALIGN_LEFT
+
+#define VALIGN_TOP (1 << 0)
+#define VALIGN_BOTTOM (1 << 1)
+#define VALIGN_MIDDLE (1 << 2)
+#define VALIGN_DEFAULT VALIGN_TOP
+
+#define ALIGNED_XPOS(x,w,a) ((a) == ALIGN_CENTER ? (x) - (w) / 2 : \
+ (a) == ALIGN_RIGHT ? (x) - (w) : (x))
+#define ALIGNED_YPOS(y,h,v) ((v) == VALIGN_MIDDLE ? (y) - (h) / 2 : \
+ (v) == VALIGN_BOTTOM ? (y) - (h) : (y))
+#define ALIGNED_TEXT_XPOS(p) ALIGNED_XPOS((p)->x, (p)->width, (p)->align)
+#define ALIGNED_TEXT_YPOS(p) ALIGNED_YPOS((p)->y, (p)->height, (p)->valign)