diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-29 20:46:47 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-29 20:46:47 +0000 |
commit | 0be12e05b22b62a1800046874933a1532ae0f363 (patch) | |
tree | 611ca526d44784b43e31147b4bef92c27924f671 /crawl-ref/source/tilesdl.cc | |
parent | e8dcf648f9179504dd42aacd2bb640dd79ad3806 (diff) | |
download | crawl-ref-0be12e05b22b62a1800046874933a1532ae0f363.tar.gz crawl-ref-0be12e05b22b62a1800046874933a1532ae0f363.zip |
Tiles performance improvements to eliminate mouse lag on slower systems. It should redraw the screen far less frequently.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9568 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilesdl.cc')
-rw-r--r-- | crawl-ref/source/tilesdl.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 1eebc00ec8..9db08291c6 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -709,6 +709,10 @@ struct cursor_loc && rhs.cy == cy && reg); } + bool operator!=(const cursor_loc &rhs) const + { + return !(*this == rhs); + } Region *reg; int cx, cy; @@ -721,10 +725,11 @@ int TilesFramework::getch_ck() SDL_Event event; cursor_loc cur_loc; cursor_loc tip_loc; + cursor_loc last_loc; int key = 0; - const unsigned int ticks_per_redraw = 16; // 60 FPS = 16.6 ms/frame + const unsigned int ticks_per_redraw = 50; unsigned int last_redraw_tick = 0; unsigned int res = std::max(30, Options.tile_tooltip_ms); @@ -744,6 +749,8 @@ int TilesFramework::getch_ck() { ticks = SDL_GetTicks(); + last_loc = cur_loc; + if (event.type != SDL_USEREVENT) { tiles.clear_text_tags(TAG_CELL_DESC); @@ -871,15 +878,19 @@ int TilesFramework::getch_ck() if (reg->update_tip_text(m_tooltip)) break; } + m_need_redraw = true; } } else { + if (last_loc != cur_loc) + m_need_redraw = true; + m_tooltip.clear(); tip_loc.reset(); } - if (ticks - last_redraw_tick > ticks_per_redraw) + if ((ticks - last_redraw_tick > ticks_per_redraw) && need_redraw()) { redraw(); last_redraw_tick = ticks; |