From 9f3f6683d929d118b18e21b06a0b729586569e1a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Apr 2011 20:07:07 +0000 Subject: Change the background color when hovering over widgets. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2320 --- textscreen/txt_sdl.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'textscreen/txt_sdl.c') 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; } -- cgit v1.2.3