Version 0.9.4.6 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-12-10 09:19:35 -05:00
parent 4e2a12fe82
commit 105fcc31cc
8 changed files with 102 additions and 73 deletions

View File

@ -1,3 +1,15 @@
================================================
Version 0.9.4.6 - Alpha (December 10 - 2012)
================================================
[ADDED] a new textinput event callback: OnFocusGained(object)
[ADDED] a new textinput event callback: OnFocusLost(object)
[FIXED] the textinput object accepting input from the tab and delete keys when object.editable was set to false
[CHANGED] all "." are now replaced with "/" in loveframes.config["DIRECTORY"] after all inernal Love Frames libraries have been loaded (this is to prevent filesystem errors)
[REMOVED] loveframes.util.TrimString(string)
================================================
Version 0.9.4.5 - Alpha (November 28 - 2012)
================================================

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info
loveframes.info = {}
loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.5"
loveframes.info.version = "0.9.4.6"
loveframes.info.stage = "Alpha"
-- library configurations
@ -45,7 +45,11 @@ function loveframes.load()
require(dir .. ".templates")
require(dir .. ".debug")
-- create a list of gui objects and skins
-- replace all "." with "/" in the directory setting
dir = dir:gsub("%.", "/")
loveframes.config["DIRECTORY"] = dir
-- create a list of gui objects, skins and templates
local objects = loveframes.util.GetDirectoryContents(dir .. "/objects")
local skins = loveframes.util.GetDirectoryContents(dir .. "/skins")
local templates = loveframes.util.GetDirectoryContents(dir .. "/templates")
@ -72,7 +76,8 @@ function loveframes.load()
end
-- create the base gui object
loveframes.base = loveframes.objects["base"]:new()
local base = loveframes.objects["base"]
loveframes.base = base:new()
end

View File

@ -12,23 +12,23 @@ local newobject = loveframes.NewObject("frame", "loveframes_object_frame", true)
--]]---------------------------------------------------------
function newobject:initialize()
self.type = "frame"
self.name = "Frame"
self.width = 300
self.height = 150
self.clickx = 0
self.clicky = 0
self.internal = false
self.draggable = true
self.screenlocked = false
self.parentlocked = false
self.dragging = false
self.modal = false
self.modalbackground = false
self.showclose = true
self.internals = {}
self.children = {}
self.OnClose = nil
self.type = "frame"
self.name = "Frame"
self.width = 300
self.height = 150
self.clickx = 0
self.clicky = 0
self.internal = false
self.draggable = true
self.screenlocked = false
self.parentlocked = false
self.dragging = false
self.modal = false
self.modalbackground = false
self.showclose = true
self.internals = {}
self.children = {}
self.OnClose = nil
-- create the close button for the frame
local close = loveframes.objects["closebutton"]:new()

View File

@ -329,18 +329,18 @@ end
--[[---------------------------------------------------------
- func: RedoLayout()
- desc: used to redo the layour of the object
- desc: used to redo the layout of the object
--]]---------------------------------------------------------
function newobject:RedoLayout()
local children = self.children
local padding = self.padding
local spacing = self.spacing
local starty = padding
local startx = padding
local vbar = self.vbar
local hbar = self.hbar
local display = self.display
local children = self.children
local padding = self.padding
local spacing = self.spacing
local starty = padding
local startx = padding
local vbar = self.vbar
local hbar = self.hbar
local display = self.display
if #children > 0 then

View File

@ -12,21 +12,21 @@ local newobject = loveframes.NewObject("progressbar", "loveframes_object_progres
--]]---------------------------------------------------------
function newobject:initialize()
self.type = "progressbar"
self.width = 100
self.height = 25
self.min = 0
self.max = 10
self.value = 0
self.barwidth = 0
self.lerprate = 1000
self.lerpvalue = 0
self.lerpto = 0
self.lerpfrom = 0
self.completed = false
self.lerp = false
self.internal = false
self.OnComplete = nil
self.type = "progressbar"
self.width = 100
self.height = 25
self.min = 0
self.max = 10
self.value = 0
self.barwidth = 0
self.lerprate = 1000
self.lerpvalue = 0
self.lerpto = 0
self.lerpfrom = 0
self.completed = false
self.lerp = false
self.internal = false
self.OnComplete = nil
end

View File

@ -59,6 +59,8 @@ function newobject:initialize()
self.internal = false
self.OnEnter = nil
self.OnTextChanged = nil
self.OnFocusGained = nil
self.OnFocusLost = nil
end
@ -305,13 +307,16 @@ function newobject:mousepressed(x, y, button)
return
end
local hover = self.hover
local internals = self.internals
local vbar = self.vbar
local hbar = self.hbar
local scrollamount = self.mousewheelscrollamount
local time = love.timer.getTime()
local inputobject = loveframes.inputobject
local hover = self.hover
local internals = self.internals
local vbar = self.vbar
local hbar = self.hbar
local scrollamount = self.mousewheelscrollamount
local focus = self.focus
local onfocusgained = self.OnFocusGained
local onfocuslost = self.OnFocusLost
local time = love.timer.getTime()
local inputobject = loveframes.inputobject
if hover then
@ -333,6 +338,10 @@ function newobject:mousepressed(x, y, button)
self.lastclicktime = time
self:GetTextCollisions(x, y)
if onfocusgained and not focus then
onfocusgained(self)
end
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
@ -367,6 +376,9 @@ function newobject:mousepressed(x, y, button)
if inputobject == self then
loveframes.inputobject = false
if onfocuslost then
onfocuslost(self)
end
end
end
@ -542,15 +554,15 @@ function newobject:RunKey(key, unicode)
end
end
if not editable then
return
end
-- key input checking system
if key == "backspace" then
ckey = key
if not editable then
return
end
if alltextselected then
self:Clear()
self.alltextselected = false
@ -584,6 +596,10 @@ function newobject:RunKey(key, unicode)
elseif key == "delete" then
if not editable then
return
end
ckey = key
if alltextselected then
@ -652,10 +668,6 @@ function newobject:RunKey(key, unicode)
else
if unicode > 31 and unicode < 127 then
if not editable then
return
end
if alltextselected then
self.alltextselected = false
self:Clear()
@ -1043,10 +1055,22 @@ end
--]]---------------------------------------------------------
function newobject:SetFocus(focus)
local inputobject = loveframes.inputobject
local inputobject = loveframes.inputobject
local onfocusgained = self.OnFocusGained
local onfocuslost = self.OnFocusLost
self.focus = focus
if focus then
if onfocusgained then
onfocusgained(self)
end
else
if onfocuslost then
onfocuslost(self)
end
end
if inputobject == self then
loveframes.inputobject = false
end

View File

@ -2,7 +2,7 @@
## Information
Love Frames is a GUI library for [LOVE](https://love2d.org/). For information on installation and usage, please visit the wiki. A demo of the library can be found at: http://nikolairesokav.com/projects/loveframes/
Love Frames is a GUI library for [LOVE](https://love2d.org/). For information on installation and usage, please visit the [wiki](https://github.com/NikolaiResokav/LoveFrames/wiki). A demo of the library can be found at: http://nikolairesokav.com/projects/loveframes/
## License

View File

@ -229,18 +229,6 @@ function loveframes.util.SplitString(str, pat)
end
--[[---------------------------------------------------------
- func: TrimString(string)
- desc: trims spaces off of the beginning and end of
a string
- note: i take no credit for this function
--]]---------------------------------------------------------
function loveframes.util.TrimString(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
--[[---------------------------------------------------------
- func: RemoveAll()
- desc: removes all gui elements