Version 0.9.4.8 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-12-24 21:34:39 -05:00
parent a2bc25e520
commit 524be5c2da
8 changed files with 136 additions and 19 deletions

View File

@ -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)
================================================

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info
loveframes.info = {}
loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.7"
loveframes.info.version = "0.9.4.8"
loveframes.info.stage = "Alpha"
-- library configurations
@ -187,7 +187,7 @@ function loveframes.Create(data, parent)
local newobject = object:new()
-- 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 data == "tooltip" then

View File

@ -15,6 +15,7 @@ function newobject:initialize()
self.type = "columnlist"
self.width = 300
self.height = 100
self.columnheight = 16
self.buttonscrollamount = 0.10
self.mousewheelscrollamount = 5
self.autoscroll = false
@ -214,12 +215,13 @@ function newobject:AddColumn(name)
local internals = self.internals
local list = internals[1]
local width = self.width
local height = self.height
loveframes.objects["columnlistheader"]:new(name, self)
self:AdjustColumns()
list:SetSize(self.width, height)
list:SetSize(width, height)
list:SetPos(0, 0)
end
@ -398,3 +400,24 @@ function newobject:GetButtonScrollAmount()
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

View File

@ -33,7 +33,6 @@ function newobject:initialize()
-- create the close button for the frame
local close = loveframes.objects["closebutton"]:new()
close.parent = self
close:SetSize(16, 16)
close.OnClick = function()
local onclose = self.OnClose
self:Remove()

View File

@ -13,8 +13,8 @@ local newobject = loveframes.NewObject("closebutton", "loveframes_object_closebu
function newobject:initialize()
self.type = "closebutton"
self.width = 80
self.height = 25
self.width = 16
self.height = 16
self.internal = true
self.hover = false
self.down = false

View File

@ -208,11 +208,11 @@ end
--]]---------------------------------------------------------
function newobject:CalculateSize()
local iw, ih = self.parent:GetColumnSize()
local columnheight = self.parent.columnheight
local numitems = #self.children
local height = self.height
local width = self.width
local itemheight = ih
local itemheight = columnheight
local itemwidth = 0
local bar = self.bar
local children = self.children
@ -340,9 +340,9 @@ function newobject:Sort(column, desc)
table.sort(children, function(a, b)
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
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)

View File

@ -16,7 +16,7 @@ function newobject:initialize(name, parent)
self.parent = parent
self.name = name
self.width = 80
self.height = 16
self.height = self.parent.columnheight
self.hover = false
self.down = false
self.clickable = true

View File

@ -24,9 +24,13 @@ function newobject:initialize()
self.height = 5
self.maxw = 0
self.lines = 1
self.shadowxoffset = 1
self.shadowyoffset = 1
self.formattedtext = {}
self.original = {}
self.shadowcolor = {}
self.ignorenewlines = false
self.shadow = false
self.internal = false
end
@ -338,6 +342,10 @@ function newobject:DrawText()
local theight = font:getHeight("a")
local x = self.x
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
@ -347,13 +355,21 @@ function newobject:DrawText()
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
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.printf(text, x + v.x, y + v.y, 0, "left")
love.graphics.print(text, x + v.x, y + v.y)
end
else
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.printf(text, x + v.x, y + v.y, 0, "left")
love.graphics.print(text, x + v.x, y + v.y)
end
end
@ -466,3 +482,66 @@ function newobject:GetIgnoreNewlines()
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