Version 0.9.4.13 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2013-01-04 11:56:04 -05:00
parent 069ed45963
commit 6c05801552
12 changed files with 74 additions and 53 deletions

View File

@ -1,3 +1,13 @@
================================================
Version 0.9.4.13 - Alpha (January 4 - 2013)
================================================
[ADDED] a new base method: IsInList()
[FIXED] not being able to add the boolean "false" to a template as a property with loveframes.templates.AddProperty(templatename, object, property, value)
[CHANGED] small code cleanup
[CHANGED] improved performance of the text object while parented within a list object
================================================
Version 0.9.4.12 - Alpha (December 30 - 2012)
================================================

View File

@ -7,27 +7,27 @@
loveframes = {}
-- library info
loveframes.info = {}
loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.12"
loveframes.info.stage = "Alpha"
loveframes.info = {}
loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.13"
loveframes.info.stage = "Alpha"
-- library configurations
loveframes.config = {}
loveframes.config["DIRECTORY"] = ""
loveframes.config["DEFAULTSKIN"] = "Blue"
loveframes.config["ACTIVESKIN"] = "Blue"
loveframes.config = {}
loveframes.config["DIRECTORY"] = ""
loveframes.config["DEFAULTSKIN"] = "Blue"
loveframes.config["ACTIVESKIN"] = "Blue"
loveframes.config["INDEXSKINIMAGES"] = true
loveframes.config["DEBUG"] = false
loveframes.config["DEBUG"] = false
-- misc library vars
loveframes.drawcount = 0
loveframes.hoverobject = false
loveframes.modalobject = false
loveframes.inputobject = false
loveframes.basicfont = love.graphics.newFont(12)
loveframes.basicfontsmall = love.graphics.newFont(10)
loveframes.objects = {}
loveframes.drawcount = 0
loveframes.hoverobject = false
loveframes.modalobject = false
loveframes.inputobject = false
loveframes.basicfont = love.graphics.newFont(12)
loveframes.basicfontsmall = love.graphics.newFont(10)
loveframes.objects = {}
--[[---------------------------------------------------------
- func: load()

View File

@ -523,8 +523,6 @@ function newobject:Remove()
end
end
self.removed = true
end
--[[---------------------------------------------------------
@ -1048,3 +1046,21 @@ function newobject:GetProperty(name)
return self[name]
end
--[[---------------------------------------------------------
- func: IsInList()
- desc: checks to see if an object is in a list
--]]---------------------------------------------------------
function newobject:IsInList()
local parents = self:GetParents()
for k, v in ipairs(parents) do
if v.type == "list" then
return true, v
end
end
return false, false
end

View File

@ -123,15 +123,12 @@ function newobject:mousereleased(x, y, button)
end
if self.hover and button == "l" then
local parent1 = self:GetParent()
local parent2 = parent1:GetParent()
local onrowclicked = parent2.OnRowClicked
if onrowclicked then
onrowclicked(parent2, self, self.columndata)
end
end
end

View File

@ -28,19 +28,23 @@ function newobject:initialize(name, parent)
local key = 0
for k, v in ipairs(self.parent.children) do
for k, v in ipairs(parent.children) do
if v == self then
key = k
end
end
self.OnClick = function()
if self.descending == true then
self.descending = false
self.OnClick = function(object)
local descending = object.descending
local parent = object.parent
local pinternals = parent.internals
local list = pinternals[1]
if descending then
object.descending = false
else
self.descending = true
object.descending = true
end
self.parent.internals[1]:Sort(key, self.descending)
list:Sort(key, object.descending)
end
-- apply template properties to the object

View File

@ -141,7 +141,7 @@ end
--]]---------------------------------------------------------
function newobject:mousereleased(x, y, button)
local visible = self.visible
local visible = self.visible
if not visible then
return

View File

@ -195,12 +195,12 @@ function newobject:mousepressed(x, y, button)
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
self.down = true
self.dragging = true
self.startx = self.staticx
self.clickx = x
self.starty = self.staticy
self.clicky = y
self.down = true
self.dragging = true
self.startx = self.staticx
self.clickx = x
self.starty = self.staticy
self.clicky = y
loveframes.hoverobject = self
end

View File

@ -27,6 +27,7 @@ function newobject:initialize(object, text, width)
self.followcursor = true
self.alwaysupdate = true
-- create the object's text
self.text = loveframes.Create("text")
self.text:Remove()
self.text.parent = self

View File

@ -322,12 +322,13 @@ function newobject:DrawText()
local shadowxoffset = self.shadowxoffset
local shadowyoffset = self.shadowyoffset
local shadowcolor = self.shadowcolor
local inlist, list = self:IsInList()
for k, v in ipairs(textdata) do
local text = v.text
local color = v.color
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 inlist then
if (y + v.y) <= (list.y + list.height) and self.y + ((v.y + theight)) >= list.y then
love.graphics.setFont(font)
if shadow then
love.graphics.setColor(unpack(shadowcolor))

View File

@ -19,21 +19,16 @@ loveframes.templates.objects = {}
--]]---------------------------------------------------------
function loveframes.templates.AddProperty(templatename, object, property, value)
-- display and error if name is nil or false
-- display an error if name is nil or false
if not templatename then
loveframes.util.Error("Could not create property: No template name given.")
end
-- display and error if property is nil or false
-- display an error if property is nil or false
if not property then
loveframes.util.Error("Could not create property: No property name given.")
end
-- display and error if value is nil or false
if not value then
loveframes.util.Error("Could not create property: No property value given.")
end
local templatename = tostring(templatename)
local property = tostring(property)
local templates = loveframes.templates.available

View File

@ -131,9 +131,7 @@ function loveframes.util.GetDirectoryContents(dir, t)
local dirs = {}
for k, v in ipairs(files) do
local isdir = love.filesystem.isDirectory(dir.. "/" ..v)
if isdir == true then
table.insert(dirs, dir.. "/" ..v)
else
@ -143,7 +141,6 @@ function loveframes.util.GetDirectoryContents(dir, t)
local name = table.concat(parts)
table.insert(t, {path = dir, fullpath = dir.. "/" ..v, requirepath = dir .. "." ..name, name = name, extension = extension})
end
end
if #dirs > 0 then
@ -165,8 +162,12 @@ end
function loveframes.util.Round(num, idp)
local mult = 10^(idp or 0)
if num >= 0 then return math.floor(num * mult + 0.5) / mult
else return math.ceil(num * mult - 0.5) / mult end
if num >= 0 then
return math.floor(num * mult + 0.5) / mult
else
return math.ceil(num * mult - 0.5) / mult
end
end
@ -180,7 +181,6 @@ function loveframes.util.SplitString(str, pat)
local t = {} -- NOTE: use {n = 0} in Lua-5.0
if pat == " " then
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
@ -198,9 +198,7 @@ function loveframes.util.SplitString(str, pat)
cap = str:sub(last_end)
table.insert(t, cap)
end
else
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
@ -215,7 +213,6 @@ function loveframes.util.SplitString(str, pat)
cap = str:sub(last_end)
table.insert(t, cap)
end
end
return t