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

more

git-svn-id: http://svn.net-core.org/repos/t-engine4@2836 51575b47-30f0-44d4-a5cc-537603b46e54
parent b7b15bb6
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,7 @@ function _M:yesnoLongPopup(title, text, w, fct, yes_text, no_text, no_leave)
return d
end
title_shadow = true
function _M:init(title, w, h, x, y, alpha, font, showup)
self.title = assert(title, "no dialog title")
......@@ -127,6 +128,7 @@ function _M:init(title, w, h, x, y, alpha, font, showup)
else
self.__showup = 2
end
self.color = self.color or {r=255, g=255, b=255}
self.frame = self.frame or {
b7 = "ui/dialogueV3_7.png",
......@@ -199,10 +201,14 @@ function _M:generate()
self.overs[#self.overs+1] = ov
end
--[[
local tw, th = self.font_bold:size(self.title)
s:drawColorStringBlended(self.font_bold, self.title, (self.w - tw) / 2, 4, 255,255,255)
]]
local s = core.display.newSurface(tw, th)
s:erase(0, 0, 0, 0)
s:drawColorStringBlended(self.font_bold, self.title, 0, 0, self.color.r, self.color.g, self.color.b, true)
self.title_tex = {s:glTexture()}
self.title_tex.w = tw
self.title_tex.h = th
if self.absolute then
self.mouse:registerZone(0, 0, gamew, gameh, function(button, x, y, xrel, yrel, bx, by, event) self:mouseEvent(button, x, y, xrel, yrel, bx - self.display_x, by - self.display_y, event) end)
else
......@@ -428,6 +434,7 @@ function _M:toScreen(x, y, nb_keyframes)
end
end
-- We translate and scale opengl matrix to make the popup effect easily
local ox, oy = x, y
local hw, hh = math.floor(self.w / 2), math.floor(self.h / 2)
local tx, ty = x + hw, y + hh
......@@ -435,13 +442,21 @@ function _M:toScreen(x, y, nb_keyframes)
core.display.glTranslate(tx, ty, 0)
if zoom < 1 then core.display.glScale(zoom, zoom, zoom) end
-- Draw the frame and shadow
if self.frame.shadow then self:drawFrame(x + self.frame.shadow.x, y + self.frame.shadow.y, 0, 0, 0, self.frame.shadow.a) end
self:drawFrame(x, y, 1, 1, 1, self.frame.a)
-- Title
if self.title_shadow then self.title_tex[1]:toScreenFull(x + (self.w - self.title_tex.w) / 2 + 3, y + 3, 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, y, self.title_tex.w, self.title_tex.h, self.title_tex[2], self.title_tex[3])
-- UI elements
for i = 1, #self.uis do
local ui = self.uis[i]
ui.ui:display(x + ui.x, y + ui.y, nb_keyframes, ox + ui.x, oy + ui.y)
end
-- Restiore normal opengl matrix
if zoom < 1 then core.display.glScale() end
core.display.glTranslate(-tx, -ty, 0)
end
......@@ -87,7 +87,7 @@ function _M:createItem(item, text)
local r, g, b = 255, 255, 255
local s = core.display.newSurface(self.fw, self.fh)
for i, l in ipairs(list) do
s:erase()
s:erase(0, 0, 0, 0)
r, g, b = s:drawColorStringBlended(self.font, l, 0, 0, r, g, b, true)
if self.no_color_bleed then r, g, b = 255, 255, 255 end
......
......@@ -61,7 +61,7 @@ Mouse: #00FF00#Left click#FFFFFF# to learn; #00FF00#right click#FFFFFF# to unlea
self:loadUI{
{left=0, top=0, ui=self.c_points},
{left=5, top=self.c_points.h+5, ui=Separator.new{dir="vertical", size=math.floor(self.iw / 2) - 10}},
{left=0, top=self.c_points.h+15, ui=self.c_tree},
{left=0, top=self.c_points.h+20, ui=self.c_tree},
{hcenter=0, top=5, ui=Separator.new{dir="horizontal", size=self.ih - 10}},
......
......@@ -29,6 +29,9 @@ function _M:init(l, w, force_height)
local text = util.getval(l.lore).."\n"
local list = text:splitLines(w - 10, self.font)
self.title_shadow = false
self.color = {r=0x3a, g=0x35, b=0x33}
self.frame = {
shadow = {x = 10, y = 10, a = 0.5},
ox1 = -16, ox2 = 16,
......
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