added optional button to restart game (door, panel and touch variants)
[rocksndiamonds.git] / src / libgame / gadgets.h
index 17fccafad3a36a51ea5aeed663c05c97bd742af8..6a27f988f7c8f6b3101708ba0abdaf21d5a2475f 100644 (file)
@@ -4,7 +4,7 @@
 // (c) 1995-2014 by Artsoft Entertainment
 //                         Holger Schemel
 //                 info@artsoft.org
-//                 http://www.artsoft.org/
+//                 https://www.artsoft.org/
 // ----------------------------------------------------------------------------
 // gadgets.h
 // ============================================================================
 #define GD_TYPE_NORMAL_BUTTON          (1 << 0)
 #define GD_TYPE_TEXT_BUTTON            (1 << 1)
 #define GD_TYPE_CHECK_BUTTON           (1 << 2)
-#define GD_TYPE_RADIO_BUTTON           (1 << 3)
-#define GD_TYPE_DRAWING_AREA           (1 << 4)
-#define GD_TYPE_TEXT_INPUT_ALPHANUMERIC        (1 << 5)
-#define GD_TYPE_TEXT_INPUT_NUMERIC     (1 << 6)
-#define GD_TYPE_TEXT_AREA              (1 << 7)
-#define GD_TYPE_SELECTBOX              (1 << 8)
-#define GD_TYPE_SCROLLBAR_VERTICAL     (1 << 9)
-#define GD_TYPE_SCROLLBAR_HORIZONTAL   (1 << 10)
+#define GD_TYPE_CHECK_BUTTON_2         (1 << 3)
+#define GD_TYPE_RADIO_BUTTON           (1 << 4)
+#define GD_TYPE_DRAWING_AREA           (1 << 5)
+#define GD_TYPE_TEXT_INPUT_ALPHANUMERIC        (1 << 6)
+#define GD_TYPE_TEXT_INPUT_NUMERIC     (1 << 7)
+#define GD_TYPE_TEXT_AREA              (1 << 8)
+#define GD_TYPE_SELECTBOX              (1 << 9)
+#define GD_TYPE_SCROLLBAR_VERTICAL     (1 << 10)
+#define GD_TYPE_SCROLLBAR_HORIZONTAL   (1 << 11)
 
 #define GD_TYPE_BUTTON                 (GD_TYPE_NORMAL_BUTTON | \
                                         GD_TYPE_TEXT_BUTTON | \
                                         GD_TYPE_CHECK_BUTTON | \
+                                        GD_TYPE_CHECK_BUTTON_2 | \
                                         GD_TYPE_RADIO_BUTTON)
 #define GD_TYPE_SCROLLBAR              (GD_TYPE_SCROLLBAR_VERTICAL | \
                                         GD_TYPE_SCROLLBAR_HORIZONTAL)
 #define GDI_INFO_TEXT                  48
 #define GDI_ACTIVE                     49
 #define GDI_DIRECT_DRAW                        50
-#define GDI_CALLBACK_ACTION_ALWAYS     51
+#define GDI_OVERLAY_TOUCH_BUTTON       51
+#define GDI_CALLBACK_ACTION_ALWAYS     52
 
 // gadget deactivation hack
 #define GDI_ACTIVE_POS(a)              ((a) < 0 ? POS_OFFSCREEN : (a))
@@ -185,6 +188,15 @@ struct GadgetTextArea
   int cursor_x_preferred;              // "preferred" x cursor position
   int size;                            // maximal size of input text
   int xsize, ysize;                    // size of text area (in chars)
+
+  // automatically determined values
+  boolean cropped;                     // text area cropped to fit viewport
+  int full_x, full_y;                  // text area position when not cropped
+  int crop_width, crop_height;         // size of text area when cropped
+  int crop_xsize, crop_ysize;          // size of text area when cropped
+
+  // runtime values
+  boolean full_open;                   // opening state of text area
 };
 
 struct GadgetSelectbox
@@ -237,6 +249,7 @@ struct GadgetInfo
   int custom_type_id;                  // custom gadget type identifier
   char info_text[MAX_INFO_TEXTSIZE + 1];// short popup info text
   int x, y;                            // gadget position
+  int orig_x, orig_y;                  // gadget position (original)
   int width, height;                   // gadget size
   unsigned int type;                   // type (button, text input, ...)
   unsigned int state;                  // state (pressed, released, ...)
@@ -245,6 +258,8 @@ struct GadgetInfo
   boolean mapped;                      // gadget is mapped on the screen
   boolean active;                      // gadget is active
   boolean direct_draw;                 // directly draw to frontbuffer
+  boolean overlay_touch_button;                // gadget is overlay touch button
+  int overlay_touch_button_alpha;      // overlay touch button alpha value
   boolean callback_action_always;      // also callback if gadget unchanged
   int font;                            // font to use when inactive
   int font_active;                     // font to use when active
@@ -270,6 +285,7 @@ struct GadgetInfo
 
 void InitGadgetsSoundCallback(void (*activating_function)(void),
                              void (*selecting_function)(void));
+void InitGadgetScreenBorders(int, int);
 
 struct GadgetInfo *CreateGadget(int, ...);
 void FreeGadget(struct GadgetInfo *);
@@ -282,6 +298,10 @@ void UnmapGadget(struct GadgetInfo *);
 void UnmapAllGadgets(void);
 void RemapAllGadgets(void);
 
+void SetGadgetsPosition_OverlayTouchButtons(void);
+void DrawGadgets_OverlayTouchButtons(void);
+boolean CheckPosition_OverlayTouchButtons(int, int, int);
+
 boolean anyTextInputGadgetActive(void);
 boolean anyTextAreaGadgetActive(void);
 boolean anySelectboxGadgetActive(void);