Skip to content
Snippets Groups Projects
Commit 2bde81ec authored by Alex Ksandra's avatar Alex Ksandra
Browse files

Easy changes MKII.

parent 36c2a341
No related branches found
No related tags found
No related merge requests found
......@@ -46,14 +46,8 @@ function _M:generate()
self:generateEquipDollFrames()
self.font_bold:setStyle("bold")
local tw, th = self.font_bold:size(self.actor.name)
local s = core.display.newSurface(tw, th)
s:erase(0, 0, 0, 0)
s:drawColorStringBlended(self.font_bold, self.actor.name, 0, 0, colors.GOLD.r, colors.GOLD.g, colors.GOLD.b, true)
self.charname_tex = self:drawFontLine(self.font_bold, self.actor.name)
self.font_bold:setStyle("normal")
self.charname_tex = {s:glTexture()}
self.charname_tex.w = tw
self.charname_tex.h = th
self.inner_scroll = self:makeFrame("ui/tooltip/", self.w, self.h)
......@@ -183,8 +177,8 @@ function _M:display(x, y, nb_keyframes, ox, oy)
Base.drawFrame(self, self.inner_scroll, x, y + self.base_doll_y, 1, 1, 1, self.focused and 1 or 0.5)
if self.title_shadow then self.charname_tex[1]:toScreenFull(x + (self.w - self.charname_tex.w) / 2 + 2, y + self.base_doll_y + 5 + 2, self.charname_tex.w, self.charname_tex.h, self.charname_tex[2], self.charname_tex[3], 0, 0, 0, 0.5) end
self.charname_tex[1]:toScreenFull(x + (self.w - self.charname_tex.w) / 2, y + self.base_doll_y + 5, self.charname_tex.w, self.charname_tex.h, self.charname_tex[2], self.charname_tex[3])
if self.title_shadow then self:textureToScreen(self.charname_tex, x + (self.w - self.charname_tex.w) / 2 + 2, y + self.base_doll_y + 5 + 2, 0, 0, 0, 0.5) end
self:textureToScreen(self.charname_tex, x + (self.w - self.charname_tex.w) / 2, y + self.base_doll_y + 5)
local doll = self.actor.equipdolls[self.actor.equipdoll or "default"]
if not doll then return end
......
......@@ -145,14 +145,8 @@ function _M:updateTitle(title)
local title = title
if type(title)=="function" then title = title() end
self.font_bold:setStyle("bold")
local tw, th = self.font_bold:size(title)
local s = core.display.newSurface(tw, th)
s:erase(0, 0, 0, 0)
s:drawColorStringBlended(self.font_bold, title, 0, 0, self.color.r, self.color.g, self.color.b, true)
self.title_tex = self:drawFontLine(self.font_bold, title)
self.font_bold:setStyle("normal")
self.title_tex = {s:glTexture()}
self.title_tex.w = tw
self.title_tex.h = th
end
function _M:loadUI(t)
......@@ -414,8 +408,8 @@ function _M:display(x, y, nb_keyframes)
-- Title
if self.title then
if self.title_shadow then self.title_tex[1]:toScreenFull(x + (self.w - self.title_tex.w) / 2 + 3 + self.frame.title_x, y + 3 + self.frame.title_y, self.title_tex.w, self.title_tex.h, self.title_tex[2], self.title_tex[3], 0, 0, 0, 0.5) end
self.title_tex[1]:toScreenFull(x + (self.w - self.title_tex.w) / 2 + self.frame.title_x, y + self.frame.title_y, self.title_tex.w, self.title_tex.h, self.title_tex[2], self.title_tex[3])
if self.title_shadow then self:textureToScreen(self.title_tex, x + 3 + (self.w - self.title_tex.w) / 2 + self.frame.title_x, y + 3 + self.frame.title_y, 0, 0, 0, 0.5) end
self:textureToScreen(self.title_tex, x + (self.w - self.title_tex.w) / 2 + self.frame.title_x, y + self.frame.title_y)
end
self:innerDisplayBack(x, y, nb_keyframes, tx, ty)
......
......@@ -44,12 +44,8 @@ function _M:generate()
self.key:reset()
-- Draw UI
self.title_w, self.title_h = self.font:size(self.title)
self.w, self.h = self.title_w - frame_ox1 + frame_ox2, self.title_h - frame_oy1 + frame_oy2
local s = core.display.newSurface(self.title_w, self.title_h)
s:drawColorStringBlended(self.font, self.title, 0, 0, 255, 255, 255, true)
self.tex = {s:glTexture()}
self.tex = self:drawFontLine(self.font, self.title)
self.w, self.h = self.tex.w - frame_ox1 + frame_ox2, self.tex.h - frame_oy1 + frame_oy2
-- Add UI controls
self.mouse:registerZone(0, 0, self.w+1, self.h+6, function(button, x, y, xrel, yrel, bx, by, event)
......@@ -58,7 +54,7 @@ function _M:generate()
end
end)
self.rw, self.rh = self.title_w, self.title_h
self.rw, self.rh = self.tex.w, self.tex.h
self.frame = self:makeFrame("ui/button", self.w, self.h)
-- self.frame.b2 = self:getUITexture("ui/border_hor_middle.png")
......@@ -76,6 +72,7 @@ function _M:generate()
self.h = self.h + 6
end
--[[
function _M:drawFrame(f, x, y, r, g, b, a)
-- Sides
f.b8.t:toScreenFull(x + f.b7.w, y, f.w - f.b7.w - f.b9.w + 1, f.b8.h, f.b8.tw, f.b8.th, r, g, b, a)
......@@ -89,7 +86,7 @@ function _M:drawFrame(f, x, y, r, g, b, a)
-- Corners
f.b7.t:toScreenFull(x, y, f.b7.w, f.b7.h, f.b7.tw, f.b7.th, r, g, b, a)
f.b9.t:toScreenFull(x + f.w - f.b9.w, y, f.b9.w, f.b9.h, f.b9.tw, f.b9.th, r, g, b, a)
end
end]]
function _M:select()
self.selected = true
......@@ -111,6 +108,6 @@ function _M:display(x, y, nb_keyframes)
else
self:drawFrame(self.frame_sel, x, y, 1, 0.5, 0.5, 1)
end
if self.text_shadow then self.tex[1]:toScreenFull(x+1-frame_ox1, y+1-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3], 0, 0, 0, self.text_shadow) end
self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3])
if self.text_shadow then self:textureToScreen(self.tex, x-frame_ox1, y-frame_oy1, 0, 0, 0, self.text_shadow) end
self:textureToScreen(self.tex, x-frame_ox1, y-frame_oy1)
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