added separate grid buttons for landscape and portrait screen orientation
[rocksndiamonds.git] / src / libgame / system.h
index c645089b6a3e91d49cce74042daa62280a2ee43d..b5c5fcee6771397befef3e9f6710bf32f26f2e1b 100644 (file)
 #define SCREEN_KEYBOARD_POS(h)         ((h) / 2)
 #endif
 
-
 /* default input keys */
 #define DEFAULT_KEY_LEFT               KSYM_Left
 #define DEFAULT_KEY_RIGHT              KSYM_Right
 #define MAX_GLOBAL_ANIMS               32
 #define MAX_GLOBAL_ANIM_PARTS          32
 
+/* minimum/maximum/default x/y grid size for virtual buttons */
+#define MIN_GRID_XSIZE                 3
+#define MIN_GRID_YSIZE                 3
+#define MAX_GRID_XSIZE                 32
+#define MAX_GRID_YSIZE                 32
+#define GRID_REAL_WIDTH                        MAX(video.screen_width, \
+                                           video.screen_height)
+#define GRID_REAL_HEIGHT               MIN(video.screen_width, \
+                                           video.screen_height)
+#define DEFAULT_GRID_XSIZE_0           18
+#define DEFAULT_GRID_YSIZE_0           MIN(MAX(MIN_GRID_YSIZE,         \
+                                               DEFAULT_GRID_XSIZE_0 *  \
+                                               GRID_REAL_HEIGHT /      \
+                                               GRID_REAL_WIDTH),       \
+                                           MAX_GRID_YSIZE)
+#define DEFAULT_GRID_XSIZE_1           13
+#define DEFAULT_GRID_YSIZE_1           MIN(MAX(MIN_GRID_YSIZE,         \
+                                               DEFAULT_GRID_XSIZE_1 *  \
+                                               GRID_REAL_WIDTH /       \
+                                               GRID_REAL_HEIGHT),      \
+                                           MAX_GRID_YSIZE)
+
+#define DEFAULT_GRID_XSIZE(n)          (n == 0 ? DEFAULT_GRID_XSIZE_0 : \
+                                        DEFAULT_GRID_XSIZE_1)
+#define DEFAULT_GRID_YSIZE(n)          (n == 0 ? DEFAULT_GRID_YSIZE_0 : \
+                                        DEFAULT_GRID_YSIZE_1)
+
+#define GRID_ACTIVE_NR()               (video.screen_width >   \
+                                        video.screen_height ? 0 : 1)
+
+/* values for grid button characters for virtual buttons */
+#define CHAR_GRID_BUTTON_NONE          ' '
+#define CHAR_GRID_BUTTON_LEFT          '<'
+#define CHAR_GRID_BUTTON_RIGHT         '>'
+#define CHAR_GRID_BUTTON_UP            '^'
+#define CHAR_GRID_BUTTON_DOWN          'v'
+#define CHAR_GRID_BUTTON_SNAP          '1'
+#define CHAR_GRID_BUTTON_DROP          '2'
+
 /* default name for empty highscore entry */
 #define EMPTY_PLAYER_NAME      "no name"
 
@@ -976,6 +1014,18 @@ struct OverlayInfo
 {
   boolean enabled;             /* overlay generally enabled or disabled */
   boolean active;              /* overlay activated (depending on game mode) */
+
+  boolean show_grid;
+  boolean show_grid_buttons;
+
+  int grid_xsize_all[2];
+  int grid_ysize_all[2];
+  int grid_xsize;
+  int grid_ysize;
+
+  char grid_button_all[2][MAX_GRID_XSIZE][MAX_GRID_YSIZE];
+  char grid_button[MAX_GRID_XSIZE][MAX_GRID_YSIZE];
+  char grid_button_highlight;
 };
 
 struct JoystickInfo
@@ -1544,6 +1594,7 @@ void SetTileCursorXY(int, int);
 void SetTileCursorSXSY(int, int);
 void SetOverlayEnabled(boolean);
 void SetOverlayActive(boolean);
+void SetOverlayShowGrid(boolean);
 boolean GetOverlayActive();
 void SetDrawDeactivationMask(int);
 int GetDrawDeactivationMask(void);