mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-26 05:14:21 +00:00
Version 0.9.4 - Alpha (see changelog.txt)
This commit is contained in:
parent
0e327e5d01
commit
851a7feb46
@ -1,6 +1,30 @@
|
|||||||
|
================================================
|
||||||
|
Version 0.9.4 - Alpha (October 22 - 2012)
|
||||||
|
================================================
|
||||||
|
[ADDED] a new base method: SetDrawOrder()
|
||||||
|
[ADDED] a new base method: GetDrawOrder()
|
||||||
|
[ADDED] a new text method: GetFormattedText()
|
||||||
|
[ADDED] a new text input method: SetEditable(bool)
|
||||||
|
[ADDED] a new text input method: GetEditable()
|
||||||
|
[ADDED] a new text input method: GetUsable()
|
||||||
|
[ADDED] a new text input method: GetUnusable()
|
||||||
|
[ADDED] a new system for creating and applying templates to objects
|
||||||
|
|
||||||
|
[FIXED] a few incorrent entries in the changelog and added a few entries that were meant to be in the last upadte's changelog
|
||||||
|
[FIXED] an error that occured when clicking on a frame that was parented to another frame
|
||||||
|
[FIXED] frames not being positioned properly if they were parented to another object
|
||||||
|
[FIXED] modal background object not drawing over umodaled objects in certain situations
|
||||||
|
[FIXED] an error that would occur when a multichoice list object would become scrollable
|
||||||
|
[FIXED] an error that would occur when a the column list object had no columns
|
||||||
|
[FIXED] multichoice object not positioning itself properly if it's parent was the base object
|
||||||
|
|
||||||
|
[CHANGED] text:GetText() now returns a string of the object's text
|
||||||
|
[CHANGED] parented frames can no longer be modaled
|
||||||
|
|
||||||
================================================
|
================================================
|
||||||
Version 0.9.3.2 - Alpha (Spetember 29 - 2012)
|
Version 0.9.3.2 - Alpha (Spetember 29 - 2012)
|
||||||
================================================
|
================================================
|
||||||
|
[ADDED] a new base method: SetDrawOrder()
|
||||||
[ADDED] a new text input method: SetMultiline(bool)
|
[ADDED] a new text input method: SetMultiline(bool)
|
||||||
[ADDED] a new text input method: GetVerticalScrollBody()
|
[ADDED] a new text input method: GetVerticalScrollBody()
|
||||||
[ADDED] a new text input method: GetHorizontalScrollBody()
|
[ADDED] a new text input method: GetHorizontalScrollBody()
|
||||||
@ -8,7 +32,6 @@ Version 0.9.3.2 - Alpha (Spetember 29 - 2012)
|
|||||||
[ADDED] a new text input method: HasVerticalScrollBar()
|
[ADDED] a new text input method: HasVerticalScrollBar()
|
||||||
[ADDED] a new text input method: HasHorizontalScrollBar()
|
[ADDED] a new text input method: HasHorizontalScrollBar()
|
||||||
[ADDED] a new text input method: GetFont()
|
[ADDED] a new text input method: GetFont()
|
||||||
[ADDED] a new text input method: GetTextColor()
|
|
||||||
[ADDED] a new text input method: GetLineNumbersPanel()
|
[ADDED] a new text input method: GetLineNumbersPanel()
|
||||||
[ADDED] a new text input method: GetMultiline()
|
[ADDED] a new text input method: GetMultiline()
|
||||||
[ADDED] a new text input method: GetTextX()
|
[ADDED] a new text input method: GetTextX()
|
||||||
@ -19,6 +42,7 @@ Version 0.9.3.2 - Alpha (Spetember 29 - 2012)
|
|||||||
[ADDED] a new text input method: GetOffsetY()
|
[ADDED] a new text input method: GetOffsetY()
|
||||||
[ADDED] a new text input method: GetIndicatorX()
|
[ADDED] a new text input method: GetIndicatorX()
|
||||||
[ADDED] a new text input method: GetIndicatorY()
|
[ADDED] a new text input method: GetIndicatorY()
|
||||||
|
[ADDED] a new text input method: SetLineNumbersEnabled(enabled)
|
||||||
[ADDED] a new text input method: GetLineNumbersEnabled()
|
[ADDED] a new text input method: GetLineNumbersEnabled()
|
||||||
[ADDED] a new text input method: GetItemWidth()
|
[ADDED] a new text input method: GetItemWidth()
|
||||||
[ADDED] a new text input method: GetItemHeight()
|
[ADDED] a new text input method: GetItemHeight()
|
||||||
@ -57,7 +81,6 @@ Version 0.9.3.2 - Alpha (Spetember 29 - 2012)
|
|||||||
[CHANGED] the column list row object's text is no longer drawn internally by the object and should now be draw within the object's skin drawing function
|
[CHANGED] the column list row object's text is no longer drawn internally by the object and should now be draw within the object's skin drawing function
|
||||||
|
|
||||||
[REMOVED] textinput:SetTextColor(color)
|
[REMOVED] textinput:SetTextColor(color)
|
||||||
[REMOVED] textinput:GetTextColor()
|
|
||||||
[REMOVED] columnlistrow:SetTextColor()
|
[REMOVED] columnlistrow:SetTextColor()
|
||||||
|
|
||||||
================================================
|
================================================
|
||||||
|
11
debug.lua
11
debug.lua
@ -13,7 +13,6 @@ local loremipsum =
|
|||||||
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.
|
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.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: draw()
|
- func: draw()
|
||||||
- desc: draws debug information
|
- desc: draws debug information
|
||||||
@ -29,7 +28,7 @@ function loveframes.debug.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cols = loveframes.util.GetCollisions()
|
local cols = loveframes.util.GetCollisions()
|
||||||
local topcol = cols[#cols] or {type = none, children = {}, x = 0, y = 0, width = 0, height = 0}
|
local topcol = {type = none, children = {}, x = 0, y = 0, width = 0, height = 0}
|
||||||
local objects = loveframes.util.GetAllObjects()
|
local objects = loveframes.util.GetAllObjects()
|
||||||
local author = loveframes.info.author
|
local author = loveframes.info.author
|
||||||
local version = loveframes.info.version
|
local version = loveframes.info.version
|
||||||
@ -39,6 +38,14 @@ function loveframes.debug.draw()
|
|||||||
local fps = love.timer.getFPS()
|
local fps = love.timer.getFPS()
|
||||||
local deltatime = love.timer.getDelta()
|
local deltatime = love.timer.getDelta()
|
||||||
|
|
||||||
|
-- set the top most collision object
|
||||||
|
for k, v in ipairs(cols) do
|
||||||
|
if v:IsTopCollision() then
|
||||||
|
topcol = v
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- font for debug text
|
-- font for debug text
|
||||||
love.graphics.setFont(font)
|
love.graphics.setFont(font)
|
||||||
|
|
||||||
|
25
init.lua
25
init.lua
@ -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.3.2"
|
loveframes.info.version = "0.9.4"
|
||||||
loveframes.info.stage = "Alpha"
|
loveframes.info.stage = "Alpha"
|
||||||
|
|
||||||
-- library configurations
|
-- library configurations
|
||||||
@ -20,9 +20,15 @@ loveframes.config["ACTIVESKIN"] = "Blue"
|
|||||||
loveframes.config["INDEXSKINIMAGES"] = true
|
loveframes.config["INDEXSKINIMAGES"] = true
|
||||||
loveframes.config["DEBUG"] = true
|
loveframes.config["DEBUG"] = true
|
||||||
|
|
||||||
|
-- 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)
|
||||||
|
|
||||||
@ -45,6 +51,7 @@ function loveframes.load()
|
|||||||
-- 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.GetDirContents(dir .. "/objects")
|
||||||
local skins = loveframes.util.GetDirContents(dir .. "/skins")
|
local skins = loveframes.util.GetDirContents(dir .. "/skins")
|
||||||
|
local templates = loveframes.util.GetDirContents(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
|
||||||
@ -53,6 +60,13 @@ function loveframes.load()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- loop through a list of all gui templates and require them
|
||||||
|
for k, v in ipairs(templates) do
|
||||||
|
if v.extension == "lua" then
|
||||||
|
require(v.path .. "/" ..v.name)
|
||||||
|
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
|
||||||
@ -118,8 +132,10 @@ function loveframes.mousereleased(x, y, button)
|
|||||||
|
|
||||||
object:mousereleased(x, y, button)
|
object:mousereleased(x, y, button)
|
||||||
|
|
||||||
|
-- reset the hover object
|
||||||
if button == "l" then
|
if button == "l" then
|
||||||
loveframes.hoverobject = false
|
loveframes.hoverobject = false
|
||||||
|
loveframes.selectedobject = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -149,7 +165,7 @@ function loveframes.keyreleased(key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: New(type, parent)
|
- func: Create(type, parent)
|
||||||
- desc: creates a new object or multiple new objects
|
- desc: creates a new object or multiple new objects
|
||||||
(based on the method used) and returns said
|
(based on the method used) and returns said
|
||||||
object or objects for further manipulation
|
object or objects for further manipulation
|
||||||
@ -160,12 +176,15 @@ function loveframes.Create(data, parent)
|
|||||||
|
|
||||||
-- make sure the object specified is valid
|
-- make sure the object specified is valid
|
||||||
if not _G[data] then
|
if not _G[data] then
|
||||||
error("Error creating object: Invalid object '" ..data.. "'.")
|
loveframes.util.Error("Error creating object: Invalid object '" ..data.. "'.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create the object
|
-- create the object
|
||||||
local object = _G[data]:new()
|
local object = _G[data]:new()
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(object)
|
||||||
|
|
||||||
-- if the object is a tooltip, return it and go no further
|
-- if the object is a tooltip, return it and go no further
|
||||||
if data == "tooltip" then
|
if data == "tooltip" then
|
||||||
return object
|
return object
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- base object
|
-- base object
|
||||||
base = class("base")
|
base = class("base")
|
||||||
base:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -14,7 +13,8 @@ base:include(loveframes.templates.default)
|
|||||||
function base:initialize()
|
function base:initialize()
|
||||||
|
|
||||||
-- width and height of the window
|
-- width and height of the window
|
||||||
local w, h = love.graphics.getWidth(), love.graphics.getHeight()
|
local w = love.graphics.getWidth()
|
||||||
|
local h = love.graphics.getHeight()
|
||||||
|
|
||||||
self.type = "base"
|
self.type = "base"
|
||||||
self.width = w
|
self.width = w
|
||||||
@ -51,8 +51,8 @@ function base:draw()
|
|||||||
|
|
||||||
local children = self.children
|
local children = self.children
|
||||||
|
|
||||||
loveframes.drawcount = loveframes.drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
for k, v in ipairs(children) do
|
for k, v in ipairs(children) do
|
||||||
v:draw()
|
v:draw()
|
||||||
@ -1013,3 +1013,24 @@ function base:GetType()
|
|||||||
return self.type
|
return self.type
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: SetDrawOrder()
|
||||||
|
- desc: sets the object's draw order
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function base:SetDrawOrder()
|
||||||
|
|
||||||
|
loveframes.drawcount = loveframes.drawcount + 1
|
||||||
|
self.draworder = loveframes.drawcount
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetDrawOrder()
|
||||||
|
- desc: sets the object's draw order
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function base:GetDrawOrder()
|
||||||
|
|
||||||
|
return self.draworder
|
||||||
|
|
||||||
|
end
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- button class
|
-- button class
|
||||||
button = class("button", base)
|
button = class("button", base)
|
||||||
button:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -94,8 +93,8 @@ function button:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -164,6 +163,27 @@ function button:mousereleased(x, y, button)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: keypressed(key)
|
||||||
|
- desc: called when the player presses a key
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function button:keypressed(key, unicode)
|
||||||
|
|
||||||
|
local visible = self.visible
|
||||||
|
|
||||||
|
if not visible then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local selectedobject = loveframes.selectedobject
|
||||||
|
local onclick = self.OnClick
|
||||||
|
|
||||||
|
if key == "return" and selectedobject == self then
|
||||||
|
onclick(self, 0, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: SetText(text)
|
- func: SetText(text)
|
||||||
- desc: sets the object's text
|
- desc: sets the object's text
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- checkbox class
|
-- checkbox class
|
||||||
checkbox = class("checkbox", base)
|
checkbox = class("checkbox", base)
|
||||||
checkbox:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -124,8 +123,8 @@ function checkbox:draw()
|
|||||||
local internals = self.internals
|
local internals = self.internals
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -200,6 +199,30 @@ function checkbox:mousereleased(x, y, button)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: keypressed(key)
|
||||||
|
- desc: called when the player presses a key
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function checkbox:keypressed(key, unicode)
|
||||||
|
|
||||||
|
local checked = self.checked
|
||||||
|
local onchanged = self.OnChanged
|
||||||
|
local selectedobject = loveframes.selectedobject
|
||||||
|
|
||||||
|
if key == "return" and selectedobject == self then
|
||||||
|
if checked then
|
||||||
|
self.checked = false
|
||||||
|
else
|
||||||
|
self.checked = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if onchanged then
|
||||||
|
onchanged(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: SetText(text)
|
- func: SetText(text)
|
||||||
- desc: sets the object's text
|
- desc: sets the object's text
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- collapsiblecategory class
|
-- collapsiblecategory class
|
||||||
collapsiblecategory = class("collapsiblecategory", base)
|
collapsiblecategory = class("collapsiblecategory", base)
|
||||||
collapsiblecategory:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -92,8 +91,8 @@ function collapsiblecategory:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- columnlist class
|
-- columnlist class
|
||||||
columnlist = class("columnlist", base)
|
columnlist = class("columnlist", base)
|
||||||
columnlist:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -94,8 +93,8 @@ function columnlist:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -183,8 +182,8 @@ function columnlist:AdjustColumns()
|
|||||||
local width = self.width
|
local width = self.width
|
||||||
local bar = self.internals[1].bar
|
local bar = self.internals[1].bar
|
||||||
|
|
||||||
if bar == true then
|
if bar then
|
||||||
width = width - 16
|
width = width - self.internals[1].internals[1].width
|
||||||
end
|
end
|
||||||
|
|
||||||
local children = self.children
|
local children = self.children
|
||||||
@ -244,11 +243,11 @@ function columnlist:GetColumnSize()
|
|||||||
|
|
||||||
local children = self.children
|
local children = self.children
|
||||||
local numchildren = #self.children
|
local numchildren = #self.children
|
||||||
|
|
||||||
|
if numchildren > 0 then
|
||||||
local column = self.children[1]
|
local column = self.children[1]
|
||||||
local colwidth = column.width
|
local colwidth = column.width
|
||||||
local colheight = column.height
|
local colheight = column.height
|
||||||
|
|
||||||
if numchildren > 0 then
|
|
||||||
return colwidth, colheight
|
return colwidth, colheight
|
||||||
else
|
else
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
-- frame class
|
-- frame class
|
||||||
frame = class("frame", base)
|
frame = class("frame", base)
|
||||||
frame:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -73,6 +73,7 @@ function frame:update(dt)
|
|||||||
local draworder = self.draworder
|
local draworder = self.draworder
|
||||||
local children = self.children
|
local children = self.children
|
||||||
local internals = self.internals
|
local internals = self.internals
|
||||||
|
local parent = self.parent
|
||||||
local update = self.Update
|
local update = self.Update
|
||||||
|
|
||||||
close:SetPos(self.width - 20, 4)
|
close:SetPos(self.width - 20, 4)
|
||||||
@ -80,9 +81,11 @@ function frame:update(dt)
|
|||||||
|
|
||||||
-- dragging check
|
-- dragging check
|
||||||
if dragging then
|
if dragging then
|
||||||
|
if parent == base then
|
||||||
self.x = x - self.clickx
|
self.x = x - self.clickx
|
||||||
self.y = y - self.clicky
|
self.y = y - self.clicky
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- if screenlocked then keep within screen
|
-- if screenlocked then keep within screen
|
||||||
if screenlocked == true then
|
if screenlocked == true then
|
||||||
@ -107,7 +110,7 @@ function frame:update(dt)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if modal == true then
|
if modal then
|
||||||
|
|
||||||
local tip = false
|
local tip = false
|
||||||
local key = 0
|
local key = 0
|
||||||
@ -132,6 +135,11 @@ function frame:update(dt)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if parent ~= base then
|
||||||
|
self.x = self.parent.x + self.staticx
|
||||||
|
self.y = self.parent.y + self.staticy
|
||||||
|
end
|
||||||
|
|
||||||
for k, v in ipairs(internals) do
|
for k, v in ipairs(internals) do
|
||||||
v:update(dt)
|
v:update(dt)
|
||||||
end
|
end
|
||||||
@ -169,8 +177,8 @@ function frame:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -206,13 +214,14 @@ function frame:mousepressed(x, y, button)
|
|||||||
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 internals = self.internals
|
local internals = self.internals
|
||||||
local children = self.children
|
local children = self.children
|
||||||
|
local dragging = self.dragging
|
||||||
|
|
||||||
if selfcol then
|
if selfcol then
|
||||||
|
|
||||||
local top = self:IsTopCollision()
|
local top = self:IsTopCollision()
|
||||||
|
|
||||||
-- initiate dragging if not currently dragging
|
-- initiate dragging if not currently dragging
|
||||||
if not self.dragging and top and button == "l" then
|
if not dragging and top and button == "l" then
|
||||||
if y < self.y + 25 and self.draggable then
|
if y < self.y + 25 and self.draggable then
|
||||||
self.clickx = x - self.x
|
self.clickx = x - self.x
|
||||||
self.clicky = y - self.y
|
self.clicky = y - self.y
|
||||||
@ -355,11 +364,23 @@ function frame:MakeTop()
|
|||||||
local base = loveframes.base
|
local base = loveframes.base
|
||||||
local basechildren = base.children
|
local basechildren = base.children
|
||||||
local numbasechildren = #basechildren
|
local numbasechildren = #basechildren
|
||||||
|
local parent = self.parent
|
||||||
|
|
||||||
|
-- check to see if the object's parent is not the base object
|
||||||
|
if parent ~= base then
|
||||||
|
local baseparent = self:GetBaseParent()
|
||||||
|
if baseparent.type == "frame" then
|
||||||
|
baseparent:MakeTop()
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check to see if the object is the only child of the base object
|
||||||
if numbasechildren == 1 then
|
if numbasechildren == 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- check to see if the object is already at the top
|
||||||
if basechildren[numbasechildren] == self then
|
if basechildren[numbasechildren] == self then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -374,8 +395,6 @@ function frame:MakeTop()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
basechildren[key]:mousepressed(x, y, "l")
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -387,6 +406,12 @@ function frame:SetModal(bool)
|
|||||||
|
|
||||||
local modalobject = loveframes.modalobject
|
local modalobject = loveframes.modalobject
|
||||||
local mbackground = self.modalbackground
|
local mbackground = self.modalbackground
|
||||||
|
local parent = self.parent
|
||||||
|
local base = loveframes.base
|
||||||
|
|
||||||
|
if parent ~= base then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
self.modal = bool
|
self.modal = bool
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- progressbar class
|
-- progressbar class
|
||||||
image = class("image", base)
|
image = class("image", base)
|
||||||
image:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -74,8 +73,8 @@ function image:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- imagebutton class
|
-- imagebutton class
|
||||||
imagebutton = class("imagebutton", base)
|
imagebutton = class("imagebutton", base)
|
||||||
imagebutton:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -95,8 +94,8 @@ function imagebutton:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- closebutton class
|
-- closebutton class
|
||||||
closebutton = class("closebutton", base)
|
closebutton = class("closebutton", base)
|
||||||
closebutton:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -21,6 +20,9 @@ function closebutton:initialize()
|
|||||||
self.down = false
|
self.down = false
|
||||||
self.OnClick = function() end
|
self.OnClick = function() end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -90,10 +92,9 @@ function closebutton:draw()
|
|||||||
local skin = skins[selfskin] or skins[skinindex]
|
local skin = skins[selfskin] or skins[skinindex]
|
||||||
local drawfunc = skin.DrawCloseButton or skins[defaultskin].DrawCloseButton
|
local drawfunc = skin.DrawCloseButton or skins[defaultskin].DrawCloseButton
|
||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- columnlistarea class
|
-- columnlistarea class
|
||||||
columnlistarea = class("columnlistarea", base)
|
columnlistarea = class("columnlistarea", base)
|
||||||
columnlistarea:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -31,6 +30,9 @@ function columnlistarea:initialize(parent)
|
|||||||
self.internals = {}
|
self.internals = {}
|
||||||
self.children = {}
|
self.children = {}
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -106,8 +108,8 @@ function columnlistarea:draw()
|
|||||||
local internals = self.internals
|
local internals = self.internals
|
||||||
local children = self.children
|
local children = self.children
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- columnlistrow class
|
-- columnlistrow class
|
||||||
columnlistrow = class("columnlistrow", base)
|
columnlistrow = class("columnlistrow", base)
|
||||||
columnlistrow:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -24,6 +23,9 @@ function columnlistrow:initialize(parent, data)
|
|||||||
self.internal = true
|
self.internal = true
|
||||||
self.columndata = data
|
self.columndata = data
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -80,8 +82,8 @@ function columnlistrow:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- columnlistheader class
|
-- columnlistheader class
|
||||||
columnlistheader = class("columnlistheader", base)
|
columnlistheader = class("columnlistheader", base)
|
||||||
columnlistheader:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -44,6 +43,9 @@ function columnlistheader:initialize(name, parent)
|
|||||||
self.parent.internals[1]:Sort(key, self.descending)
|
self.parent.internals[1]:Sort(key, self.descending)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -112,8 +114,8 @@ function columnlistheader:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- linenumberspanel class
|
-- linenumberspanel class
|
||||||
linenumberspanel = class("linenumberspanel", base)
|
linenumberspanel = class("linenumberspanel", base)
|
||||||
linenumberspanel:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -22,6 +21,9 @@ function linenumberspanel:initialize(parent)
|
|||||||
self.staticy = 0
|
self.staticy = 0
|
||||||
self.internal = true
|
self.internal = true
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -95,8 +97,8 @@ function linenumberspanel:draw()
|
|||||||
stencilfunc = function() love.graphics.rectangle("fill", self.parent.x, self.parent.y, self.width, self.parent.height - 16) end
|
stencilfunc = function() love.graphics.rectangle("fill", self.parent.x, self.parent.y, self.width, self.parent.height - 16) end
|
||||||
end
|
end
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
love.graphics.setStencil(stencilfunc)
|
love.graphics.setStencil(stencilfunc)
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- modalbackground class
|
-- modalbackground class
|
||||||
modalbackground = class("modalbackground", base)
|
modalbackground = class("modalbackground", base)
|
||||||
modalbackground:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -28,6 +27,9 @@ function modalbackground:initialize(object)
|
|||||||
self:Remove()
|
self:Remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -47,6 +49,15 @@ function modalbackground:update(dt)
|
|||||||
|
|
||||||
local object = self.object
|
local object = self.object
|
||||||
local update = self.Update
|
local update = self.Update
|
||||||
|
local base = loveframes.base
|
||||||
|
local basechildren = base.children
|
||||||
|
|
||||||
|
if #basechildren > 1 then
|
||||||
|
if basechildren[#basechildren - 1] ~= self then
|
||||||
|
self:Remove()
|
||||||
|
table.insert(basechildren, self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if not object:IsActive() then
|
if not object:IsActive() then
|
||||||
self:Remove()
|
self:Remove()
|
||||||
@ -78,8 +89,8 @@ function modalbackground:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- multichoicelist class
|
-- multichoicelist class
|
||||||
multichoicelist = class("multichoicelist", base)
|
multichoicelist = class("multichoicelist", base)
|
||||||
multichoicelist:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -26,7 +25,8 @@ function multichoicelist:initialize(object)
|
|||||||
self.spacing = self.list.listspacing
|
self.spacing = self.list.listspacing
|
||||||
self.offsety = 0
|
self.offsety = 0
|
||||||
self.offsetx = 0
|
self.offsetx = 0
|
||||||
self.extra = 0
|
self.extrawidth = 0
|
||||||
|
self.extraheight = 0
|
||||||
self.canremove = false
|
self.canremove = false
|
||||||
self.internal = true
|
self.internal = true
|
||||||
self.vbar = false
|
self.vbar = false
|
||||||
@ -39,7 +39,10 @@ function multichoicelist:initialize(object)
|
|||||||
self:AddItem(row)
|
self:AddItem(row)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(loveframes.base.children, self)
|
table.insert(loveframes.base.internals, self)
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,8 +136,8 @@ function multichoicelist:draw()
|
|||||||
local internals = self.internals
|
local internals = self.internals
|
||||||
local children = self.children
|
local children = self.children
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -307,7 +310,7 @@ function multichoicelist:CalculateSize()
|
|||||||
|
|
||||||
if self.itemheight > height then
|
if self.itemheight > height then
|
||||||
|
|
||||||
self.extra = self.itemheight - height
|
self.extraheight = self.itemheight - height
|
||||||
|
|
||||||
if not vbar then
|
if not vbar then
|
||||||
local scroll = scrollbody:new(self, "vertical")
|
local scroll = scrollbody:new(self, "vertical")
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- multichoicerow class
|
-- multichoicerow class
|
||||||
multichoicerow = class("multichoicerow", base)
|
multichoicerow = class("multichoicerow", base)
|
||||||
multichoicerow:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -22,6 +21,9 @@ function multichoicerow:initialize()
|
|||||||
self.down = false
|
self.down = false
|
||||||
self.canclick = false
|
self.canclick = false
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -88,10 +90,9 @@ function multichoicerow:draw()
|
|||||||
local skin = skins[selfskin] or skins[skinindex]
|
local skin = skins[selfskin] or skins[skinindex]
|
||||||
local drawfunc = skin.DrawMultiChoiceRow or skins[defaultskin].DrawMultiChoiceRow
|
local drawfunc = skin.DrawMultiChoiceRow or skins[defaultskin].DrawMultiChoiceRow
|
||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -147,6 +148,21 @@ function multichoicerow:mousereleased(x, y, button)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: keypressed(key)
|
||||||
|
- desc: called when the player presses a key
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function multichoicerow:keypressed(key, unicode)
|
||||||
|
|
||||||
|
local text = self.text
|
||||||
|
local selectedobject = loveframes.selectedobject
|
||||||
|
|
||||||
|
if key == "return" and selectedobject == self then
|
||||||
|
self.parent.list:SelectChoice(text)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: SetText(text)
|
- func: SetText(text)
|
||||||
- desc: sets the object's text
|
- desc: sets the object's text
|
||||||
|
@ -25,6 +25,9 @@ function scrollarea:initialize(parent, bartype)
|
|||||||
|
|
||||||
table.insert(self.internals, scrollbar:new(self, bartype))
|
table.insert(self.internals, scrollbar:new(self, bartype))
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -138,8 +141,8 @@ function scrollarea:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -42,6 +42,9 @@ function scrollbar:initialize(parent, bartype)
|
|||||||
self.height = self.parent.height
|
self.height = self.parent.height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -207,8 +210,8 @@ function scrollbar:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -88,6 +88,9 @@ function scrollbody:initialize(parent, bartype)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -150,8 +153,8 @@ function scrollbody:draw()
|
|||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
local internals = self.internals
|
local internals = self.internals
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- scrollbutton clas
|
-- scrollbutton clas
|
||||||
scrollbutton = class("scrollbutton", base)
|
scrollbutton = class("scrollbutton", base)
|
||||||
scrollbutton:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -21,6 +20,9 @@ function scrollbutton:initialize(scrolltype)
|
|||||||
self.internal = true
|
self.internal = true
|
||||||
self.OnClick = function() end
|
self.OnClick = function() end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -90,8 +92,8 @@ function scrollbutton:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- sliderbutton class
|
-- sliderbutton class
|
||||||
sliderbutton = class("sliderbutton", base)
|
sliderbutton = class("sliderbutton", base)
|
||||||
sliderbutton:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -28,6 +27,9 @@ function sliderbutton:initialize(parent)
|
|||||||
self.dragging = false
|
self.dragging = false
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -172,8 +174,8 @@ function sliderbutton:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- tabbutton class
|
-- tabbutton class
|
||||||
tabbutton = class("tabbutton", base)
|
tabbutton = class("tabbutton", base)
|
||||||
tabbutton:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -35,6 +34,9 @@ function tabbutton:initialize(parent, text, tabnumber, tip, image)
|
|||||||
self:SetImage(image)
|
self:SetImage(image)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
@ -93,8 +95,8 @@ function tabbutton:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- tooltip clas
|
-- tooltip clas
|
||||||
tooltip = class("tooltip", base)
|
tooltip = class("tooltip", base)
|
||||||
tooltip:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -35,6 +34,9 @@ function tooltip:initialize(object, text, width)
|
|||||||
self.text:SetWidth(width or 0)
|
self.text:SetWidth(width or 0)
|
||||||
self.text:SetPos(0, 0)
|
self.text:SetPos(0, 0)
|
||||||
|
|
||||||
|
-- apply template properties to the object
|
||||||
|
loveframes.templates.ApplyToObject(self)
|
||||||
|
|
||||||
table.insert(loveframes.base.internals, self)
|
table.insert(loveframes.base.internals, self)
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -139,8 +141,8 @@ function tooltip:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if show then
|
if show then
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- list class
|
-- list class
|
||||||
list = class("list", base)
|
list = class("list", base)
|
||||||
list:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -116,8 +115,8 @@ function list:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- multichoice class
|
-- multichoice class
|
||||||
multichoice = class("multichoice", base)
|
multichoice = class("multichoice", base)
|
||||||
multichoice:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -43,12 +42,13 @@ function multichoice:update(dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local parent = self.parent
|
local parent = self.parent
|
||||||
|
local base = loveframes.base
|
||||||
local update = self.Update
|
local update = self.Update
|
||||||
|
|
||||||
self:CheckHover()
|
self:CheckHover()
|
||||||
|
|
||||||
-- move to parent if there is a parent
|
-- move to parent if there is a parent
|
||||||
if parent then
|
if parent ~= base then
|
||||||
self.x = self.parent.x + self.staticx
|
self.x = self.parent.x + self.staticx
|
||||||
self.y = self.parent.y + self.staticy
|
self.y = self.parent.y + self.staticy
|
||||||
end
|
end
|
||||||
@ -80,8 +80,8 @@ function multichoice:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- panel class
|
-- panel class
|
||||||
panel = class("panel", base)
|
panel = class("panel", base)
|
||||||
panel:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -81,8 +80,8 @@ function panel:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- progressbar class
|
-- progressbar class
|
||||||
progressbar = class("progressbar", base)
|
progressbar = class("progressbar", base)
|
||||||
progressbar:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -143,8 +142,8 @@ function progressbar:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
-- Copyright (c) 2012 Kenny Shields --
|
-- Copyright (c) 2012 Kenny Shields --
|
||||||
--]]------------------------------------------------
|
--]]------------------------------------------------
|
||||||
|
|
||||||
-- text clas
|
-- slider class
|
||||||
slider = class("slider", base)
|
slider = class("slider", base)
|
||||||
slider:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -104,8 +103,8 @@ function slider:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- tabs class
|
-- tabs class
|
||||||
tabs = class("tabpanel", base)
|
tabs = class("tabpanel", base)
|
||||||
tabs:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -122,8 +121,8 @@ function tabs:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
-- note: the text wrapping of this object is
|
-- note: the text wrapping of this object is
|
||||||
experimental and not final
|
experimental and not final
|
||||||
--]]------------------------------------------------
|
--]]------------------------------------------------
|
||||||
|
|
||||||
-- text class
|
-- text class
|
||||||
text = class("text", base)
|
text = class("text", base)
|
||||||
text:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -24,7 +24,7 @@ function text:initialize()
|
|||||||
self.height = 5
|
self.height = 5
|
||||||
self.maxw = 0
|
self.maxw = 0
|
||||||
self.lines = 1
|
self.lines = 1
|
||||||
self.text = {}
|
self.formattedtext = {}
|
||||||
self.original = {}
|
self.original = {}
|
||||||
self.internal = false
|
self.internal = false
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ function text:draw()
|
|||||||
local draw = self.Draw
|
local draw = self.Draw
|
||||||
local drawcount = loveframes.drawcount
|
local drawcount = loveframes.drawcount
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if draw then
|
if draw then
|
||||||
draw(self)
|
draw(self)
|
||||||
@ -130,7 +130,8 @@ function text:SetText(t)
|
|||||||
local inserts = {}
|
local inserts = {}
|
||||||
local tdata, prevcolor
|
local tdata, prevcolor
|
||||||
|
|
||||||
self.text = {}
|
self.text = ""
|
||||||
|
self.formattedtext = {}
|
||||||
|
|
||||||
if dtype == "string" then
|
if dtype == "string" then
|
||||||
tdata = {t}
|
tdata = {t}
|
||||||
@ -157,7 +158,7 @@ function text:SetText(t)
|
|||||||
prevcolor = v
|
prevcolor = v
|
||||||
elseif dtype == "number" then
|
elseif dtype == "number" then
|
||||||
|
|
||||||
table.insert(self.text, {color = prevcolor, text = tostring(v)})
|
table.insert(self.formattedtext, {color = prevcolor, text = tostring(v)})
|
||||||
|
|
||||||
elseif dtype == "string" then
|
elseif dtype == "string" then
|
||||||
|
|
||||||
@ -167,7 +168,7 @@ function text:SetText(t)
|
|||||||
local parts = loveframes.util.SplitString(v, " ")
|
local parts = loveframes.util.SplitString(v, " ")
|
||||||
|
|
||||||
for i, j in ipairs(parts) do
|
for i, j in ipairs(parts) do
|
||||||
table.insert(self.text, {color = prevcolor, text = j})
|
table.insert(self.formattedtext, {color = prevcolor, text = j})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -176,7 +177,7 @@ function text:SetText(t)
|
|||||||
|
|
||||||
if maxw > 0 then
|
if maxw > 0 then
|
||||||
|
|
||||||
for k, v in ipairs(self.text) do
|
for k, v in ipairs(self.formattedtext) do
|
||||||
|
|
||||||
local data = v.text
|
local data = v.text
|
||||||
local width = font:getWidth(data)
|
local width = font:getWidth(data)
|
||||||
@ -186,7 +187,7 @@ function text:SetText(t)
|
|||||||
|
|
||||||
if width > maxw then
|
if width > maxw then
|
||||||
|
|
||||||
table.remove(self.text, k)
|
table.remove(self.formattedtext, k)
|
||||||
|
|
||||||
for n=1, #data do
|
for n=1, #data do
|
||||||
|
|
||||||
@ -219,10 +220,10 @@ function text:SetText(t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for k, v in ipairs(inserts) do
|
for k, v in ipairs(inserts) do
|
||||||
table.insert(self.text, v.key, {color = v.color, text = v.text})
|
table.insert(self.formattedtext, v.key, {color = v.color, text = v.text})
|
||||||
end
|
end
|
||||||
|
|
||||||
local textdata = self.text
|
local textdata = self.formattedtext
|
||||||
local maxw = self.maxw
|
local maxw = self.maxw
|
||||||
local font = self.font
|
local font = self.font
|
||||||
local height = font:getHeight("a")
|
local height = font:getHeight("a")
|
||||||
@ -242,6 +243,8 @@ function text:SetText(t)
|
|||||||
|
|
||||||
if type(text) == "string" then
|
if type(text) == "string" then
|
||||||
|
|
||||||
|
self.text = self.text .. text
|
||||||
|
|
||||||
local width = font:getWidth(text)
|
local width = font:getWidth(text)
|
||||||
totalwidth = totalwidth + width
|
totalwidth = totalwidth + width
|
||||||
|
|
||||||
@ -310,13 +313,23 @@ function text:GetText()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetFormattedText()
|
||||||
|
- desc: gets the object's formatted text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function text:GetFormattedText()
|
||||||
|
|
||||||
|
return self.formattedtext
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: Format()
|
- func: Format()
|
||||||
- desc: formats the text
|
- desc: formats the text
|
||||||
--]]---------------------------------------------------------
|
--]]---------------------------------------------------------
|
||||||
function text:DrawText()
|
function text:DrawText()
|
||||||
|
|
||||||
local textdata = self.text
|
local textdata = self.formattedtext
|
||||||
local font = self.font
|
local font = self.font
|
||||||
local x = self.x
|
local x = self.x
|
||||||
local y = self.y
|
local y = self.y
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
-- textinput class
|
-- textinput class
|
||||||
textinput = class("textinput", base)
|
textinput = class("textinput", base)
|
||||||
textinput:include(loveframes.templates.default)
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: initialize()
|
- func: initialize()
|
||||||
@ -54,6 +53,7 @@ function textinput:initialize()
|
|||||||
self.alltextselected = false
|
self.alltextselected = false
|
||||||
self.linenumbers = true
|
self.linenumbers = true
|
||||||
self.linenumberspanel = false
|
self.linenumberspanel = false
|
||||||
|
self.editable = true
|
||||||
self.internal = false
|
self.internal = false
|
||||||
self.OnEnter = nil
|
self.OnEnter = nil
|
||||||
self.OnTextChanged = nil
|
self.OnTextChanged = nil
|
||||||
@ -258,8 +258,8 @@ function textinput:draw()
|
|||||||
local vbar = self.vbar
|
local vbar = self.vbar
|
||||||
local hbar = self.hbar
|
local hbar = self.hbar
|
||||||
|
|
||||||
loveframes.drawcount = drawcount + 1
|
-- set the object's draw order
|
||||||
self.draworder = loveframes.drawcount
|
self:SetDrawOrder()
|
||||||
|
|
||||||
if vbar and hbar then
|
if vbar and hbar then
|
||||||
stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width - 16, self.height - 16) end
|
stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width - 16, self.height - 16) end
|
||||||
@ -460,6 +460,7 @@ function textinput:RunKey(key, unicode)
|
|||||||
local indicatornum = self.indicatornum
|
local indicatornum = self.indicatornum
|
||||||
local multiline = self.multiline
|
local multiline = self.multiline
|
||||||
local alltextselected = self.alltextselected
|
local alltextselected = self.alltextselected
|
||||||
|
local editable = self.editable
|
||||||
local ontextchanged = self.OnTextChanged
|
local ontextchanged = self.OnTextChanged
|
||||||
local onenter = self.OnEnter
|
local onenter = self.OnEnter
|
||||||
|
|
||||||
@ -526,6 +527,9 @@ function textinput:RunKey(key, unicode)
|
|||||||
|
|
||||||
-- key input checking system
|
-- key input checking system
|
||||||
if key == "backspace" then
|
if key == "backspace" then
|
||||||
|
if not editable then
|
||||||
|
return
|
||||||
|
end
|
||||||
local curindicatornum = self.indicatornum
|
local curindicatornum = self.indicatornum
|
||||||
if alltextselected then
|
if alltextselected then
|
||||||
self:Clear()
|
self:Clear()
|
||||||
@ -602,6 +606,10 @@ function textinput:RunKey(key, unicode)
|
|||||||
else
|
else
|
||||||
if unicode > 31 and unicode < 127 then
|
if unicode > 31 and unicode < 127 then
|
||||||
|
|
||||||
|
if not editable then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if alltextselected then
|
if alltextselected then
|
||||||
self.alltextselected = false
|
self.alltextselected = false
|
||||||
self:Clear()
|
self:Clear()
|
||||||
@ -1036,6 +1044,17 @@ function textinput:SetUsable(usable)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetUsable()
|
||||||
|
- desc: gets what characters can be used for the
|
||||||
|
object's text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function textinput:GetUsable()
|
||||||
|
|
||||||
|
return self.usable
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: SetUnusable(unusable)
|
- func: SetUnusable(unusable)
|
||||||
- desc: sets what characters can not be used for the
|
- desc: sets what characters can not be used for the
|
||||||
@ -1047,6 +1066,17 @@ function textinput:SetUnusable(unusable)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetUnusable()
|
||||||
|
- desc: gets what characters can not be used for the
|
||||||
|
object's text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function textinput:GetUnusable()
|
||||||
|
|
||||||
|
return self.unusable
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--[[---------------------------------------------------------
|
--[[---------------------------------------------------------
|
||||||
- func: Clear()
|
- func: Clear()
|
||||||
- desc: clears the object's text
|
- desc: clears the object's text
|
||||||
@ -1383,3 +1413,25 @@ function textinput:GetTabReplacement()
|
|||||||
return self.tabreplacement
|
return self.tabreplacement
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: SetEditable(bool)
|
||||||
|
- desc: sets whether or not the user can edit the
|
||||||
|
object's text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function textinput:SetEditable(bool)
|
||||||
|
|
||||||
|
self.editable = bool
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetEditable
|
||||||
|
- desc: gets whether or not the user can edit the
|
||||||
|
object's text
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function textinput:GetEditable()
|
||||||
|
|
||||||
|
return self.editable
|
||||||
|
|
||||||
|
end
|
@ -15,4 +15,4 @@ Created by Kenny Shields
|
|||||||
|
|
||||||
**Third Party Libraries**
|
**Third Party Libraries**
|
||||||
|
|
||||||
- middleclass: kikito
|
- middleclass: kikito - https://github.com/kikito/middleclass
|
17
skins.lua
17
skins.lua
@ -3,9 +3,16 @@
|
|||||||
-- Copyright (c) 2012 Kenny Shields --
|
-- Copyright (c) 2012 Kenny Shields --
|
||||||
--]]------------------------------------------------
|
--]]------------------------------------------------
|
||||||
|
|
||||||
|
-- skins library
|
||||||
loveframes.skins = {}
|
loveframes.skins = {}
|
||||||
|
|
||||||
|
-- available skins
|
||||||
loveframes.skins.available = {}
|
loveframes.skins.available = {}
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: Register(skin)
|
||||||
|
- desc: registers a skin
|
||||||
|
--]]---------------------------------------------------------
|
||||||
function loveframes.skins.Register(skin)
|
function loveframes.skins.Register(skin)
|
||||||
|
|
||||||
local name = skin.name
|
local name = skin.name
|
||||||
@ -18,23 +25,23 @@ function loveframes.skins.Register(skin)
|
|||||||
local indeximages = loveframes.config["INDEXSKINIMAGES"]
|
local indeximages = loveframes.config["INDEXSKINIMAGES"]
|
||||||
|
|
||||||
if name == "" or not name then
|
if name == "" or not name then
|
||||||
error("Could not register skin: Invalid or missing name data.")
|
loveframes.util.Error("Could not register skin: Invalid or missing name data.")
|
||||||
end
|
end
|
||||||
|
|
||||||
if author == "" or not author then
|
if author == "" or not author then
|
||||||
error("Could not register skin: Invalid or missing author data.")
|
loveframes.util.Error("Could not register skin: Invalid or missing author data.")
|
||||||
end
|
end
|
||||||
|
|
||||||
if version == "" or version == nil then
|
if version == "" or version == nil then
|
||||||
error("Could not register skin: Invalid or missing version data.")
|
loveframes.util.Error("Could not register skin: Invalid or missing version data.")
|
||||||
end
|
end
|
||||||
|
|
||||||
if namecheck then
|
if namecheck then
|
||||||
error("Could not register skin: A skin with the name '" ..name.. "' already exists.")
|
loveframes.util.Error("Could not register skin: A skin with the name '" ..name.. "' already exists.")
|
||||||
end
|
end
|
||||||
|
|
||||||
if not dircheck then
|
if not dircheck then
|
||||||
error("Could not register skin: Could not find a directory for skin '" ..name.. "'.")
|
loveframes.util.Error("Could not register skin: Could not find a directory for skin '" ..name.. "'.")
|
||||||
end
|
end
|
||||||
|
|
||||||
loveframes.skins.available[name] = skin
|
loveframes.skins.available[name] = skin
|
||||||
|
@ -335,7 +335,7 @@ function skin.DrawButton(object)
|
|||||||
local bordernohovercolor = skin.controls.button_border_down_color
|
local bordernohovercolor = skin.controls.button_border_down_color
|
||||||
local gradientcolor = {}
|
local gradientcolor = {}
|
||||||
|
|
||||||
if down == true then
|
if down then
|
||||||
|
|
||||||
-- button body
|
-- button body
|
||||||
love.graphics.setColor(unpack(bodydowncolor))
|
love.graphics.setColor(unpack(bodydowncolor))
|
||||||
@ -353,7 +353,7 @@ function skin.DrawButton(object)
|
|||||||
love.graphics.setColor(unpack(borderdowncolor))
|
love.graphics.setColor(unpack(borderdowncolor))
|
||||||
skin.OutlinedRectangle(x, y, width, height)
|
skin.OutlinedRectangle(x, y, width, height)
|
||||||
|
|
||||||
elseif hover == true then
|
elseif hover then
|
||||||
|
|
||||||
-- button body
|
-- button body
|
||||||
love.graphics.setColor(unpack(bodyhovercolor))
|
love.graphics.setColor(unpack(bodyhovercolor))
|
||||||
@ -770,8 +770,6 @@ function skin.DrawTabButton(object)
|
|||||||
imageheight = image:getHeight()
|
imageheight = image:getHeight()
|
||||||
end
|
end
|
||||||
|
|
||||||
print(tabnumber, ptabnumber)
|
|
||||||
|
|
||||||
if tabnumber == ptabnumber then
|
if tabnumber == ptabnumber then
|
||||||
|
|
||||||
-- button body
|
-- button body
|
||||||
@ -922,7 +920,7 @@ function skin.DrawMultiChoiceRow(object)
|
|||||||
|
|
||||||
love.graphics.setFont(font)
|
love.graphics.setFont(font)
|
||||||
|
|
||||||
if object.hover == true then
|
if object.hover then
|
||||||
love.graphics.setColor(unpack(bodyhovecolor))
|
love.graphics.setColor(unpack(bodyhovecolor))
|
||||||
love.graphics.rectangle("fill", x, y, width, height)
|
love.graphics.rectangle("fill", x, y, width, height)
|
||||||
love.graphics.setColor(unpack(texthovercolor))
|
love.graphics.setColor(unpack(texthovercolor))
|
||||||
|
@ -770,8 +770,6 @@ function skin.DrawTabButton(object)
|
|||||||
imageheight = image:getHeight()
|
imageheight = image:getHeight()
|
||||||
end
|
end
|
||||||
|
|
||||||
print(tabnumber, ptabnumber)
|
|
||||||
|
|
||||||
if tabnumber == ptabnumber then
|
if tabnumber == ptabnumber then
|
||||||
|
|
||||||
-- button body
|
-- button body
|
||||||
|
206
templates.lua
206
templates.lua
@ -3,29 +3,187 @@
|
|||||||
-- Copyright (c) 2012 Kenny Shields --
|
-- Copyright (c) 2012 Kenny Shields --
|
||||||
--]]------------------------------------------------
|
--]]------------------------------------------------
|
||||||
|
|
||||||
-- templates
|
-- templates library
|
||||||
loveframes.templates = {}
|
loveframes.templates = {}
|
||||||
|
|
||||||
-- default template
|
-- available templates
|
||||||
loveframes.templates.default =
|
loveframes.templates.available = {}
|
||||||
{
|
|
||||||
x = 0,
|
-- objects
|
||||||
y = 0,
|
loveframes.templates.objects = {}
|
||||||
width = 5,
|
|
||||||
height = 5,
|
--[[---------------------------------------------------------
|
||||||
staticx = 5,
|
- func: AddProperty(templatename, property, value)
|
||||||
staticy = 5,
|
- desc: creates a property within the specified template
|
||||||
draworder = 0,
|
and assigns it to the specified object
|
||||||
internal = false,
|
--]]---------------------------------------------------------
|
||||||
visible = true,
|
function loveframes.templates.AddProperty(templatename, object, property, value)
|
||||||
hover = false,
|
|
||||||
alwaysupdate = false,
|
-- display and error if name is nil or false
|
||||||
retainsize = false,
|
if not templatename then
|
||||||
calledmousefunc = false,
|
loveframes.util.Error("Could not create property: No template name given.")
|
||||||
skin = nil,
|
end
|
||||||
clickbounds = nil,
|
|
||||||
Draw = nil,
|
-- display and error if property is nil or false
|
||||||
Update = nil,
|
if not property then
|
||||||
OnMouseEnter = nil,
|
loveframes.util.Error("Could not create property: No property name given.")
|
||||||
OnMouseExit = nil,
|
end
|
||||||
}
|
|
||||||
|
-- display and error if value is nil or false
|
||||||
|
if not value then
|
||||||
|
loveframes.util.Error("Could not create property: No property value given.")
|
||||||
|
end
|
||||||
|
|
||||||
|
local templatename = tostring(templatename)
|
||||||
|
local property = tostring(property)
|
||||||
|
local templates = loveframes.templates.available
|
||||||
|
local template = templates[templatename]
|
||||||
|
|
||||||
|
-- display an error message if the property is not a string
|
||||||
|
if type(property) ~= "string" then
|
||||||
|
loveframes.util.Error("Could not create property: Property names must be strings.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- display an error message if the property is an empty string
|
||||||
|
if property == "" then
|
||||||
|
loveframes.util.Error("Could not create property: Property names must not be empty.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- display an error message if the template is invalid
|
||||||
|
if not template then
|
||||||
|
loveframes.util.Error("Could not add property '" ..property.. "' to template '" ..templatename.. "': Invalid template.")
|
||||||
|
end
|
||||||
|
|
||||||
|
local properties = template.properties
|
||||||
|
local object = properties[object]
|
||||||
|
|
||||||
|
if not object then
|
||||||
|
loveframes.util.Error("Could not add property '" ..property.. "' to template '" ..templatename.. "': Invalid object.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- create the property within the template
|
||||||
|
object[property] = value
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: Register(template)
|
||||||
|
- desc: registers a template
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function loveframes.templates.Register(template)
|
||||||
|
|
||||||
|
-- display and error message if template is nil or false
|
||||||
|
if not template then
|
||||||
|
loveframes.util.Error("Could not register template: Missing template argument.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- display an error message if template is not a table
|
||||||
|
if type(template) ~= "table" then
|
||||||
|
loveframes.util.Error("Could not register template: Template argument must be a table.")
|
||||||
|
end
|
||||||
|
|
||||||
|
local templates = loveframes.templates.available
|
||||||
|
local registeredobjects = loveframes.templates.objects
|
||||||
|
local name = template.name
|
||||||
|
local properties = template.properties
|
||||||
|
local objects = template.objects
|
||||||
|
local found = false
|
||||||
|
local foundall = false
|
||||||
|
|
||||||
|
-- display an error message if a template name was not given
|
||||||
|
if not name then
|
||||||
|
loveframes.util.Error("Could not register template: No template name given.")
|
||||||
|
end
|
||||||
|
|
||||||
|
if name == "Base" then
|
||||||
|
_G["base"]:include(template.properties["*"])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- insert the template into the available templates table
|
||||||
|
templates[name] = template
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: Get(name)
|
||||||
|
- desc: gets a template
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function loveframes.templates.Get(name)
|
||||||
|
|
||||||
|
-- display and error if name is nil or false
|
||||||
|
if not name then
|
||||||
|
loveframes.util.Error("Could not create property: No template name given.")
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = tostring(name)
|
||||||
|
local templates = loveframes.templates.available
|
||||||
|
local template = templates[name]
|
||||||
|
|
||||||
|
-- display an error message if the template is invalid
|
||||||
|
if not template then
|
||||||
|
loveframes.util.Error("Could not get template: Invalid template.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- return the template
|
||||||
|
return template
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: GetAvailable()
|
||||||
|
- desc: gets all available templates
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function loveframes.templates.GetAvailable()
|
||||||
|
|
||||||
|
-- available templates
|
||||||
|
local templates = loveframes.templates.available
|
||||||
|
|
||||||
|
-- return the templates
|
||||||
|
return templates
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: loveframes.templates.ApplyToObject(object)
|
||||||
|
- desc: applies the properties of registered templates
|
||||||
|
to an object
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function loveframes.templates.ApplyToObject(object)
|
||||||
|
|
||||||
|
local templates = loveframes.templates.GetAvailable()
|
||||||
|
local type = object.type
|
||||||
|
|
||||||
|
-- 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
|
1
templates/base.lua
Normal file
1
templates/base.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
--[[------------------------------------------------
-- Love Frames - A GUI library for LOVE --
-- Copyright (c) 2012 Kenny Shields --
--]]------------------------------------------------
--[[------------------------------------------------
-- note: This is the base template for all
Love Frames objects. You should not
edit or delete this template unless you
know what you are doing.
--]]------------------------------------------------
-- template table
local template = {}
-- template name
template.name = "Base"
-- template properties
template.properties = {}
template.properties["*"] =
{
x = 0,
y = 0,
width = 5,
height = 5,
staticx = 0,
staticy = 0,
draworder = 0,
internal = false,
visible = true,
hover = false,
alwaysupdate = false,
retainsize = false,
calledmousefunc = false,
skin = nil,
clickbounds = nil,
Draw = nil,
Update = nil,
OnMouseEnter = nil,
OnMouseExit = nil
}
-- register the template
loveframes.templates.Register(template)
|
47
util.lua
47
util.lua
@ -62,7 +62,7 @@ function loveframes.util.GetCollisions(object, t)
|
|||||||
if col == true and object.collide ~= false then
|
if col == true and object.collide ~= false then
|
||||||
if object.clickbounds 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)
|
local clickcol = loveframes.util.BoundingBox(x, object.clickbounds.x, y, object.clickbounds.y, 1, object.clickbounds.width, 1, object.clickbounds.height)
|
||||||
if clickcol == true then
|
if clickcol then
|
||||||
table.insert(t, object)
|
table.insert(t, object)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -72,22 +72,22 @@ function loveframes.util.GetCollisions(object, t)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check for internals
|
-- check for children
|
||||||
if object.internals then
|
if object.children then
|
||||||
|
|
||||||
for k, v in ipairs(object.internals) do
|
for k, v in ipairs(object.children) do
|
||||||
if v.visible == true and v.type ~= "tooltip" then
|
if v.visible then
|
||||||
loveframes.util.GetCollisions(v, t)
|
loveframes.util.GetCollisions(v, t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check for children
|
-- check for internals
|
||||||
if object.children then
|
if object.internals then
|
||||||
|
|
||||||
for k, v in ipairs(object.children) do
|
for k, v in ipairs(object.internals) do
|
||||||
if v.visible == true then
|
if v.visible and v.type ~= "tooltip" then
|
||||||
loveframes.util.GetCollisions(v, t)
|
loveframes.util.GetCollisions(v, t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -268,3 +268,32 @@ function loveframes.util.RemoveAll()
|
|||||||
loveframes.base.internals = {}
|
loveframes.base.internals = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: loveframes.util.TableHasKey(table, key)
|
||||||
|
- desc: checks to see if a table has a specific key
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function loveframes.util.TableHasKey(table, key)
|
||||||
|
|
||||||
|
local haskey = false
|
||||||
|
|
||||||
|
for k, v in pairs(table) do
|
||||||
|
if k == key then
|
||||||
|
haskey = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return haskey
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: loveframes.util.Error(message)
|
||||||
|
- desc: displays a formatted error message
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function loveframes.util.Error(message)
|
||||||
|
|
||||||
|
error("[Love Frames] " ..message)
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user