Skip to content
Snippets Groups Projects
Commit eb01ae1c authored by DarkGod's avatar DarkGod
Browse files

plop

parent 4d855db2
No related branches found
No related tags found
No related merge requests found
...@@ -273,7 +273,7 @@ function _M:setList(tree) -- the name is a bit misleading but legacy ...@@ -273,7 +273,7 @@ function _M:setList(tree) -- the name is a bit misleading but legacy
self:setTree(tree) self:setTree(tree)
end end
function _M:drawItem(item) function _M:drawItem(item, smallcaps)
local is_header = item._is_header local is_header = item._is_header
if not item._container then if not item._container then
item.cols = {} item.cols = {}
...@@ -315,7 +315,7 @@ function _M:drawItem(item) ...@@ -315,7 +315,7 @@ function _M:drawItem(item)
if is_header then if is_header then
opts = {frame="ui/heading-sel", frame_sel="ui/heading"} opts = {frame="ui/heading-sel", frame_sel="ui/heading"}
end end
item.cols[i]._entry = Entry.new(opts, text, color, col.width - offset, self.fh, offset, 1, not is_header) item.cols[i]._entry = Entry.new(opts, text, color, col.width - offset, self.fh, offset, 1, not is_header, is_header)
item.cols[i]._entry:translate(x + offset, 0, 0) item.cols[i]._entry:translate(x + offset, 0, 0)
item.cols[i]._entry:select(is_header) item.cols[i]._entry:select(is_header)
local ec = item.cols[i]._entry:get() local ec = item.cols[i]._entry:get()
......
...@@ -24,7 +24,7 @@ local Block = require "engine.ui.blocks.Block" ...@@ -24,7 +24,7 @@ local Block = require "engine.ui.blocks.Block"
-- @classmod engine.ui.blocks.block -- @classmod engine.ui.blocks.block
module(..., package.seeall, class.inherit(Block)) module(..., package.seeall, class.inherit(Block))
function _M:init(t, text, color, w, h, offset, max_lines, default_unseen) function _M:init(t, text, color, w, h, offset, max_lines, default_unseen, smallcaps)
color = color or {255,255,255} color = color or {255,255,255}
self.color = color self.color = color
self.offset = offset self.offset = offset
...@@ -33,6 +33,7 @@ function _M:init(t, text, color, w, h, offset, max_lines, default_unseen) ...@@ -33,6 +33,7 @@ function _M:init(t, text, color, w, h, offset, max_lines, default_unseen)
self.selected = false self.selected = false
self.default_unseen = true self.default_unseen = true
self.smallcaps = smallcaps
t = t or {} t = t or {}
self.t = t self.t = t
...@@ -64,6 +65,7 @@ function _M:generateContainer() ...@@ -64,6 +65,7 @@ function _M:generateContainer()
self.max_text_w = w - self.frame.b4.w - self.frame.b6.w self.max_text_w = w - self.frame.b4.w - self.frame.b6.w
self.up_text_h = (h - self.font_h * self.max_lines) / 2 self.up_text_h = (h - self.font_h * self.max_lines) / 2
self.text = core.renderer.text(self.parent.font):translate(0, 0, 10) self.text = core.renderer.text(self.parent.font):translate(0, 0, 10)
if self.smallcaps then self.text:smallCaps(true):textStyle("bold") end
self.text:maxLines(self.max_lines) self.text:maxLines(self.max_lines)
if self.max_lines > 1 then self.text:maxWidth(self.max_text_w) end if self.max_lines > 1 then self.text:maxWidth(self.max_text_w) end
self.text:textColor(self.color[1] / 255, self.color[2] / 255, self.color[3] / 255, 1) self.text:textColor(self.color[1] / 255, self.color[2] / 255, self.color[3] / 255, 1)
......
...@@ -30,7 +30,7 @@ function _M:init(t, text, color, w, h) ...@@ -30,7 +30,7 @@ function _M:init(t, text, color, w, h)
Block.init(self, t) Block.init(self, t)
self.cursor_t = self.parent:getAtlasTexture("ui/textbox-cursor.png") self.cursor_t = self.parent:getAtlasTexture("ui/textbox-cursor.png")
self.cursor = core.renderer.fromTextureTable(self.cursor_t, 0, 0) self.cursor = core.renderer.fromTextureTable(self.cursor_t, 0, 0):color(0.5, 1, 1, 1)
self.frame = self.parent:makeFrameDO("ui/textbox", nil, nil, w, h) self.frame = self.parent:makeFrameDO("ui/textbox", nil, nil, w, h)
self.frame_sel = self.parent:makeFrameDO("ui/textbox-sel", nil, nil, w, h) self.frame_sel = self.parent:makeFrameDO("ui/textbox-sel", nil, nil, w, h)
......
...@@ -92,7 +92,7 @@ function _M:init(title, equip_actor, filter, action, on_select, inven_actor, for ...@@ -92,7 +92,7 @@ function _M:init(title, equip_actor, filter, action, on_select, inven_actor, for
self.c_inven = Inventory.new{actor=inven_actor, inven=inven_actor:getInven("INVEN") or {}, width=self.iw - vsep.w - self.c_doll.w, height=self.ih - 10, filter=filter, self.c_inven = Inventory.new{actor=inven_actor, inven=inven_actor:getInven("INVEN") or {}, width=self.iw - vsep.w - self.c_doll.w, height=self.ih - 10, filter=filter,
default_last_tabs = "all", default_last_tabs = "all",
fct=function(item, sel, button, event) self:use(item, button, event) end, fct=function(item, sel, button, event) self:use(item, button, event) end,
select=function(item, sel) if self.c_inven and item._pos_y then select=function(item, sel) if self.c_inven and item and item._pos_y then
item.last_display_x = self.c_inven.c_inven.last_display_x + self.c_inven.w item.last_display_x = self.c_inven.c_inven.last_display_x + self.c_inven.w
item.last_display_y = self.c_inven.c_inven.last_display_y + item._pos_y item.last_display_y = self.c_inven.c_inven.last_display_y + item._pos_y
self:select(item) self:select(item)
......
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