Version 0.9.1.2 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-05-12 23:45:45 -04:00
parent 546700a0a3
commit 11002c6c89
18 changed files with 202 additions and 13 deletions

View File

@ -1,3 +1,17 @@
================================================
Version 0.9.1.2 - Alpha (May 12 - 2012)
================================================
[ADDED] a system for preventing objects from being hovered over when another object is being pressed or is "down"
[ADDED] "down" property for the checkbox object
[ADDED] "down" property for the collapsible category object
[ADDED] a new method for the tabs object: SetToolTipFont(font)
[FIXED] list:GetScrollBar() crashing when the list had no scroll bar
[FIXED] not being able to move the text input blinker to the front or end of the it's text by clicking on whitespace
[FIXED] the multichoice row object being "down" when mouse buttons other than the left mouse button were pressed
[CHANGED] collapsible category opening and closing system (will now only open or close when "down")
================================================ ================================================
Version 0.9.1 - Alpha (May 8 - 2012) Version 0.9.1 - Alpha (May 8 - 2012)
================================================ ================================================

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info -- library info
loveframes.info = {} loveframes.info = {}
loveframes.info.author = "Nikolai Resokav" loveframes.info.author = "Nikolai Resokav"
loveframes.info.version = "0.9.1" loveframes.info.version = "0.9.1.2"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations
@ -20,8 +20,8 @@ loveframes.config["ACTIVESKIN"] = "Blue"
loveframes.config["INDEXSKINIMAGES"] = true loveframes.config["INDEXSKINIMAGES"] = true
loveframes.config["DEBUG"] = true loveframes.config["DEBUG"] = true
-- drawcount
loveframes.drawcount = 0 loveframes.drawcount = 0
loveframes.hoverobject = false
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: load() - func: load()
@ -115,6 +115,10 @@ function loveframes.mousereleased(x, y, button)
object:mousereleased(x, y, button) object:mousereleased(x, y, button)
if button == "l" then
loveframes.hoverobject = false
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------

View File

@ -577,6 +577,7 @@ function base:CheckHover()
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local selfcol = loveframes.util.BoundingBox(x, self.x, y, self.y, 1, self.width, 1, self.height) local selfcol = loveframes.util.BoundingBox(x, self.x, y, self.y, 1, self.width, 1, self.height)
local hoverobject = loveframes.hoverobject
-- is the mouse inside the object? -- is the mouse inside the object?
if selfcol == true then if selfcol == true then
@ -584,7 +585,15 @@ function base:CheckHover()
local top = self:IsTopCollision() local top = self:IsTopCollision()
if top == true then if top == true then
self.hover = true if hoverobject == false then
self.hover = true
else
if hoverobject == self then
self.hover = true
else
self.hover = false
end
end
else else
self.hover = false self.hover = false
end end

View File

@ -39,6 +39,18 @@ function button:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -97,6 +109,7 @@ function button:mousepressed(x, y, button)
end end
self.down = true self.down = true
loveframes.hoverobject = self
end end

View File

@ -22,6 +22,7 @@ function checkbox:initialize()
self.checked = false self.checked = false
self.lastvalue = false self.lastvalue = false
self.internal = false self.internal = false
self.down = true
self.internals = {} self.internals = {}
self.OnChanged = nil self.OnChanged = nil
@ -41,6 +42,18 @@ function checkbox:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -127,6 +140,9 @@ function checkbox:mousepressed(x, y, button)
baseparent:MakeTop() baseparent:MakeTop()
end end
self.down = true
loveframes.hoverobject = self
end end
end end

View File

@ -21,6 +21,7 @@ function collapsiblecategory:initialize()
self.padding = 5 self.padding = 5
self.internal = false self.internal = false
self.open = false self.open = false
self.down = false
self.children = {} self.children = {}
self.OnOpenedClosed = nil self.OnOpenedClosed = nil
@ -115,6 +116,9 @@ function collapsiblecategory: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
loveframes.hoverobject = self
end end
@ -147,7 +151,7 @@ function collapsiblecategory:mousereleased(x, y, button)
local open = self.open local open = self.open
local col = loveframes.util.BoundingBox(self.x, x, self.y, y, self.width, 1, self.closedheight, 1) local col = loveframes.util.BoundingBox(self.x, x, self.y, y, self.width, 1, self.closedheight, 1)
if hover == true and button == "l" and col == true then if hover == true and button == "l" and col == true and self.down == true then
if open == true then if open == true then
self:SetOpen(false) self:SetOpen(false)
@ -155,6 +159,8 @@ function collapsiblecategory:mousereleased(x, y, button)
self:SetOpen(true) self:SetOpen(true)
end end
self.down = false
end end
if self.open == true then if self.open == true then

View File

@ -40,6 +40,18 @@ function imagebutton:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -98,6 +110,7 @@ function imagebutton:mousepressed(x, y, imagebutton)
end end
self.down = true self.down = true
loveframes.hoverobject = self
end end

View File

@ -37,6 +37,18 @@ function closebutton:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -95,6 +107,8 @@ function closebutton:mousepressed(x, y, button)
end end
self.down = true self.down = true
loveframes.hoverobject = self
end end
end end

View File

