Version 0.9.4.12 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-12-30 16:31:49 -05:00
parent f8356fbd36
commit 069ed45963
10 changed files with 72 additions and 63 deletions

View File

@ -1,3 +1,9 @@
================================================
Version 0.9.4.12 - Alpha (December 30 - 2012)
================================================
[CHANGED] newlines created on the text object with \n now display properly
[CHANGED] Love Frames now resets the current drawing color to the last color used before calling loveframes.draw() after it has finished all drawing operations
================================================
Version 0.9.4.11 - Alpha (December 28 - 2012)
================================================

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info
loveframes.info = {}
loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.11"
loveframes.info.version = "0.9.4.12"
loveframes.info.stage = "Alpha"
-- library configurations
@ -99,11 +99,15 @@ end
function loveframes.draw()
local base = loveframes.base
local r, g, b, a = love.graphics.getColor()
base:draw()
loveframes.drawcount = 0
loveframes.debug.draw()
love.graphics.setColor(r, g, b, a)
end
--[[---------------------------------------------------------

View File

@ -75,7 +75,7 @@ function newobject:draw()
local visible = self.visible
if visible == false then
if not visible then
return
end

View File

@ -132,13 +132,10 @@ function newobject:mousepressed(x, y, button)
local internals = self.internals
if hover == true and button == "l" then
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
end
for k, v in ipairs(internals) do

View File

@ -158,8 +158,9 @@ function newobject:SetText(t)
elseif dtype == "number" then
table.insert(self.formattedtext, {color = prevcolor, text = tostring(v)})
elseif dtype == "string" then
if self.ignorenewlines == false then
v = v:gsub(string.char(92) .. string.char(110), string.char(10))
if self.ignorenewlines then
v = v:gsub(" \n ", " ")
v = v:gsub("\n", "")
end
v = v:gsub(string.char(9), " ")
local parts = loveframes.util.SplitString(v, " ")
@ -212,6 +213,8 @@ function newobject:SetText(t)
local drawx = 0
local drawy = 0
local lines = 0
local textwidth = 0
local lastwidth = 0
local totalwidth = 0
local x = self.x
local y = self.y
@ -240,7 +243,6 @@ function newobject:SetText(t)
twidth = twidth + width
drawx = drawx + prevtextwidth
end
else
twidth = twidth + width
end
@ -249,7 +251,20 @@ function newobject:SetText(t)
v.y = drawy
else
if k ~= 1 then
if string.byte(text) == 10 then
twidth = 0
drawx = 0
width = 0
drawy = drawy + height
text = ""
if lastwidth < textwidth then
lastwidth = textwidth
end
textwidth = 0
else
drawx = drawx + prevtextwidth
textwidth = textwidth + width
end
end
prevtextwidth = width
v.x = drawx
@ -258,10 +273,14 @@ function newobject:SetText(t)
end
end
if lastwidth == 0 then
textwidth = totalwidth
end
if maxw > 0 then
self.width = maxw
else
self.width = totalwidth
self.width = textwidth
end
self.height = drawy + height

View File

@ -156,35 +156,25 @@ function loveframes.templates.ApplyToObject(object)
-- loop through all available templates
for k, v in pairs(templates) do
-- make sure the base template doesn't get applied more than once
if k ~= "Base" then
local properties = v.properties
local hasall = loveframes.util.TableHasKey(properties, "*")
local hasobject = false
if not hasall then
hasobject = loveframes.util.TableHasKey(properties, type)
end
if hasall then
for k, v in pairs(properties["*"]) do
object[k] = v
end
elseif hasobject then
-- apply the template properties to the object
for k, v in pairs(properties[type]) do
object[k] = v
end
end
end
end
end
end
end

View File

@ -56,9 +56,7 @@ function loveframes.util.GetCollisions(object, t)
-- add the current object if colliding
if object.visible == true then
local col = loveframes.util.BoundingBox(x, object.x, y, object.y, 1, object.width, 1, object.height)
if col == true and object.collide ~= false then
if object.clickbounds then
local clickcol = loveframes.util.BoundingBox(x, object.clickbounds.x, y, object.clickbounds.y, 1, object.clickbounds.width, 1, object.clickbounds.height)
@ -69,29 +67,24 @@ function loveframes.util.GetCollisions(object, t)
table.insert(t, object)
end
end
end
-- check for children
if object.children then
for k, v in ipairs(object.children) do
if v.visible then
loveframes.util.GetCollisions(v, t)
end
end
end
-- check for internals
if object.internals then
for k, v in ipairs(object.internals) do
if v.visible and v.type ~= "tooltip" then
loveframes.util.GetCollisions(v, t)
end
end
end
return t