From 82d55fcc9857dfbe985380d1676d3768b6243aaa Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sun, 16 May 2010 00:56:49 +0000 Subject: [PATCH] PlayerDisplay does not run every frame, betetr performance! git-svn-id: http://svn.net-core.org/repos/t-engine4@621 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engine/HotkeysDisplay.lua | 1 - game/modules/tome/class/Actor.lua | 2 ++ game/modules/tome/class/Game.lua | 1 + game/modules/tome/class/PlayerDisplay.lua | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/game/engine/HotkeysDisplay.lua b/game/engine/HotkeysDisplay.lua index cc36df24c2..20fe8d6d1e 100644 --- a/game/engine/HotkeysDisplay.lua +++ b/game/engine/HotkeysDisplay.lua @@ -48,7 +48,6 @@ local page_to_hotkey = {"", "SECOND_", "THIRD_"} function _M:display() local a = self.actor if not a or not a.changed then return self.surface end - a.changed = false local hks = {} for i = 1, 12 do diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index da987fdf52..2faa9cc679 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -128,6 +128,8 @@ end function _M:act() if not engine.Actor.act(self) then return end + self.changed = true + -- Cooldown talents self:cooldownTalents() -- Regen resources diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 5ea8a76ad1..d0d46b3d0d 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -326,6 +326,7 @@ function _M:display() self.logdisplay:display():toScreen(self.logdisplay.display_x, self.logdisplay.display_y) self.player_display:display():toScreen(self.player_display.display_x, self.player_display.display_y) self.hotkeys_display:display():toScreen(self.hotkeys_display.display_x, self.hotkeys_display.display_y) + if self.player then self.player.changed = false end -- Now the map, if any if self.level and self.level.map and self.level.map.finished then diff --git a/game/modules/tome/class/PlayerDisplay.lua b/game/modules/tome/class/PlayerDisplay.lua index c41965e6b8..8bd157e9b4 100644 --- a/game/modules/tome/class/PlayerDisplay.lua +++ b/game/modules/tome/class/PlayerDisplay.lua @@ -41,6 +41,8 @@ end -- Displays the stats function _M:display() + if not game.player or not game.player.changed then return self.surface end + self.surface:erase(self.bgcolor[1], self.bgcolor[2], self.bgcolor[3]) local cur_exp, max_exp = game.player.exp, game.player:getExpChart(game.player.level+1) -- GitLab