summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-08 03:22:46 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-08 03:22:46 +0000
commit6980d1d1465c11f3afaf2e0c29503990ad3fb906 (patch)
tree76a8b70779735baba9a9f2a4c9c0a54bbec96a36 /crawl-ref
parentcdd74d0b4618ad1f8f02ee18036283c6c2214b3d (diff)
downloadcrawl-ref-6980d1d1465c11f3afaf2e0c29503990ad3fb906.tar.gz
crawl-ref-6980d1d1465c11f3afaf2e0c29503990ad3fb906.zip
Tiles performance improvements. redraw() is not needlessly done three times as often as it should.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7776 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/delay.cc5
-rw-r--r--crawl-ref/source/libgui.cc2
-rw-r--r--crawl-ref/source/tilesdl.cc14
-rw-r--r--crawl-ref/source/tilesdl.h2
4 files changed, 22 insertions, 1 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index bc9c19376b..b12f293868 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1517,6 +1517,11 @@ static command_type _get_running_command()
if (is_resting())
{
you.running.rest();
+
+#ifdef USE_TILE
+ tiles.redraw();
+#endif
+
if (!is_resting() && you.running.hp == you.hp
&& you.running.mp == you.magic_points)
{
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 87839a9c78..e934d5ee64 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -343,7 +343,7 @@ void delay(int ms)
void update_screen()
{
- tiles.redraw();
+ tiles.set_need_redraw();
}
int kbhit()
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index ccc34e7813..1cc27c12a2 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -79,6 +79,7 @@ TilesFramework::TilesFramework() :
m_viewsc(0, 0),
m_context(NULL),
m_fullscreen(false),
+ m_need_redraw(false),
m_active_layer(LAYER_CRT),
m_buttons_held(0),
m_key_mod(0),
@@ -591,6 +592,12 @@ int TilesFramework::getch_ck()
unsigned int res = std::max(30, Options.tile_tooltip_ms);
SDL_SetTimer(res, &_timer_callback);
+ if (m_need_redraw)
+ {
+ redraw();
+ last_redraw_tick = SDL_GetTicks();
+ }
+
while (!key)
{
unsigned int ticks = 0;
@@ -944,6 +951,8 @@ void TilesFramework::cgotoxy(int x, int y, int region)
void TilesFramework::redraw()
{
+ m_need_redraw = false;
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
@@ -1274,3 +1283,8 @@ void TilesFramework::clear_overlays()
{
m_region_tile->clear_overlays();
}
+
+void TilesFramework::set_need_redraw()
+{
+ m_need_redraw = true;
+}
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h
index 735189c95b..258ea5b3a3 100644
--- a/crawl-ref/source/tilesdl.h
+++ b/crawl-ref/source/tilesdl.h
@@ -106,6 +106,7 @@ public:
void clear_minimap();
void update_inventory();
+ void set_need_redraw();
void redraw();
void place_cursor(cursor_type type, const coord_def &gc);
@@ -134,6 +135,7 @@ protected:
SDL_Surface* m_context;
bool m_fullscreen;
+ bool m_need_redraw;
enum LayerID
{