summaryrefslogtreecommitdiff
path: root/textscreen/txt_sdl.c
diff options
context:
space:
mode:
authorSimon Howard2011-04-04 20:07:07 +0000
committerSimon Howard2011-04-04 20:07:07 +0000
commit9f3f6683d929d118b18e21b06a0b729586569e1a (patch)
tree1a30dd5d65b9b371eb7beb66273ba134f2a38319 /textscreen/txt_sdl.c
parentf596cfcd76c8c03c41c0691561c9b3c9c4419393 (diff)
downloadchocolate-doom-9f3f6683d929d118b18e21b06a0b729586569e1a.tar.gz
chocolate-doom-9f3f6683d929d118b18e21b06a0b729586569e1a.tar.bz2
chocolate-doom-9f3f6683d929d118b18e21b06a0b729586569e1a.zip
Change the background color when hovering over widgets.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2320
Diffstat (limited to 'textscreen/txt_sdl.c')
-rw-r--r--textscreen/txt_sdl.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c
index 365e6bf0..5ae151e9 100644
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -221,7 +221,7 @@ int TXT_Init(void)
// Ignore all mouse motion events
- SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
+// SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
// Repeat key presses so we can hold down arrows to scroll down the
// menu, for example. This is what setup.exe does.
@@ -475,6 +475,24 @@ static int SDLButtonToTXTButton(int button)
}
}
+static int MouseHasMoved(void)
+{
+ static int last_x = 0, last_y = 0;
+ int x, y;
+
+ TXT_GetMousePosition(&x, &y);
+
+ if (x != last_x || y != last_y)
+ {
+ last_x = x; last_y = y;
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
signed int TXT_GetChar(void)
{
SDL_Event ev;
@@ -510,6 +528,12 @@ signed int TXT_GetChar(void)
// Quit = escape
return 27;
+ case SDL_MOUSEMOTION:
+ if (MouseHasMoved())
+ {
+ return 0;
+ }
+
default:
break;
}