mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Version 0.9.4.8 - Alpha (see changelog.txt)
This commit is contained in:
parent
a2bc25e520
commit
524be5c2da
@ -1,3 +1,19 @@
|
|||||||
|
================================================
|
||||||
|
Version 0.9.4.8 - Alpha (December 24 - 2012)
|
||||||
|
================================================
|
||||||
|
[ADDED] a new text method: SetShadow(bool)
|
||||||
|
[ADDED] a new text method: GetShadow()
|
||||||
|
[ADDED] a new text method: SetShadowOffsets(offsetx, offsety)
|
||||||
|
[ADDED] a new text method: GetShadowOffsets()
|
||||||
|
[ADDED] a new text method: SetShadowColor(r, g, b, a)
|
||||||
|
[ADDED] a new text method: GetShadowColor()
|
||||||
|
[ADDED] a new columnlist method: SetColumnHeight(height)
|
||||||
|
|
||||||
|
[FIXED] templates not being applied to objects
|
||||||
|
|
||||||
|
[CHANGED] the columnlistarea object now has better sorting
|
||||||
|
[CHANGED] the frame object no longer sets the size of it's close button
|
||||||
|
|
||||||
================================================
|
================================================
|
||||||
Version 0.9.4.7 - Alpha (December 19 - 2012)
|
Version 0.9.4.7 - Alpha (December 19 - 2012)
|
||||||
================================================
|
================================================
|
||||||
|
4
init.lua
4
init.lua
@ -9,7 +9,7 @@ loveframes = {}
|
|||||||
-- library info
|
-- library info
|
||||||
loveframes.info = {}
|
loveframes.info = {}
|
||||||
loveframes.info.author = "Kenny Shields"
|
loveframes.info.author = "Kenny Shields"
|
||||||
loveframes.info.version = "0.9.4.7"
|
loveframes.info.version = "0.9.4.8"
|
||||||
loveframes.info.stage = "Alpha"
|
loveframes.info.stage = "Alpha"
|
||||||
|
|
||||||
-- library configurations
|
-- library configurations
|
||||||
@ -187,7 +187,7 @@ function loveframes.Create(data, parent)
|
|||||||
local newobject = object:new()
|
local newobject = object:new()
|
||||||
|
|
||||||
-- apply template properties to the object
|
-- apply template properties to the object
|
||||||
loveframes.templates.ApplyToObject(object)
|
loveframes.templates.ApplyToObject(newobject)
|
||||||
|
|
||||||
-- if the object is a tooltip, return it and go no further
|
-- if the object is a tooltip, return it and go no further
|
||||||
if data == "tooltip" then
|
if data == "tooltip" then
|
||||||
|
@ -15,6 +15,7 @@ function newobject:initialize()
|
|||||||
self.type = "columnlist"
|
self.type = "columnlist"
|
||||||
self.width = 300
|
self.width = 300
|
||||||
self.height = 100
|
self.height = 100
|
||||||
|
self.columnheight = 16
|
||||||
self.buttonscrollamount = 0.10
|
self.buttonscrollamount = 0.10
|
||||||
self.mousewheelscrollamount = 5
|
self.mousewheelscrollamount = 5
|
||||||
self.autoscroll = false
|
self.autoscroll = false
|
||||||
@ -214,12 +215,13 @@ function newobject:AddColumn(name)
|
|||||||
|
|
||||||
local internals = self.internals
|
local internals = self.internals
|
||||||
local list = internals[1]
|
local list = internals[1]
|
||||||
|
local width = self.width
|
||||||
local height = self.height
|
local height = self.height
|
||||||
|
|
||||||
loveframes.objects["columnlistheader"]:new(name, self)
|
loveframes.objects["columnlistheader"]:new(name, self)
|
||||||
self:AdjustColumns()
|
self:AdjustColumns()
|
||||||
|
|
||||||
list:SetSize(self.width, height)
|
list:SetSize(width, height)
|
||||||
list:SetPos(0, 0)
|
list:SetPos(0, 0)
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -397,4 +399,25 @@ function newobject:GetButtonScrollAmount()
|
|||||||
|
|
||||||
return self.mousewheelscrollamount
|
return self.mousewheelscrollamount
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: SetColumnHeight(height)
|
||||||
|
- desc: sets the height of the object's columns
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:SetColumnHeight(height)
|
||||||
|
|
||||||
|
local children = self.children
|
||||||
|
local internals = self.internals
|
||||||
|
local list = internals[1]
|
||||||
|
|
||||||
|
self.columnheight = height
|
||||||
|
|
||||||
|
for k, v in ipairs(children) do
|
||||||
|
v:SetHeight(height)
|
||||||
|
end
|
||||||
|
|
||||||
|
list:CalculateSize()
|
||||||
|
list:RedoLayout()
|
||||||
|
|
||||||
end
|
end
|
@ -33,7 +33,6 @@ function newobject:initialize()
|
|||||||
-- create the close button for the frame
|
-- create the close button for the frame
|
||||||
local close = loveframes.objects["closebutton"]:new()
|
local close = loveframes.objects["closebutton"]:new()
|
||||||
close.parent = self
|
close.parent = self
|
||||||
close:SetSize(16, 16)
|
|
||||||
close.OnClick = function()
|
close.OnClick = function()
|
||||||
local onclose = self.OnClose
|
local onclose = self.OnClose
|
||||||
self:Remove()
|
self:Remove()
|
||||||
|
@ -13,8 +13,8 @@ local newobject = loveframes.NewObject("closebutton", "loveframes_object_closebu
|
|||||||
function newobject:initialize()
|
function newobject:initialize()
|
||||||
|
|
||||||
self.type = "closebutton"
|
self.type = "closebutton"
|
||||||
self.width = 80
|
self.width = 16
|
||||||
self.height = 25
|
self.height = 16
|
||||||
self.internal = true
|
self.internal = true
|
||||||
self.hover = false
|
self.hover = false
|
||||||
self.down = false
|
self.down = false
|
||||||
|
@ -208,14 +208,14 @@ end
|
|||||||
--]]---------------------------------------------------------
|
--]]---------------------------------------------------------
|
||||||
function newobject:CalculateSize()
|
function newobject:CalculateSize()
|
||||||
|
|
||||||
local iw, ih = self.parent:GetColumnSize()
|
local columnheight = self.parent.columnheight
|
||||||
local numitems = #self.children
|
local numitems = #self.children
|
||||||
local height = self.height
|
local height = self.height
|
||||||
local width = self.width
|
local width = self.width
|
||||||
local itemheight = ih
|
local itemheight = columnheight
|
||||||
local itemwidth = 0
|
local itemwidth = 0
|
||||||
local bar = self.bar
|
local bar = self.bar
|
||||||
local children = self.children
|
local children = self.children
|
||||||
|
|
||||||
for k, v in ipairs(children) do
|
for k, v in ipairs(children) do
|
||||||
itemheight = itemheight + v.height
|
itemheight = itemheight + v.height
|
||||||
@ -340,9 +340,9 @@ function newobject:Sort(column, desc)
|
|||||||
|
|
||||||
table.sort(children, function(a, b)
|
table.sort(children, function(a, b)
|
||||||
if desc then
|
if desc then
|
||||||
return a.columndata[column] < b.columndata[column]
|
return (tonumber(a.columndata[column]) or a.columndata[column]) < (tonumber(b.columndata[column]) or b.columndata[column])
|
||||||
else
|
else
|
||||||
return a.columndata[column] > b.columndata[column]
|
return (tonumber(a.columndata[column]) or a.columndata[column]) > (tonumber(b.columndata[column]) or b.columndata[column])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ function newobject:initialize(name, parent)
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.name = name
|
self.name = name
|
||||||
self.width = 80
|
self.width = 80
|
||||||
self.height = 16
|
self.height = self.parent.columnheight
|
||||||
self.hover = false
|
self.hover = false
|
||||||
self.down = false
|
self.down = false
|
||||||
self.clickable = true
|
self.clickable = true
|
||||||
|
@ -24,9 +24,13 @@ function newobject:initialize()
|
|||||||
self.height = 5
|
self.height = 5
|
||||||
self.maxw = 0
|
self.maxw = 0
|
||||||
self.lines = 1
|
self.lines = 1
|
||||||
|
self.shadowxoffset = 1
|
||||||
|
self.shadowyoffset = 1
|
||||||
self.formattedtext = {}
|
self.formattedtext = {}
|
||||||
self.original = {}
|
self.original = {}
|
||||||
|
self.shadowcolor = {}
|
||||||
self.ignorenewlines = false
|
self.ignorenewlines = false
|
||||||
|
self.shadow = false
|
||||||
self.internal = false
|
self.internal = false
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -338,6 +342,10 @@ function newobject:DrawText()
|
|||||||
local theight = font:getHeight("a")
|
local theight = font:getHeight("a")
|
||||||
local x = self.x
|
local x = self.x
|
||||||
local y = self.y
|
local y = self.y
|
||||||
|
local shadow = self.shadow
|
||||||
|
local shadowxoffset = self.shadowxoffset
|
||||||
|
local shadowyoffset = self.shadowyoffset
|
||||||
|
local shadowcolor = self.shadowcolor
|
||||||
|
|
||||||
for k, v in ipairs(textdata) do
|
for k, v in ipairs(textdata) do
|
||||||
|
|
||||||
@ -347,13 +355,21 @@ function newobject:DrawText()
|
|||||||
if self.parent.type == "list" then
|
if self.parent.type == "list" then
|
||||||
if (y + v.y) <= (self.parent.y + self.parent.height) and self.y + ((v.y + theight)) >= self.parent.y then
|
if (y + v.y) <= (self.parent.y + self.parent.height) and self.y + ((v.y + theight)) >= self.parent.y then
|
||||||
love.graphics.setFont(font)
|
love.graphics.setFont(font)
|
||||||
|
if shadow then
|
||||||
|
love.graphics.setColor(unpack(shadowcolor))
|
||||||
|
love.graphics.print(text, x + v.x + shadowxoffset, y + v.y + shadowyoffset)
|
||||||
|
end
|
||||||
love.graphics.setColor(unpack(color))
|
love.graphics.setColor(unpack(color))
|
||||||
love.graphics.printf(text, x + v.x, y + v.y, 0, "left")
|
love.graphics.print(text, x + v.x, y + v.y)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
love.graphics.setFont(font)
|
love.graphics.setFont(font)
|
||||||
|
if shadow then
|
||||||
|
love.graphics.setColor(unpack(shadowcolor))
|
||||||
|
love.graphics.print(text, x + v.x + shadowxoffset, y + v.y + shadowyoffset)
|
||||||
|
end
|
||||||
love.graphics.setColor(unpack(color))
|
love.graphics.setColor(unpack(color))
|
||||||
love.graphics.printf(text, x + v.x, y + v.y, 0, "left")
|
love.graphics.print(text, x + v.x, y + v.y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -465,4 +481,67 @@ function newobject:GetIgnoreNewlines()
|
|||||||
|
|
||||||
return self.ignorenewlines
|
return self.ignorenewlines
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: SetShadow(bool)
|
||||||
|
- desc: sets whether or not the object should draw a
|
||||||
|
shadow behind it's text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:SetShadow(bool)
|
||||||
|
|
||||||
|
self.shadow = bool
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetShadow()
|
||||||
|
- desc: gets whether or not the object should draw a
|
||||||
|
shadow behind it's text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:GetShadow()
|
||||||
|
|
||||||
|
return self.shadow
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: SetShadowOffsets(offsetx, offsety)
|
||||||
|
- desc: sets the object's x and y shadow offsets
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:SetShadowOffsets(offsetx, offsety)
|
||||||
|
|
||||||
|
self.shadowxoffset = offsetx
|
||||||
|
self.shadowyoffset = offsety
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetShadowOffsets()
|
||||||
|
- desc: gets the object's x and y shadow offsets
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:GetShadowOffsets()
|
||||||
|
|
||||||
|
return self.shadowxoffset, self.shadowyoffset
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: SetShadowColor(r, g, b, a)
|
||||||
|
- desc: sets the object's shadow color
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:SetShadowColor(r, g, b, a)
|
||||||
|
|
||||||
|
self.shadowcolor = {r, g, b, a}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetShadowColor()
|
||||||
|
- desc: gets the object's shadow color
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:GetShadowColor()
|
||||||
|
|
||||||
|
return self.shadowcolor
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user