Skip to content
Snippets Groups Projects
Commit 58c00659 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@3659 51575b47-30f0-44d4-a5cc-537603b46e54
parent 4a7e3f81
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ function _M:init(actor, x, y, w, h, bgcolor, fontname, fontsize)
self.font = core.display.newFont(fontname or "/data/font/VeraMono.ttf", fontsize or 10)
self.font_h = self.font:lineSkip()
self:resize(x, y, w, h)
self.nb_cols = 1
end
--- Resize the display area
......@@ -56,7 +57,12 @@ function _M:resize(x, y, w, h)
end
end
-- Displays the hotkeys, keybinds & cooldowns
--- Sets the display into nb columns
function _M:setColumns(nb)
self.nb_cols = nb
end
--- Displays the hotkeys, keybinds & cooldowns
function _M:display()
local a = self.actor
if not a or not a.changed then return self.surface end
......@@ -84,8 +90,11 @@ function _M:display()
for _, a in pairs(list) do l[#l+1] = a end
table.sort(l, function(a, b) return a.name < b.name end)
local x, y = 0, 0
for i, a in ipairs(l) do
self.surface:drawColorStringBlended(self.font, ("%s (%d)#WHITE#; distance [%s]"):format(a.name, a.nb, table.concat(a.dist, ",")), 3, 3 + (i - 1) * self.font_h, a.color[1], a.color[2], a.color[3])
self.surface:drawColorStringBlended(self.font, ("%s (%d)#WHITE#; distance [%s]"):format(a.name, a.nb, table.concat(a.dist, ",")), x, y, a.color[1], a.color[2], a.color[3])
y = y + self.font_h
if y + self.font_h >= self.h then y = 0 x = x + math.floor(self.w / self.nb_cols) end
end
self.surface:updateTexture(self.texture)
......
......@@ -36,6 +36,12 @@ function _M:init(actor, x, y, w, h, bgcolor, fontname, fontsize)
self.cache = {}
setmetatable(self.cache, {__mode="v"})
self:resize(x, y, w, h)
self.nb_cols = 1
end
--- Sets the display into nb columns
function _M:setColumns(nb)
self.nb_cols = nb
end
function _M:enableShadow(v)
......@@ -128,7 +134,7 @@ function _M:display()
w, h = gen.fw, gen.fh
else
w, h = self.font:size(txt)
gen = self.font:draw(txt, self.w / 3, color[1], color[2], color[3], true)[1]
gen = self.font:draw(txt, self.w / self.nb_cols, color[1], color[2], color[3], true)[1]
gen.fw, gen.fh = w, h
end
gen.x, gen.y = x, y
......@@ -137,7 +143,7 @@ function _M:display()
self.clics[i] = {x,y,w+4,h+4}
if y + self.font_h * 2 > self.h then
x = x + self.w / 3
x = x + self.w / self.nb_cols
y = 0
else
y = y + self.font_h
......
......@@ -106,17 +106,19 @@ function _M:run()
-- self.flash = LogFlasher.new(0, 0, self.w, 20, nil, font, size, {255,255,255}, {0,0,0})
self.map_h_stop = self.h - font_mono_h * 4
self.logdisplay = LogDisplay.new(216, self.map_h_stop - font_h * 5 -16, (self.w - 216) / 2, font_h * 5, nil, font, size, nil, nil)
self.logdisplay:enableShadow(0.6)
self.logdisplay:enableShadow(1)
self.logdisplay:enableFading(2)
profile.chat:resize(216 + (self.w - 216) / 2, self.map_h_stop - font_h * 5 -16, (self.w - 216) / 2, font_h * 5, font, size, nil, nil)
profile.chat:enableShadow(0.6)
profile.chat:enableShadow(1)
profile.chat:enableFading(6)
profile.chat:enableDisplayChans(false)
self.hotkeys_display = HotkeysDisplay.new(nil, 216, self.h - font_mono_h * 4, self.w - 216, font_mono_h * 4, "/data/gfx/ui/talents-list.png", font_mono, size_mono)
self.hotkeys_display:enableShadow(0.6)
self.npcs_display = ActorsSeenDisplay.new(nil, self.w * 0.5 + 46, self.h * 0.8 + 7, self.w * 0.5 - 46, self.h * 0.2 - 7, "/data/gfx/ui/talents-list.png", font_mono, size_mono)
self.hotkeys_display:setColumns(3)
self.npcs_display = ActorsSeenDisplay.new(nil, 216, self.h - font_mono_h * 4, self.w - 216, font_mono_h * 4, "/data/gfx/ui/talents-list.png", font_mono, size_mono)
self.npcs_display:setColumns(3)
self.tooltip = Tooltip.new(font_mono, size, {255,255,255}, {30,30,30,230})
self.tooltip2 = Tooltip.new(font_mono, size, {255,255,255}, {30,30,30,230})
self.flyers = FlyingText.new("/data/font/INSULA__.ttf", flysize, "/data/font/INSULA__.ttf", flysize + 3)
......
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