Version 0.9.4.5 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-11-28 04:15:06 -05:00
parent 53731d9a01
commit 4e2a12fe82
4 changed files with 98 additions and 65 deletions

View File

@ -1,3 +1,8 @@
================================================
Version 0.9.4.5 - Alpha (November 28 - 2012)
================================================
[FIXED] text inputs not losing focus in certain situations
================================================
Version 0.9.4.4 - Alpha (November 24 - 2012)
================================================

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info
loveframes.info = {}
loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.4"
loveframes.info.version = "0.9.4.5"
loveframes.info.stage = "Alpha"
-- library configurations
@ -24,6 +24,7 @@ loveframes.config["DEBUG"] = false
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 = {}
@ -178,33 +179,33 @@ function loveframes.Create(data, parent)
end
-- create the object
object = object:new()
local newobject = object:new()
-- apply template properties to the object
loveframes.templates.ApplyToObject(object)
-- if the object is a tooltip, return it and go no further
if data == "tooltip" then
return object
return newobject
end
-- remove the object if it is an internal
if object.internal then
object:Remove()
if newobject.internal then
newobject:Remove()
return
end
-- parent the new object by default to the base gui object
object.parent = loveframes.base
table.insert(loveframes.base.children, object)
newobject.parent = loveframes.base
table.insert(loveframes.base.children, newobject)
-- if the parent argument is not nil, make that argument the object's new parent
if parent then
object:SetParent(parent)
newobject:SetParent(parent)
end
-- return the object for further manipulation
return object
return newobject
elseif type(data) == "table" then

View File

@ -616,9 +616,20 @@ end
--]]---------------------------------------------------------
function newobject:IsTopCollision()
local cols = loveframes.util.GetCollisions()
local cols = loveframes.util.GetCollisions()
local draworder = self.draworder
local top = true
local found = false
local top = true
for k, v in ipairs(cols) do
if v == self then
found = true
end
end
if not found then
return false
end
-- loop through the object's parent's children
for k, v in ipairs(cols) do
@ -715,7 +726,7 @@ function newobject:CheckHover()
end
-- this chunk of code handles mouse enter and exit
if self.hover == true then
if self.hover then
if not self.calledmousefunc then

View File

@ -76,26 +76,27 @@ function newobject:update(dt)
return
end
end
local time = love.timer.getTime()
local keydown = self.keydown
local unicode = self.unicode
local parent = self.parent
local base = loveframes.base
local update = self.Update
local theight = self.font:getHeight("a")
local delay = self.delay
local lines = self.lines
local numlines = #lines
local multiline = self.multiline
local width = self.width
local height = self.height
local vbar = self.vbar
local hbar = self.hbar
local internals = self.internals
-- check to see if the object is being hovered over
self:CheckHover()
local time = love.timer.getTime()
local keydown = self.keydown
local unicode = self.unicode
local parent = self.parent
local base = loveframes.base
local update = self.Update
local theight = self.font:getHeight("a")
local delay = self.delay
local lines = self.lines
local numlines = #lines
local multiline = self.multiline
local width = self.width
local height = self.height
local vbar = self.vbar
local hbar = self.hbar
local inputobject = loveframes.inputobject
local internals = self.internals
-- move to parent if there is a parent
if parent ~= base then
@ -103,6 +104,11 @@ function newobject:update(dt)
self.y = self.parent.y + self.staticy
end
if inputobject ~= self then
self.focus = false
self.alltextselected = false
end
-- keydown check
if keydown ~= "none" then
if time > delay then
@ -299,44 +305,41 @@ function newobject:mousepressed(x, y, button)
return
end
local hover = self.hover
local time = love.timer.getTime()
local internals = self.internals
local vbar = self.vbar
local hbar = self.hbar
local hover = self.hover
local internals = self.internals
local vbar = self.vbar
local hbar = self.hbar
local scrollamount = self.mousewheelscrollamount
if hover and button == "l" then
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
self.focus = true
if not self.alltextselected then
if time > self.lastclicktime and time < (self.lastclicktime + 0.25) then
self.alltextselected = true
end
else
self.alltextselected = false
end
self.lastclicktime = time
self:GetTextCollisions(x, y)
else
if not hover then
self.focus = false
self.alltextselected = false
end
end
local time = love.timer.getTime()
local inputobject = loveframes.inputobject
if hover then
if button == "wu" then
if button == "l" then
if inputobject ~= self then
loveframes.inputobject = self
end
if not self.alltextselected then
if time > self.lastclicktime and time < (self.lastclicktime + 0.25) then
self.alltextselected = true
end
else
self.alltextselected = false
end
self.focus = true
self.lastclicktime = time
self:GetTextCollisions(x, y)
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
elseif button == "wu" then
if vbar and not hbar then
local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
vbar:Scroll(-scrollamount)
@ -359,6 +362,13 @@ function newobject:mousepressed(x, y, button)
hbar:Scroll(scrollamount)
end
end
else
if inputobject == self then
loveframes.inputobject = false
end
end
for k, v in ipairs(internals) do
@ -446,7 +456,7 @@ function newobject:RunKey(key, unicode)
return
end
if not self.focus then
if not focus then
return
end
@ -1033,8 +1043,14 @@ end
--]]---------------------------------------------------------
function newobject:SetFocus(focus)
local inputobject = loveframes.inputobject
self.focus = focus
if inputobject == self then
loveframes.inputobject = false
end
end
--[[---------------------------------------------------------