Skip to content
Snippets Groups Projects
Commit 12fc06da authored by dg's avatar dg
Browse files

Example module now uses display strings and shows a tooltip for Grids

git-svn-id: http://svn.net-core.org/repos/t-engine4@959 51575b47-30f0-44d4-a5cc-537603b46e54
parent 1ef77503
No related branches found
No related tags found
No related merge requests found
...@@ -96,11 +96,12 @@ function _M:move(x, y, force) ...@@ -96,11 +96,12 @@ function _M:move(x, y, force)
end end
function _M:tooltip() function _M:tooltip()
return ([[%s return ([[%s%s
#00ffff#Level: %d #00ffff#Level: %d
#ff0000#HP: %d (%d%%) #ff0000#HP: %d (%d%%)
Stats: %d / %d / %d Stats: %d / %d / %d
%s]]):format( %s]]):format(
self:getDisplayString(),
self.name, self.name,
self.level, self.level,
self.life, self.life * 100 / self.max_life, self.life, self.life * 100 / self.max_life,
......
...@@ -54,15 +54,15 @@ function _M:on_move(x, y, who, forced) ...@@ -54,15 +54,15 @@ function _M:on_move(x, y, who, forced)
end end
end end
end end
function _M:tooltip() function _M:tooltip()
if self.show_tooltip then if self.show_tooltip then
local name = ((self.show_tooltip == true) and self.name or self.show_tooltip) local name = ((self.show_tooltip == true) and self.name or self.show_tooltip)
if self.desc then if self.desc then
return name.."\n"..self.desc return self:getDisplayString()..name.."\n"..self.desc
else else
return name return self:getDisplayString()..name
end end
else
return self:getDisplayString()..self.name
end end
end 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