@ -60,6 +60,18 @@ function columnlistheader:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -114,6 +126,7 @@ function columnlistheader:mousepressed(x, y, button)
end end
self.down = true self.down = true
loveframes.hoverobject = self
end end

View File

@ -21,7 +21,6 @@ function multichoicerow:initialize()
self.internal = true self.internal = true
self.down = false self.down = false
self.canclick = false self.canclick = false
self.OnClick = nil
end end
@ -39,6 +38,18 @@ function multichoicerow:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -84,7 +95,12 @@ function multichoicerow:mousepressed(x, y, button)
return return
end end
self.down = true if self.hover == true and button == "l" then
self.down = true
loveframes.hoverobject = self
end
end end
@ -107,6 +123,10 @@ function multichoicerow:mousereleased(x, y, button)
end end
--[[---------------------------------------------------------
- func: SetText(text)
- desc: sets the object's text
--]]---------------------------------------------------------
function multichoicerow:SetText(text) function multichoicerow:SetText(text)
self.text = text self.text = text

View File

@ -218,6 +218,7 @@ function scrollbar:mousepressed(x, y, button)
self.clickx = x self.clickx = x
self.clicky = y self.clicky = y
self.dragging = true self.dragging = true
loveframes.hoverobject = self
end end

View File

@ -37,6 +37,18 @@ function scrollbutton:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -96,6 +108,7 @@ function scrollbutton:mousepressed(x, y, scrollbutton)
end end
self.down = true self.down = true
loveframes.hoverobject = self
end end

View File

@ -47,6 +47,18 @@ function sliderbutton:update(dt)
self:CheckHover() self:CheckHover()
if self.hover == false then
self.down = false
elseif self.hover == true then
if loveframes.hoverobject == self then
self.down = true
end
end
if self.down == false and loveframes.hoverobject == self then
self.hover = true
end
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx
@ -131,6 +143,8 @@ function sliderbutton:mousepressed(x, y, button)
self.dragging = true self.dragging = true
self.startx = self.staticx self.startx = self.staticx
self.clickx = x self.clickx = x
loveframes.hoverobject = self
end end
end end

View File

@ -26,8 +26,8 @@ function tabbutton:initialize(parent, text, tabnumber, tip, image)
self.image = nil self.image = nil
if tip then if tip then
local tooltip = tooltip:new(self, tip) self.tooltip = tooltip:new(self, tip)
tooltip:SetFollowCursor(false) self.tooltip:SetFollowCursor(false)
end end
if image then if image then
@ -121,6 +121,7 @@ function tabbutton:mousepressed(x, y, button)
end end
self.down = true self.down = true
loveframes.hoverobject = self
end end

View File

@ -259,8 +259,9 @@ function list:CalculateSize()
self.extra = self.itemheight - height self.extra = self.itemheight - height
if vbar == false then if vbar == false then
table.insert(self.internals, scrollbody:new(self, display)) local scrollbar = scrollbody:new(self, display)
self:GetScrollBar().autoscroll = self.autoscroll scrollbar.autoscroll = self.autoscroll
table.insert(self.internals, scrollbar)
self.vbar = true self.vbar = true
end end
@ -287,8 +288,9 @@ function list:CalculateSize()
self.extra = self.itemwidth - width self.extra = self.itemwidth - width
if hbar == false then if hbar == false then
table.insert(self.internals, scrollbody:new(self, display)) local scrollbar = scrollbody:new(self, display)
self:GetScrollBar().autoscroll = self.autoscroll scrollbar.autoscroll = self.autoscroll
table.insert(self.internals, scrollbar)
self.hbar = true self.hbar = true
end end
@ -501,7 +503,17 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:GetScrollBar() function list:GetScrollBar()
return self.internals[1].internals[1].internals[1] if self.vbar == true or self.hbar == true then
local scrollbar = self.internals[1].internals[1].internals[1]
return scrollbar
else
return false
end
end end

View File

@ -100,6 +100,7 @@ function multichoice:mousepressed(x, y, button)
self.haslist = true self.haslist = true
self.list = multichoicelist:new(self) self.list = multichoicelist:new(self)
loveframes.hoverobject = self
end end

View File

@ -25,6 +25,7 @@ function tabs:initialize()
self.tabheight = 25 self.tabheight = 25
self.autosize = true self.autosize = true
self.internal = false self.internal = false
self.tooltipfont = love.graphics.newFont(10)
self.tabs = {} self.tabs = {}
self.internals = {} self.internals = {}
self.children = {} self.children = {}
@ -404,4 +405,20 @@ function tabs:SetTabHeight(height)
end end
end
--[[---------------------------------------------------------
- func: SetToolTipFont(font)
- desc: sets the height of the tab buttons
--]]---------------------------------------------------------
function tabs:SetToolTipFont(font)
for k, v in ipairs(self.internals) do
if v.type == "tabbutton" and v.tooltip then
v.tooltip:SetFont(font)
end
end
end end

View File

@ -395,6 +395,14 @@ function textinput:GetTextCollisions(x, y)
break break
end end
if x < tx then
self:MoveBlinker(0, true)
end
if x > (tx + width) then
self:MoveBlinker(#self.text, true)
end
end end
end end