diff options
author | Enne Walker <ennewalker@users.sourceforge.net> | 2010-02-28 14:32:58 -0500 |
---|---|---|
committer | Enne Walker <ennewalker@users.sourceforge.net> | 2010-02-28 15:16:25 -0500 |
commit | 1d2570ce72b8cfd04b97a65f23cf6da4efbbe83c (patch) | |
tree | 17861b81e9929d8936f0a5738520eb48f0c5205d /crawl-ref/source/tilesdl.h | |
parent | 8eaa93a4a09888e88b5d4bd5abdef34dc947b75a (diff) | |
download | crawl-ref-1d2570ce72b8cfd04b97a65f23cf6da4efbbe83c.tar.gz crawl-ref-1d2570ce72b8cfd04b97a65f23cf6da4efbbe83c.zip |
Fix targeting mode performance issues in tiles.
Because targeting mode actually returns input (CK_MOUSE_MOVE), the input
loop always exited (and then redrew the screen) after even the slightest
mouse movement. This cause all sorts of lag when moving the mouse around
to target. Now, if we get multiple mouse movements, they will all be
handled silently before redrawing the screen. Additionally, input is
only returned when the mouse cursor moves to a semantically different
location.
Diffstat (limited to 'crawl-ref/source/tilesdl.h')
-rw-r--r-- | crawl-ref/source/tilesdl.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h index 232ee09c84..6a414f561c 100644 --- a/crawl-ref/source/tilesdl.h +++ b/crawl-ref/source/tilesdl.h @@ -189,6 +189,29 @@ protected: int m_screen_width; int m_screen_height; + + struct cursor_loc + { + cursor_loc() { reset(); } + void reset() { reg = NULL; cx = cy = -1; mode = MOUSE_MODE_MAX; } + bool operator==(const cursor_loc &rhs) const + { + return (rhs.reg == reg + && rhs.cx == cx + && rhs.cy == cy + && reg + && rhs.mode == mode); + } + bool operator!=(const cursor_loc &rhs) const + { + return !(*this == rhs); + } + + Region *reg; + int cx, cy; + mouse_mode mode; + }; + cursor_loc m_cur_loc; }; // Main interface for tiles functions |