Version 0.9.4.3 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-11-20 16:04:57 -05:00
parent 3d006ec389
commit b4d8dd786f
9 changed files with 172 additions and 107 deletions

View File

@ -1,3 +1,19 @@
================================================
Version 0.9.4.3 - Alpha (November 20 - 2012)
================================================
[ADDED] a new base method: SetProperty(name, value)
[ADDED] a new base method: GetProperty(name)
[ADDED] a new list method: SetButtonScrollAmount(amount)
[ADDED] a new list method: GetButtonScrollAmount()
[ADDED] a new list method: SetMouseWheelScrollAmount(amount)
[ADDED] a new list method: GetMouseWheelScrollAmount()
[FIXED] a typo in the changelog
[FIXED] image:SetScale(scalex, scaley) not working correctly
[CHANGED] loveframes.util.GetDirContents(dir, t) to loveframes.util.GetDirectoryContents(dir, t)
[CHANGED] arguments passed to require() to use "." instead of "/" which should fix file loading issues on certain systems
================================================ ================================================
Version 0.9.4.2 - Alpha (November 5 - 2012) Version 0.9.4.2 - Alpha (November 5 - 2012)
================================================ ================================================
@ -28,7 +44,7 @@ Version 0.9.4.2 - Alpha (November 5 - 2012)
[FIXED] text in a single line text input always being cleared when the enter key was pressed [FIXED] text in a single line text input always being cleared when the enter key was pressed
[FIXED] a syntax error in both default skin files that caused imaged to draw incorrect when they had a custom color [FIXED] a syntax error in both default skin files that caused imaged to draw incorrect when they had a custom color
[FIXED] an error that would occur when a tab button was being drawn while no font had been set [FIXED] an error that would occur when a tab button was being drawn while no font had been set
[FIXED] textinput.OnTextChanged being called to early when using the backspace key or the delete key [FIXED] textinput.OnTextChanged being called too early when using the backspace key or the delete key
[CHANGED] tab buttons no longer calculate their width from within their internal drawing function and should be sized externally from now on [CHANGED] tab buttons no longer calculate their width from within their internal drawing function and should be sized externally from now on
[CHANGED] the text object now calculates what characters should be drawn while in a list object to improve performance with list objects that contain large amounts of text [CHANGED] the text object now calculates what characters should be drawn while in a list object to improve performance with list objects that contain large amounts of text

View File

