Skip to content
Snippets Groups Projects
Commit 2e35ba90 authored by dg's avatar dg
Browse files

Test new tooltip fixed position

git-svn-id: http://svn.net-core.org/repos/t-engine4@998 51575b47-30f0-44d4-a5cc-537603b46e54
parent 769ca779
No related branches found
No related tags found
No related merge requests found
......@@ -134,6 +134,8 @@ function _M:displayAtMap(tmx, tmy, mx, my)
my = my - self.h
if mx < 0 then mx = 0 end
if my < 0 then my = 0 end
if mx > game.w - self.w then mx = game.w - self.w end
if my > game.h - self.h then my = game.h - self.h end
self.surface:toScreenWithTexture(self.texture, mx, my)
end
end
......@@ -41,11 +41,14 @@ function _M:targetOnTick()
end
--- Display the tooltip, if any
function _M:targetDisplayTooltip()
function _M:targetDisplayTooltip(dx, dy)
-- Tooltip is displayed over all else
if self.level and self.level.map and self.level.map.finished then
-- Display a tooltip if available
if self.tooltip_x then self.tooltip:displayAtMap(self.level.map:getMouseTile(self.tooltip_x , self.tooltip_y)) end
if self.tooltip_x then
local tmx, tmy = self.level.map:getMouseTile(self.tooltip_x , self.tooltip_y)
self.tooltip:displayAtMap(tmx, tmy, dx, dy)
end
-- Move target around
if self.old_tmx ~= tmx or self.old_tmy ~= tmy then
......
......@@ -450,7 +450,7 @@ function _M:display()
if self.player then self.player.changed = false end
-- Tooltip is displayed over all else
self:targetDisplayTooltip()
self:targetDisplayTooltip(game.w, game.h)
engine.GameTurnBased.display(self)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment