From 5a9927b017cadc09250e6b3de89a88d23bf89143 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 8 Feb 2007 01:10:37 +0100 Subject: [PATCH] rnd-20070208-1-src * added blanking of mouse pointer when displaying title screens --- ChangeLog | 1 + src/conftime.h | 2 +- src/libgame/system.c | 40 ++++++++++++++++++++++++++++++---------- src/libgame/system.h | 3 ++- src/screens.c | 6 ++++++ 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec569071..eacd13ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * changed end of game again: do not wait for the user to press a key anymore, but directly ask/confirm tape saving and go to hall of fame * re-enabled quitting of lost game by pressing space or return again + * added blanking of mouse pointer when displaying title screens 2007-02-05 * improved handling of title text messages (initial and for level set) diff --git a/src/conftime.h b/src/conftime.h index 7fbda943..7b6b8c06 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-02-07 23:23" +#define COMPILE_DATE_STRING "2007-02-08 01:05" diff --git a/src/libgame/system.c b/src/libgame/system.c index 7d0099f4..46910d43 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -986,8 +986,9 @@ void ScaleBitmap(Bitmap *old_bitmap, int zoom_factor) /* ------------------------------------------------------------------------- */ #if !defined(PLATFORM_MSDOS) -/* XPM */ -static const char *cursor_image_playfield[] = +#define USE_ONE_PIXEL_PLAYFIELD_MOUSEPOINTER 0 +/* XPM image definitions */ +static const char *cursor_image_none[] = { /* width height num_colors chars_per_pixel */ " 16 16 3 1", @@ -997,10 +998,6 @@ static const char *cursor_image_playfield[] = ". c #ffffff", " c None", -#if 1 - /* some people complained about a "white dot" on the screen and thought it - was a graphical error... OK, let's just remove the whole pointer :-) */ - /* pixels */ " ", " ", @@ -1021,8 +1018,17 @@ static const char *cursor_image_playfield[] = /* hot spot */ "0,0" +}; +#if defined(USE_ONE_PIXEL_PLAYFIELD_MOUSEPOINTER) +static const char *cursor_image_dot[] = +{ + /* width height num_colors chars_per_pixel */ + " 16 16 3 1", -#else + /* colors */ + "X c #000000", + ". c #ffffff", + " c None", /* pixels */ " X ", @@ -1044,8 +1050,13 @@ static const char *cursor_image_playfield[] = /* hot spot */ "1,1" -#endif }; +static const char **cursor_image_playfield = cursor_image_dot; +#else +/* some people complained about a "white dot" on the screen and thought it + was a graphical error... OK, let's just remove the whole pointer :-) */ +static const char **cursor_image_playfield = cursor_image_none; +#endif #if defined(TARGET_SDL) static const int cursor_bit_order = BIT_ORDER_MSB; @@ -1104,15 +1115,24 @@ static struct MouseCursorInfo *get_cursor_from_image(const char **image) void SetMouseCursor(int mode) { #if !defined(PLATFORM_MSDOS) + static struct MouseCursorInfo *cursor_none = NULL; static struct MouseCursorInfo *cursor_playfield = NULL; + struct MouseCursorInfo *cursor_new; + + if (cursor_none == NULL) + cursor_none = get_cursor_from_image(cursor_image_none); 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 defined(TARGET_SDL) - SDLSetMouseCursor(mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL); + SDLSetMouseCursor(cursor_new); #elif defined(TARGET_X11_NATIVE) - X11SetMouseCursor(mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL); + X11SetMouseCursor(cursor_new); #endif #endif } diff --git a/src/libgame/system.h b/src/libgame/system.h index fcb2034b..0a1c3906 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -251,7 +251,8 @@ /* values for mouse cursor */ #define CURSOR_DEFAULT 0 -#define CURSOR_PLAYFIELD 1 +#define CURSOR_NONE 1 +#define CURSOR_PLAYFIELD 2 /* fundamental game speed values */ #define ONE_SECOND_DELAY 1000 /* delay value for one second */ diff --git a/src/screens.c b/src/screens.c index b78ccf24..1a900b21 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1059,6 +1059,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) else BackToFront(); + SetMouseCursor(CURSOR_DEFAULT); + InitAnimation(); OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); @@ -1164,6 +1166,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title.auto_delay_final = -1; } + SetMouseCursor(CURSOR_NONE); + FadeIn(REDRAW_ALL); DelayReached(&title_delay, 0); /* reset delay counter */ @@ -1245,6 +1249,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) RedrawBackground(); + SetMouseCursor(CURSOR_DEFAULT); + if (game_status == GAME_MODE_INFO) { OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); -- 2.34.1