@ -7,10 +7,16 @@
loveframes.debug = {} loveframes.debug = {}
local font = love.graphics.newFont(10) local font = love.graphics.newFont(10)
local changelog, size = love.filesystem.read("libraries/loveframes/changelog.txt")
local loremipsum = local loremipsum =
[[ [[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean laoreet massa mattis tortor faucibus non congue mauris mattis. Aliquam ultricies scelerisque mi, sit amet tempor metus pharetra vel. Etiam eu arcu a dolor porttitor condimentum in malesuada urna. Mauris vel nulla mi, quis aliquet neque. In aliquet turpis eget purus malesuada tincidunt. Donec rutrum purus vel diam suscipit vehicula. Cras sem nibh, tempus at dictum non, consequat non justo. In sed tellus nec orci scelerisque scelerisque id vitae leo. Maecenas pharetra, nibh eget commodo gravida, augue nisl blandit dui, ut malesuada augue dui nec erat. Phasellus nec mauris pharetra metus iaculis viverra sit amet ut tortor. Duis et viverra magna. Nunc orci dolor, placerat a iaculis non, mattis sed nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin dui enim, porta eget facilisis quis, laoreet sit amet urna. Maecenas lobortis venenatis euismod. Sed at diam sit amet odio feugiat pretium nec quis libero. Quisque auctor semper imperdiet. Maecenas risus eros, varius pharetra volutpat in, fermentum scelerisque lacus. Proin lectus erat, luctus non facilisis vel, hendrerit vitae nisl. Aliquam vulputate scelerisque odio id faucibus.
Mauris ac erat sit amet ante condimentum scelerisque. Cras eleifend lorem dictum mi euismod non placerat lorem gravida. Vestibulum sodales dapibus eros, non iaculis risus commodo eu. Maecenas dapibus purus accumsan metus euismod suscipit. Etiam eleifend lorem eget quam ornare interdum sed at nulla. Suspendisse viverra sapien ut felis viverra pellentesque. Ut convallis hendrerit est, in imperdiet purus placerat ut. Curabitur sapien nibh, molestie et elementum a, sagittis et tortor. Vestibulum sed quam eu velit euismod rutrum vitae et sem. Morbi accumsan quam vitae sapien scelerisque tincidunt. Nulla ipsum leo, scelerisque at consequat sit amet, venenatis eget mauris. Aliquam at nibh vel lorem hendrerit dignissim. Cras et risus sit amet est vehicula auctor at a leo. Curabitur euismod mi sit amet nunc consequat sed fringilla justo sagittis.
Nulla ut arcu felis, a laoreet tellus. Vivamus ligula nibh, bibendum ut ultrices sed, ullamcorper et est. Pellentesque nisi diam, sollicitudin lacinia fermentum quis, aliquam fermentum elit. Donec egestas vestibulum mollis. Vivamus sollicitudin nisl vestibulum nisi fermentum scelerisque. Nunc enim magna, posuere ornare faucibus a, bibendum vestibulum felis. Etiam laoreet molestie elit, vitae ultrices sem faucibus in. Fusce rutrum convallis lacus, vitae scelerisque eros tincidunt sed. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
Quisque ornare arcu sed enim sodales dictum. Suspendisse at convallis mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas et nibh odio, eu lacinia lacus. Mauris at pulvinar urna. Pellentesque vel justo erat, a congue nibh. Nunc tristique mattis euismod. Suspendisse potenti.
Sed dictum faucibus cursus. Integer nisi ipsum, dapibus vel blandit laoreet, bibendum congue massa. Vestibulum tincidunt vulputate nunc, facilisis consequat lacus posuere at. Aenean sed mollis urna. Vivamus congue neque non arcu malesuada lobortis. Curabitur suscipit pretium massa eu rutrum. Nulla vehicula imperdiet dui in blandit. Curabitur vitae felis ut massa scelerisque consequat. Nulla a magna quis risus consequat hendrerit. Maecenas quis lacus sit amet ipsum condimentum interdum. Proin condimentum erat id enim elementum ut tincidunt neque vulputate.
]] ]]
--[[--------------------------------------------------------- --[[---------------------------------------------------------
@ -670,11 +676,11 @@ function loveframes.debug.ExamplesMenu()
list1:SetPadding(5) list1:SetPadding(5)
list1:SetSpacing(5) list1:SetSpacing(5)
for i=1, 5 do --for i=1, 5 do
local text1 = loveframes.Create("text") local text1 = loveframes.Create("text")
text1:SetText(loremipsum) text1:SetText(loremipsum)
list1:AddItem(text1) list1:AddItem(text1)
end --end
end end
exampleslist:AddItem(textexample) exampleslist:AddItem(textexample)
@ -719,7 +725,7 @@ function loveframes.debug.ExamplesMenu()
togglebutton:SetPos(5, 335) togglebutton:SetPos(5, 335)
textinput1:SetMultiline(true) textinput1:SetMultiline(true)
textinput1:SetHeight(300) textinput1:SetHeight(300)
textinput1:SetText(changelog) textinput1:SetText("")
end end
end end

View File

@ -8,27 +8,22 @@ loveframes = {}
-- library info -- library info
loveframes.info = {} loveframes.info = {}
loveframes.info.author = "Nikolai Resokav" loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.2" loveframes.info.version = "0.9.4.3"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations
loveframes.config = {} loveframes.config = {}
loveframes.config["DIRECTORY"] = "libraries/loveframes" 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"] = true loveframes.config["DEBUG"] = false
-- misc library vars -- misc library vars
loveframes.drawcount = 0 loveframes.drawcount = 0
loveframes.lastselection = 0
loveframes.selectiondelay = 0.05
loveframes.selectionstartdelay = 0.50
loveframes.selecting = false
loveframes.hoverobject = false loveframes.hoverobject = false
loveframes.modalobject = false loveframes.modalobject = false
loveframes.selectedobject = 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)
@ -42,35 +37,35 @@ function loveframes.load()
local dir = loveframes.config["DIRECTORY"] local dir = loveframes.config["DIRECTORY"]
-- require the internal base libraries -- require the internal base libraries
require(dir .. "/third-party/middleclass") require(dir .. ".third-party.middleclass")
require(dir .. "/util") require(dir .. ".util")
require(dir .. "/skins") require(dir .. ".skins")
require(dir .. "/templates") require(dir .. ".templates")
require(dir .. "/debug") require(dir .. ".debug")
-- create a list of gui objects and skins -- create a list of gui objects and skins
local objects = loveframes.util.GetDirContents(dir .. "/objects") local objects = loveframes.util.GetDirectoryContents(dir .. "/objects")
local skins = loveframes.util.GetDirContents(dir .. "/skins") local skins = loveframes.util.GetDirectoryContents(dir .. "/skins")
local templates = loveframes.util.GetDirContents(dir .. "/templates") local templates = loveframes.util.GetDirectoryContents(dir .. "/templates")
-- loop through a list of all gui objects and require them -- loop through a list of all gui objects and require them
for k, v in ipairs(objects) do for k, v in ipairs(objects) do
if v.extension == "lua" then if v.extension == "lua" then
require(v.path .. "/" ..v.name) require(v.requirepath)
end end
end end
-- loop through a list of all gui templates and require them -- loop through a list of all gui templates and require them
for k, v in ipairs(templates) do for k, v in ipairs(templates) do
if v.extension == "lua" then if v.extension == "lua" then
require(v.path .. "/" ..v.name) require(v.requirepath)
end end
end end
-- loop through a list of all gui skins and require them -- loop through a list of all gui skins and require them
for k, v in ipairs(skins) do for k, v in ipairs(skins) do
if v.extension == "lua" then if v.extension == "lua" then
require(v.path .. "/" ..v.name) require(v.requirepath)
end end
end end

View File

@ -1034,3 +1034,23 @@ function base:GetDrawOrder()
return self.draworder return self.draworder
end end
--[[---------------------------------------------------------
- func: SetProperty(name, value)
- desc: sets a property on the object
--]]---------------------------------------------------------
function base:SetProperty(name, value)
self[name] = value
end
--[[---------------------------------------------------------
- func: GetProperty(name)
- desc: gets the value of an object's property
--]]---------------------------------------------------------
function base:GetProperty(name)
return self[name]
end

View File

@ -204,8 +204,8 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetScale(scalex, scaley) function image:SetScale(scalex, scaley)
self.scalex = x self.scalex = scalex
self.scaley = y self.scaley = scaley
end end

View File

@ -44,7 +44,7 @@ function scrollbody:initialize(parent, bartype)
upbutton.staticx = 0 + self.width - upbutton.width upbutton.staticx = 0 + self.width - upbutton.width
upbutton.staticy = 0 upbutton.staticy = 0
if object.down and object.hover then if object.down and object.hover then
bar:Scroll(-0.10) bar:Scroll(-self.parent.buttonscrollamount)
end end
end end
@ -54,7 +54,7 @@ function scrollbody:initialize(parent, bartype)
downbutton.staticx = 0 + self.width - downbutton.width downbutton.staticx = 0 + self.width - downbutton.width
downbutton.staticy = 0 + self.height - downbutton.height downbutton.staticy = 0 + self.height - downbutton.height
if object.down and object.hover then if object.down and object.hover then
bar:Scroll(0.10) bar:Scroll(self.parent.buttonscrollamount)
end end
end end
@ -69,7 +69,7 @@ function scrollbody:initialize(parent, bartype)
leftbutton.staticx = 0 leftbutton.staticx = 0
leftbutton.staticy = 0 leftbutton.staticy = 0
if object.down and object.hover then if object.down and object.hover then
bar:Scroll(-0.10) bar:Scroll(-self.parent.buttonscrollamount)
end end
end end
@ -79,7 +79,7 @@ function scrollbody:initialize(parent, bartype)
rightbutton.staticx = 0 + self.width - rightbutton.width rightbutton.staticx = 0 + self.width - rightbutton.width
rightbutton.staticy = 0 rightbutton.staticy = 0
if object.down and object.hover then if object.down and object.hover then
bar:Scroll(0.10) bar:Scroll(self.parent.buttonscrollamount)
end end
end end

View File

@ -24,6 +24,8 @@ function list:initialize()
self.offsetx = 0 self.offsetx = 0
self.extrawidth = 0 self.extrawidth = 0
self.extraheight = 0 self.extraheight = 0
self.buttonscrollamount = 0.10
self.mousewheelscrollamount = 5
self.internal = false self.internal = false
self.hbar = false self.hbar = false
self.vbar = false self.vbar = false
@ -161,6 +163,7 @@ function list:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
local vbar = self.vbar local vbar = self.vbar
local hbar = self.hbar local hbar = self.hbar
local scrollamount = self.mousewheelscrollamount
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
@ -181,9 +184,9 @@ function list:mousepressed(x, y, button)
local bar = self:GetScrollBar() local bar = self:GetScrollBar()
if button == "wu" then if button == "wu" then
bar:Scroll(-5) bar:Scroll(-scrollamount)
elseif button == "wd" then elseif button == "wd" then
bar:Scroll(5) bar:Scroll(scrollamount)
end end
end end
@ -556,3 +559,45 @@ function list:SetAutoScroll(bool)
end end
end end
--[[---------------------------------------------------------
- func: SetButtonScrollAmount(speed)
- desc: sets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function list:SetButtonScrollAmount(amount)
self.buttonscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetButtonScrollAmount()
- desc: gets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function list:GetButtonScrollAmount()
return self.buttonscrollamount
end
--[[---------------------------------------------------------
- func: SetMouseWheelScrollAmount(amount)
- desc: sets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function list:SetMouseWheelScrollAmount(amount)
self.mousewheelscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetMouseWheelScrollAmount()
- desc: gets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function list:GetButtonScrollAmount()
return self.mousewheelscrollamount
end

View File

@ -21,7 +21,7 @@ function loveframes.skins.Register(skin)
local namecheck = loveframes.skins.available[name] local namecheck = loveframes.skins.available[name]
local dir = loveframes.config["DIRECTORY"] .. "/skins/" ..name local dir = loveframes.config["DIRECTORY"] .. "/skins/" ..name
local dircheck = love.filesystem.isDirectory(dir) local dircheck = love.filesystem.isDirectory(dir)
local images = loveframes.util.GetDirContents(dir .. "/images") local images = loveframes.util.GetDirectoryContents(dir .. "/images")
local indeximages = loveframes.config["INDEXSKINIMAGES"] local indeximages = loveframes.config["INDEXSKINIMAGES"]
if name == "" or not name then if name == "" or not name then

View File

@ -126,36 +126,17 @@ function loveframes.util.GetAllObjects(object, t)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: GetDirContents(directory, table) - func: GetDirectoryContents(directory, table)
- desc: gets the contents of a directory and all of - desc: gets the contents of a directory and all of
it's subdirectories it's subdirectories
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.util.GetDirContents(dir, t) function loveframes.util.GetDirectoryContents(dir, t)
local dir = dir local dir = dir
local t = t or {} local t = t or {}
local files = love.filesystem.enumerate(dir) local files = love.filesystem.enumerate(dir)
local dirs = {} local dirs = {}
-- local function to restore a string to it's original state after being split
local function restore(t)
local s = ""
t[#t] = nil
for k, v in ipairs(t) do
if k ~= #t then
s = s .. v .. "."
else
s = s .. v
end
end
return s
end
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)
@ -165,15 +146,16 @@ function loveframes.util.GetDirContents(dir, t)
else else
local parts = loveframes.util.SplitString(v, "([.])") local parts = loveframes.util.SplitString(v, "([.])")
local extension = parts[#parts] local extension = parts[#parts]
local name = restore(parts) parts[#parts] = nil
table.insert(t, {path = dir, fullpath = dir.. "/" ..v, name = name, extension = extension}) local name = table.concat(parts)
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
for k, v in ipairs(dirs) do for k, v in ipairs(dirs) do
t = loveframes.util.GetDirContents(v, t) t = loveframes.util.GetDirectoryContents(v, t)
end end
end end
@ -181,6 +163,7 @@ function loveframes.util.GetDirContents(dir, t)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: Round(num, idp) - func: Round(num, idp)
- desc: rounds a number based on the decimal limit - desc: rounds a number based on the decimal limit