improved global animation class "pointer" for animation at mouse position
[rocksndiamonds.git] / src / libgame / system.c
index 0b9be20e1b4cd209e2bc51ac20aa80bac9140c7e..6f27daf6e94a24461ce60311ce0b1630139fdcba 100644 (file)
@@ -30,6 +30,7 @@
 
 struct ProgramInfo     program;
 struct NetworkInfo     network;
+struct RuntimeInfo     runtime;
 struct OptionInfo      options;
 struct VideoSystemInfo video;
 struct AudioSystemInfo audio;
@@ -114,6 +115,11 @@ void InitNetworkInfo(boolean enabled, boolean connected, boolean serveronly,
   network.server_port = server_port;
 }
 
+void InitRuntimeInfo()
+{
+  runtime.uses_touch_device = FALSE;
+}
+
 void InitScoresInfo(void)
 {
   char *global_scores_dir = getPath2(getCommonDataDir(), SCORES_DIRECTORY);
@@ -311,6 +317,11 @@ void InitGfxCustomArtworkInfo(void)
 void InitGfxOtherSettings(void)
 {
   gfx.cursor_mode = CURSOR_DEFAULT;
+  gfx.cursor_mode_override = CURSOR_UNDEFINED;
+  gfx.cursor_mode_final = gfx.cursor_mode;
+
+  gfx.mouse_x = 0;
+  gfx.mouse_y = 0;
 }
 
 void InitTileCursorInfo(void)
@@ -417,6 +428,11 @@ void SetOverlayShowGrid(boolean show_grid)
     SetOverlayEnabled(TRUE);
 }
 
+boolean GetOverlayEnabled(void)
+{
+  return overlay.enabled;
+}
+
 boolean GetOverlayActive(void)
 {
   return overlay.active;
@@ -1539,6 +1555,7 @@ void SetMouseCursor(int mode)
   static struct MouseCursorInfo *cursor_none = NULL;
   static struct MouseCursorInfo *cursor_playfield = NULL;
   struct MouseCursorInfo *cursor_new;
+  int mode_final = mode;
 
   if (cursor_none == NULL)
     cursor_none = get_cursor_from_image(cursor_image_none);
@@ -1546,13 +1563,17 @@ void SetMouseCursor(int mode)
   if (cursor_playfield == NULL)
     cursor_playfield = get_cursor_from_image(cursor_image_playfield);
 
-  cursor_new = (mode == CURSOR_DEFAULT   ? NULL :
-               mode == CURSOR_NONE      ? cursor_none :
-               mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL);
+  if (gfx.cursor_mode_override != CURSOR_UNDEFINED)
+    mode_final = gfx.cursor_mode_override;
+
+  cursor_new = (mode_final == CURSOR_DEFAULT   ? NULL :
+               mode_final == CURSOR_NONE      ? cursor_none :
+               mode_final == CURSOR_PLAYFIELD ? cursor_playfield : NULL);
 
   SDLSetMouseCursor(cursor_new);
 
   gfx.cursor_mode = mode;
+  gfx.cursor_mode_final = mode_final;
 }
 
 
@@ -1720,12 +1741,18 @@ void StopTextInput(void)
 #endif
 }
 
-boolean CheckCloseWindowEvent(ClientMessageEvent *event)
+void PushUserEvent(int code, int value1, int value2)
 {
-  if (event->type != EVENT_CLIENTMESSAGE)
-    return FALSE;
+  UserEvent event;
+
+  SDL_memset(&event, 0, sizeof(event));
+
+  event.type = EVENT_USER;
+  event.code = code;
+  event.value1 = value1;
+  event.value2 = value2;
 
-  return TRUE;         // the only possible message here is SDL_QUIT
+  SDL_PushEvent((SDL_Event *)&event);
 }