mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Version 0.9.4.13 - Alpha (see changelog.txt)
This commit is contained in:
parent
069ed45963
commit
6c05801552
@ -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)
|
Version 0.9.4.12 - Alpha (December 30 - 2012)
|
||||||
================================================
|
================================================
|
||||||
|
@ -755,7 +755,7 @@ function loveframes.debug.SkinSelector()
|
|||||||
frame:SetName("Skin Selector")
|
frame:SetName("Skin Selector")
|
||||||
frame:SetSize(200, 60)
|
frame:SetSize(200, 60)
|
||||||
frame:SetPos(5, 255)
|
frame:SetPos(5, 255)
|
||||||
|
|
||||||
local skinslist = loveframes.Create("multichoice", frame)
|
local skinslist = loveframes.Create("multichoice", frame)
|
||||||
skinslist:SetPos(5, 30)
|
skinslist:SetPos(5, 30)
|
||||||
skinslist:SetWidth(190)
|
skinslist:SetWidth(190)
|
||||||
|
32
init.lua
32
init.lua
@ -7,27 +7,27 @@
|
|||||||
loveframes = {}
|
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.12"
|
loveframes.info.version = "0.9.4.13"
|
||||||
loveframes.info.stage = "Alpha"
|
loveframes.info.stage = "Alpha"
|
||||||
|
|
||||||
-- library configurations
|
-- library configurations
|
||||||
loveframes.config = {}
|
loveframes.config = {}
|
||||||
loveframes.config["DIRECTORY"] = ""
|
loveframes.config["DIRECTORY"] = ""
|
||||||
loveframes.config["DEFAULTSKIN"] = "Blue"
|
loveframes.config["DEFAULTSKIN"] = "Blue"
|
||||||
loveframes.config["ACTIVESKIN"] = "Blue"
|
loveframes.config["ACTIVESKIN"] = "Blue"
|
||||||
loveframes.config["INDEXSKINIMAGES"] = true
|
loveframes.config["INDEXSKINIMAGES"] = true
|
||||||
loveframes.config["DEBUG"] = false
|
loveframes.config["DEBUG"] = false
|
||||||
|
|
||||||
-- misc library vars
|
-- misc library vars
|
||||||
loveframes.drawcount = 0
|
loveframes.drawcount = 0
|
||||||
loveframes.hoverobject = false
|
loveframes.hoverobject = false
|
||||||
loveframes.modalobject = false
|
loveframes.modalobject = false
|
||||||
loveframes.inputobject = false
|
loveframes.inputobject = false
|
||||||
loveframes.basicfont = love.graphics.newFont(12)
|
loveframes.basicfont = love.graphics.newFont(12)
|
||||||
loveframes.basicfontsmall = love.graphics.newFont(10)
|
loveframes.basicfontsmall = love.graphics.newFont(10)
|
||||||
loveframes.objects = {}
|
loveframes.objects = {}
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: load()
|
- func: load()
|
||||||
|
@ -523,8 +523,6 @@ function newobject:Remove()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.removed = true
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -1047,4 +1045,22 @@ function newobject:GetProperty(name)
|
|||||||
|
|
||||||
return self[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
|
end
|
@ -123,15 +123,12 @@ function newobject:mousereleased(x, y, button)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.hover and button == "l" then
|
if self.hover and button == "l" then
|
||||||
|
|
||||||
local parent1 = self:GetParent()
|
local parent1 = self:GetParent()
|
||||||
local parent2 = parent1:GetParent()
|
local parent2 = parent1:GetParent()
|
||||||
local onrowclicked = parent2.OnRowClicked
|
local onrowclicked = parent2.OnRowClicked
|
||||||
|
|
||||||
if onrowclicked then
|
if onrowclicked then
|
||||||
onrowclicked(parent2, self, self.columndata)
|
onrowclicked(parent2, self, self.columndata)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -28,19 +28,23 @@ function newobject:initialize(name, parent)
|
|||||||
|
|
||||||
local key = 0
|
local key = 0
|
||||||
|
|
||||||
for k, v in ipairs(self.parent.children) do
|
for k, v in ipairs(parent.children) do
|
||||||
if v == self then
|
if v == self then
|
||||||
key = k
|
key = k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.OnClick = function()
|
self.OnClick = function(object)
|
||||||
if self.descending == true then
|
local descending = object.descending
|
||||||
self.descending = false
|
local parent = object.parent
|
||||||
|
local pinternals = parent.internals
|
||||||
|
local list = pinternals[1]
|
||||||
|
if descending then
|
||||||
|
object.descending = false
|
||||||
else
|
else
|
||||||
self.descending = true
|
object.descending = true
|
||||||
end
|
end
|
||||||
self.parent.internals[1]:Sort(key, self.descending)
|
list:Sort(key, object.descending)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- apply template properties to the object
|
-- apply template properties to the object
|
||||||
|
@ -141,7 +141,7 @@ end
|
|||||||
--]]---------------------------------------------------------
|
--]]---------------------------------------------------------
|
||||||
function newobject:mousereleased(x, y, button)
|
function newobject:mousereleased(x, y, button)
|
||||||
|
|
||||||
local visible = self.visible
|
local visible = self.visible
|
||||||
|
|
||||||
if not visible then
|
if not visible then
|
||||||
return
|
return
|
||||||
|
@ -195,12 +195,12 @@ function newobject:mousepressed(x, y, button)
|
|||||||
if baseparent and baseparent.type == "frame" then
|
if baseparent and baseparent.type == "frame" then
|
||||||
baseparent:MakeTop()
|
baseparent:MakeTop()
|
||||||
end
|
end
|
||||||
self.down = true
|
self.down = true
|
||||||
self.dragging = true
|
self.dragging = true
|
||||||
self.startx = self.staticx
|
self.startx = self.staticx
|
||||||
self.clickx = x
|
self.clickx = x
|
||||||
self.starty = self.staticy
|
self.starty = self.staticy
|
||||||
self.clicky = y
|
self.clicky = y
|
||||||
loveframes.hoverobject = self
|
loveframes.hoverobject = self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ function newobject:initialize(object, text, width)
|
|||||||
self.followcursor = true
|
self.followcursor = true
|
||||||
self.alwaysupdate = true
|
self.alwaysupdate = true
|
||||||
|
|
||||||
|
-- create the object's text
|
||||||
self.text = loveframes.Create("text")
|
self.text = loveframes.Create("text")
|
||||||
self.text:Remove()
|
self.text:Remove()
|
||||||
self.text.parent = self
|
self.text.parent = self
|
||||||
|
@ -322,12 +322,13 @@ function newobject:DrawText()
|
|||||||
local shadowxoffset = self.shadowxoffset
|
local shadowxoffset = self.shadowxoffset
|
||||||
local shadowyoffset = self.shadowyoffset
|
local shadowyoffset = self.shadowyoffset
|
||||||
local shadowcolor = self.shadowcolor
|
local shadowcolor = self.shadowcolor
|
||||||
|
local inlist, list = self:IsInList()
|
||||||
|
|
||||||
for k, v in ipairs(textdata) do
|
for k, v in ipairs(textdata) do
|
||||||
local text = v.text
|
local text = v.text
|
||||||
local color = v.color
|
local color = v.color
|
||||||
if self.parent.type == "list" then
|
if inlist 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) <= (list.y + list.height) and self.y + ((v.y + theight)) >= list.y then
|
||||||
love.graphics.setFont(font)
|
love.graphics.setFont(font)
|
||||||
if shadow then
|
if shadow then
|
||||||
love.graphics.setColor(unpack(shadowcolor))
|
love.graphics.setColor(unpack(shadowcolor))
|
||||||
|
@ -19,21 +19,16 @@ loveframes.templates.objects = {}
|
|||||||
--]]---------------------------------------------------------
|
--]]---------------------------------------------------------
|
||||||
function loveframes.templates.AddProperty(templatename, object, property, value)
|
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
|
if not templatename then
|
||||||
loveframes.util.Error("Could not create property: No template name given.")
|
loveframes.util.Error("Could not create property: No template name given.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- display and error if property is nil or false
|
-- display an error if property is nil or false
|
||||||
if not property then
|
if not property then
|
||||||
loveframes.util.Error("Could not create property: No property name given.")
|
loveframes.util.Error("Could not create property: No property name given.")
|
||||||
end
|
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 templatename = tostring(templatename)
|
||||||
local property = tostring(property)
|
local property = tostring(property)
|
||||||
local templates = loveframes.templates.available
|
local templates = loveframes.templates.available
|
||||||
|
15
util.lua
15
util.lua
@ -131,9 +131,7 @@ function loveframes.util.GetDirectoryContents(dir, t)
|
|||||||
local dirs = {}
|
local dirs = {}
|
||||||
|
|
||||||
for k, v in ipairs(files) do
|
for k, v in ipairs(files) do
|
||||||
|
|
||||||
local isdir = love.filesystem.isDirectory(dir.. "/" ..v)
|
local isdir = love.filesystem.isDirectory(dir.. "/" ..v)
|
||||||
|
|
||||||
if isdir == true then
|
if isdir == true then
|
||||||
table.insert(dirs, dir.. "/" ..v)
|
table.insert(dirs, dir.. "/" ..v)
|
||||||
else
|
else
|
||||||
@ -143,7 +141,6 @@ function loveframes.util.GetDirectoryContents(dir, t)
|
|||||||
local name = table.concat(parts)
|
local name = table.concat(parts)
|
||||||
table.insert(t, {path = dir, fullpath = dir.. "/" ..v, requirepath = dir .. "." ..name, name = name, extension = extension})
|
table.insert(t, {path = dir, fullpath = dir.. "/" ..v, requirepath = dir .. "." ..name, name = name, extension = extension})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if #dirs > 0 then
|
if #dirs > 0 then
|
||||||
@ -165,8 +162,12 @@ end
|
|||||||
function loveframes.util.Round(num, idp)
|
function loveframes.util.Round(num, idp)
|
||||||
|
|
||||||
local mult = 10^(idp or 0)
|
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
|
end
|
||||||
|
|
||||||
@ -180,7 +181,6 @@ function loveframes.util.SplitString(str, pat)
|
|||||||
local t = {} -- NOTE: use {n = 0} in Lua-5.0
|
local t = {} -- NOTE: use {n = 0} in Lua-5.0
|
||||||
|
|
||||||
if pat == " " then
|
if pat == " " then
|
||||||
|
|
||||||
local fpat = "(.-)" .. pat
|
local fpat = "(.-)" .. pat
|
||||||
local last_end = 1
|
local last_end = 1
|
||||||
local s, e, cap = str:find(fpat, 1)
|
local s, e, cap = str:find(fpat, 1)
|
||||||
@ -198,9 +198,7 @@ function loveframes.util.SplitString(str, pat)
|
|||||||
cap = str:sub(last_end)
|
cap = str:sub(last_end)
|
||||||
table.insert(t, cap)
|
table.insert(t, cap)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
local fpat = "(.-)" .. pat
|
local fpat = "(.-)" .. pat
|
||||||
local last_end = 1
|
local last_end = 1
|
||||||
local s, e, cap = str:find(fpat, 1)
|
local s, e, cap = str:find(fpat, 1)
|
||||||
@ -215,7 +213,6 @@ function loveframes.util.SplitString(str, pat)
|
|||||||
cap = str:sub(last_end)
|
cap = str:sub(last_end)
|
||||||
table.insert(t, cap)
|
table.insert(t, cap)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return t
|
return t
|
||||||
|
Loading…
Reference in New Issue
Block a user