changed mouse cursor on title screens not being always invisible
authorHolger Schemel <info@artsoft.org>
Mon, 2 Mar 2015 20:33:17 +0000 (21:33 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 2 Mar 2015 20:36:26 +0000 (21:36 +0100)
ChangeLog
src/events.c
src/init.c
src/libgame/system.c
src/libgame/system.h

index c91f0820ac21eded062e766dd8c17725a22008a0..d0f69ab6c0a62f241548b9d3ec8edec6d1d5472a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-02
+       * added classic graphics, sounds and music to git repository
+       * added classic level sets to git repository
+       * added element description files to git repository
+       * changed mouse cursor on title screens not being always invisible
+
 2015-02-27
        * fixed using "background.TOOLBOX", which was simply ignored before
 
index f89e5236071b7d30c8e66499a539808a868f5d53..7a366aa7fc4e24b7f121fd7a7f41df31ae168923 100644 (file)
@@ -33,9 +33,9 @@
 
 
 static boolean cursor_inside_playfield = FALSE;
-static boolean playfield_cursor_set = FALSE;
-static unsigned int playfield_cursor_delay = 0;
-
+static int cursor_mode_last = CURSOR_DEFAULT;
+static unsigned int special_cursor_delay = 0;
+static unsigned int special_cursor_delay_value = 1000;
 
 /* event filter especially needed for SDL event filtering due to
    delay problems with lots of mouse motion events when mouse button
@@ -64,11 +64,18 @@ static int FilterEventsExt(const Event *event)
   cursor_inside_playfield = (motion->x >= SX && motion->x < SX + SXSIZE &&
                             motion->y >= SY && motion->y < SY + SYSIZE);
 
-  if (game_status == GAME_MODE_PLAYING && playfield_cursor_set)
+  /* do no reset mouse cursor before all pending events have been processed */
+  if (gfx.cursor_mode == cursor_mode_last &&
+      ((effectiveGameStatus() == GAME_MODE_TITLE &&
+       gfx.cursor_mode == CURSOR_NONE) ||
+       (game_status == GAME_MODE_PLAYING &&
+       gfx.cursor_mode == CURSOR_PLAYFIELD)))
   {
     SetMouseCursor(CURSOR_DEFAULT);
-    playfield_cursor_set = FALSE;
-    DelayReached(&playfield_cursor_delay, 0);
+
+    DelayReached(&special_cursor_delay, 0);
+
+    cursor_mode_last = CURSOR_DEFAULT;
   }
 
   /* skip mouse motion events without pressed button outside level editor */
@@ -202,21 +209,34 @@ void EventLoop(void)
     }
     else
     {
-      /* when playing, display a special mouse pointer inside the playfield */
-      if (game_status == GAME_MODE_PLAYING && !tape.pausing)
+      if (effectiveGameStatus() == GAME_MODE_TITLE)
+      {
+       /* when showing title screens, hide mouse pointer (if not moved) */
+
+       if (gfx.cursor_mode != CURSOR_NONE &&
+           DelayReached(&special_cursor_delay, special_cursor_delay_value))
+       {
+         SetMouseCursor(CURSOR_NONE);
+       }
+      }
+      else if (game_status == GAME_MODE_PLAYING && !tape.pausing)
       {
-       if (!playfield_cursor_set && cursor_inside_playfield &&
-           DelayReached(&playfield_cursor_delay, 1000))
+       /* when playing, display a special mouse pointer inside the playfield */
+
+       if (gfx.cursor_mode != CURSOR_PLAYFIELD &&
+           cursor_inside_playfield &&
+           DelayReached(&special_cursor_delay, special_cursor_delay_value))
        {
          SetMouseCursor(CURSOR_PLAYFIELD);
-         playfield_cursor_set = TRUE;
        }
       }
-      else if (playfield_cursor_set)
+      else if (gfx.cursor_mode != CURSOR_DEFAULT)
       {
        SetMouseCursor(CURSOR_DEFAULT);
-       playfield_cursor_set = FALSE;
       }
+
+      /* this is set after all pending events have been processed */
+      cursor_mode_last = gfx.cursor_mode;
     }
 
     /* also execute after pending events have been processed before */
index 38dd52b693e57de59e6d1b043d2b88c4431674d9..25e8c07a3b6da5556edefdbb661785ffae52bf3a 100644 (file)
@@ -5075,6 +5075,7 @@ void InitGfx()
 
   InitGfxBuffers();
   InitGfxCustomArtworkInfo();
+  InitGfxOtherSettings();
 
   bitmap_font_initial = LoadCustomImage(filename_font_initial);
 
index eec5d192960ac9e784d5232ad8e47ef5ccb90dc1..f45e87e8b91885bcc78e371a288891a35a357408 100644 (file)
@@ -247,6 +247,11 @@ void InitGfxCustomArtworkInfo()
   gfx.draw_init_text = TRUE;
 }
 
+void InitGfxOtherSettings()
+{
+  gfx.cursor_mode = CURSOR_DEFAULT;
+}
+
 void SetDrawDeactivationMask(int draw_deactivation_mask)
 {
   gfx.draw_deactivation_mask = draw_deactivation_mask;
@@ -1262,6 +1267,8 @@ void SetMouseCursor(int mode)
                mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL);
 
   SDLSetMouseCursor(cursor_new);
+
+  gfx.cursor_mode = mode;
 }
 
 
index d5027aecd803aedaa1543eb07bebe01fb748d927..bb78fbe9453b442d666aa8b603b060f6ca327932 100644 (file)
@@ -813,6 +813,8 @@ struct GfxInfo
   int anim_random_frame;
 
   void (*draw_busy_anim_function)(void);
+
+  int cursor_mode;
 };
 
 struct JoystickInfo
@@ -1283,6 +1285,7 @@ void InitGfxScrollbufferInfo(int, int);
 void InitGfxClipRegion(boolean, int, int, int, int);
 void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
 void InitGfxCustomArtworkInfo();
+void InitGfxOtherSettings();
 void SetDrawDeactivationMask(int);
 void SetDrawBackgroundMask(int);
 void SetWindowBackgroundBitmap(Bitmap *);