Version 0.9.3 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-09-01 20:56:32 -04:00
parent 92869bcd22
commit 138e335f82
38 changed files with 9723 additions and 9245 deletions

View File

@ -1,3 +1,48 @@
================================================
Version 0.9.3 - Alpha (Spetember 1 - 2012)
================================================
[ADDED] a new base method: GetParents()
[ADDED] a new base method: IsTopInternal()
[ADDED] a new base method: IsInternal()
[ADDED] a new base method: GetType()
[ADDED] a new checkbox method: GetFont()
[ADDED] a new checkbox method: GetBoxSize()
[ADDED] a new checkbox method: GetBoxWidth()
[ADDED] a new checkbox method: GetBoxHeight()
[ADDED] a new image method: GetImage()
[ADDED] a new image method: GetColor()
[ADDED] a new progressbar method: GetCompleted()
[ADDED] a new tabs method: GetTabNumber()
[ADDED] a new text method: GetLines()
[ADDED] a new text input method: SetLimit(limit)
[ADDED] a new text input method: SetUsable(usable)
[ADDED] a new text input method: SetUnusable(unusable)
[ADDED] a new text input method: Clear()
[ADDED] a new text input method: GetText()
[ADDED] support for line breaks in the text object (please refer to the wiki on how to format your text with line breaks)
[ADDED] more information to the debug overlay
[FIXED] tooltips and multichoice lists not functioning properly when a frame was modaled
[FIXED] the text object not moving it's base parent to the top when clicked if it's base parent was a frame
[FIXED] the list object not scrolling via the mouse wheel due to certain collision detection issues
[FIXED] tooltips flickering when in a hover state
[FIXED] slider calculation errors
[FIXED] skin.DrawRepeatingImage creating a new image every frame
[FIXED] checkbox text not scrolling properly when in a list
[FIXED] the collapsible category's object not scrolling properly when in a list
[FIXED] skins not assuming the drawing functions of the default skins if drawing functions in the active skin were missing
[FIXED] some objects not being removed
[FIXED] sliders not scrolling properly when in a list
[CHANGED] various code for a small cleanup
[CHANGED] tooltips from being children of the base object to internals of the base object
[CHANGED] tooltips from never being removed to being removed when their assigned object is removed
[CHANGED] tooltips are now not able to be assigned to the base object (this would cause an error due to the way the tooltip currently functions)
[CHANGED] the text object now positions it's text when SetText is called instead of positioning it's text every frame
[CHANGED] slider:SetMax(max), slider:SetMin(min) and slider:SetMinMax(min, max) now adjust the slider's value if the slider's value is out of the range specified
[CHANGED] loveframes.Create(data, parent) now activates an error screen if the object specified is invalid
================================================ ================================================
Version 0.9.2.5 - Alpha (June 1 - 2012) Version 0.9.2.5 - Alpha (June 1 - 2012)
================================================ ================================================

View File

@ -1,23 +1,22 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- debug library
loveframes.debug = {} loveframes.debug = {}
local font = love.graphics.newFont(10) local font = love.graphics.newFont(10)
local loremipsum = local loremipsum =
[[ [[
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 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.
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()
- desc: draws debug information
--]]---------------------------------------------------------
function loveframes.debug.draw() function loveframes.debug.draw()
-- get the current debug setting -- get the current debug setting
@ -29,10 +28,16 @@ function loveframes.debug.draw()
end end
local cols = loveframes.util.GetCollisions() local cols = loveframes.util.GetCollisions()
local numcols = #cols local topcol = cols[#cols] or {type = none, children = {}, x = 0, y = 0, width = 0, height = 0}
local topcol = cols[numcols] or {type = none, children = {}, x = 0, y = 0, width = 0, height = 0}
local bchildren = #loveframes.base.children
local objects = loveframes.util.GetAllObjects() local objects = loveframes.util.GetAllObjects()
local author = loveframes.info.author
local version = loveframes.info.version
local stage = loveframes.info.stage
local basedir = loveframes.config["DIRECTORY"]
local loveversion = love._version
local fps = love.timer.getFPS()
local deltatime = love.timer.getDelta()
-- font for debug text -- font for debug text
love.graphics.setFont(font) love.graphics.setFont(font)
@ -46,10 +51,10 @@ function loveframes.debug.draw()
love.graphics.print("Library Information", 15, 15) love.graphics.print("Library Information", 15, 15)
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
love.graphics.print("Author: " ..loveframes.info.author, 15, 30) love.graphics.print("Author: " ..author, 15, 30)
love.graphics.print("Version: " ..loveframes.info.version, 15, 40) love.graphics.print("Version: " ..version, 15, 40)
love.graphics.print("Stage: " ..loveframes.info.stage, 15, 50) love.graphics.print("Stage: " ..stage, 15, 50)
love.graphics.print("Base Directory: " ..loveframes.config["DIRECTORY"], 15, 60) love.graphics.print("Base Directory: " ..basedir, 15, 60)
-- object information box -- object information box
love.graphics.setColor(0, 0, 0, 50) love.graphics.setColor(0, 0, 0, 50)
@ -59,7 +64,7 @@ function loveframes.debug.draw()
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
if numcols > 0 then if #cols > 0 then
love.graphics.print("Type: " ..topcol.type, 15, 100) love.graphics.print("Type: " ..topcol.type, 15, 100)
else else
love.graphics.print("Type: none", 10, 100) love.graphics.print("Type: none", 10, 100)
@ -71,10 +76,16 @@ function loveframes.debug.draw()
love.graphics.print("# of children: 0", 15, 110) love.graphics.print("# of children: 0", 15, 110)
end end
love.graphics.print("X: " ..topcol.x, 15, 120) if topcol.internals then
love.graphics.print("Y: " ..topcol.y, 15, 130) love.graphics.print("# of internals: " .. #topcol.internals, 15, 120)
love.graphics.print("Width: " ..topcol.width, 15, 140) else
love.graphics.print("Height: " ..topcol.height, 15, 150) love.graphics.print("# of internals: 0", 15, 120)
end
love.graphics.print("X: " ..topcol.x, 15, 130)
love.graphics.print("Y: " ..topcol.y, 15, 140)
love.graphics.print("Width: " ..topcol.width, 15, 150)
love.graphics.print("Height: " ..topcol.height, 15, 160)
-- Miscellaneous box -- Miscellaneous box
love.graphics.setColor(0, 0, 0, 50) love.graphics.setColor(0, 0, 0, 50)
@ -84,9 +95,9 @@ function loveframes.debug.draw()
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
love.graphics.print("LOVE Version: " ..love._version, 15, 210) love.graphics.print("LOVE Version: " ..loveversion, 15, 210)
love.graphics.print("FPS: " ..love.timer.getFPS(), 15, 220) love.graphics.print("FPS: " ..fps, 15, 220)
love.graphics.print("Delta Time: " ..love.timer.getDelta(), 15, 230) love.graphics.print("Delta Time: " ..deltatime, 15, 230)
love.graphics.print("Total Objects: " ..#objects, 15, 240) love.graphics.print("Total Objects: " ..#objects, 15, 240)
-- outline the object that the mouse is hovering over -- outline the object that the mouse is hovering over
@ -96,6 +107,11 @@ function loveframes.debug.draw()
end end
--[[---------------------------------------------------------
- func: ExamplesMenu()
- desc: generates a list of examples of LÖVE Frames
objects
--]]---------------------------------------------------------
function loveframes.debug.ExamplesMenu() function loveframes.debug.ExamplesMenu()
------------------------------------ ------------------------------------
@ -159,7 +175,6 @@ function loveframes.debug.ExamplesMenu()
local checkbox1 = loveframes.Create("checkbox", frame1) local checkbox1 = loveframes.Create("checkbox", frame1)
checkbox1:SetText("Checkbox 1") checkbox1:SetText("Checkbox 1")
checkbox1:SetPos(5, 30) checkbox1:SetPos(5, 30)
--checkbox1:SetFont(love.graphics.newFont(50))
checkbox1.OnChanged = function(object2) checkbox1.OnChanged = function(object2)
end end
@ -260,6 +275,7 @@ function loveframes.debug.ExamplesMenu()
end end
end end
end end
end end
exampleslist:AddItem(frameexample) exampleslist:AddItem(frameexample)
@ -598,12 +614,19 @@ function loveframes.debug.ExamplesMenu()
local textinput1 = loveframes.Create("textinput", frame1) local textinput1 = loveframes.Create("textinput", frame1)
textinput1:SetPos(5, 30) textinput1:SetPos(5, 30)
textinput1:SetWidth(490) textinput1:SetWidth(490)
textinput1.OnEnter = function(object)
object:Clear()
end
end end
exampleslist:AddItem(textinputexample) exampleslist:AddItem(textinputexample)
end end
--[[---------------------------------------------------------
- func: SkinSelector()
- desc: opens a skin selector menu
--]]---------------------------------------------------------
function loveframes.debug.SkinSelector() function loveframes.debug.SkinSelector()
local skins = loveframes.skins.available local skins = loveframes.skins.available

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- central library table -- central library table
@ -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.2.5" loveframes.info.version = "0.9.3"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations
@ -23,6 +23,8 @@ loveframes.config["DEBUG"] = true
loveframes.drawcount = 0 loveframes.drawcount = 0
loveframes.hoverobject = false loveframes.hoverobject = false
loveframes.modalobject = false loveframes.modalobject = false
loveframes.basicfont = love.graphics.newFont(12)
loveframes.basicfontsmall = love.graphics.newFont(10)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: load() - func: load()
@ -156,15 +158,23 @@ function loveframes.Create(data, parent)
if type(data) == "string" then if type(data) == "string" then
-- create the new object -- make sure the object specified is valid
if not _G[data] then
error("Error creating object: Invalid object '" ..data.. "'.")
end
-- create the object
local object = _G[data]:new() local object = _G[data]:new()
if object.internal == true then -- if the object is a tooltip, return it and go no further
if object.type == "tooltip" then if data == "tooltip" then
object = tooltip:new() return object
else
return
end end
-- remove the object if it is an internal
if object.internal == true then
object:Remove()
return
end end
-- parent the new object by default to the base gui object -- parent the new object by default to the base gui object

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- base object -- base object
@ -21,6 +21,7 @@ function base:initialize()
self.height = h self.height = h
self.internal = true self.internal = true
self.children = {} self.children = {}
self.internals = {}
end end
@ -36,6 +37,10 @@ function base:update(dt)
v:update(dt) v:update(dt)
end end
for k, v in ipairs(self.internals) do
v:update(dt)
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
@ -53,6 +58,10 @@ function base:draw()
v:draw() v:draw()
end end
for k, v in ipairs(self.internals) do
v:draw()
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
@ -508,6 +517,8 @@ function base:Remove()
end end
self.removed = true
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
@ -683,7 +694,7 @@ function base:CheckHover()
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent ~= modalobject then if baseparent ~= modalobject and self.type ~= "multichoice-row" then
self.hover = false self.hover = false
@ -767,13 +778,16 @@ function base:IsTopList()
local function IsChild(object) local function IsChild(object)
for k, v in ipairs(children) do local parents = object:GetParents()
if v == object then
for k, v in ipairs(parents) do
if v == self then
return true return true
end end
end end
return false return false
end end
for k, v in ipairs(cols) do for k, v in ipairs(cols) do
@ -823,9 +837,23 @@ end
function base:MoveToTop() function base:MoveToTop()
local pchildren = self.parent.children local pchildren = self.parent.children
local pinternals = self.parent.internals
local internal = false
for k, v in ipairs(pinternals) do
if v == self then
internal = true
end
end
self:Remove() self:Remove()
if internal == true then
table.insert(pinternals, self)
else
table.insert(pchildren, self) table.insert(pchildren, self)
end
end end
@ -926,3 +954,70 @@ function base:IsActive()
return valid return valid
end end
--[[---------------------------------------------------------
- func: GetParents()
- desc: returns a table of the object's parents and it's
sub-parents
--]]---------------------------------------------------------
function base:GetParents()
local function GetParents(object, t)
local t = t or {}
local type = object.type
local parent = object.parent
if type ~= "base" then
table.insert(t, parent)
GetParents(parent, t)
end
return t
end
local parents = GetParents(self)
return parents
end
--[[---------------------------------------------------------
- func: IsTopInternal()
- desc: returns true if the object is the top most
internal in it's parent's internals table or
false if not
--]]---------------------------------------------------------
function base:IsTopInternal()
local internals = self.parent.internals
if internals[#internals] ~= self then
return false
else
return true
end
end
--[[---------------------------------------------------------
- func: IsInternal()
- desc: returns true if the object is internal or
false if not
--]]---------------------------------------------------------
function base:IsInternal()
return self.internal
end
--[[---------------------------------------------------------
- func: GetType()
- desc: gets the type of the object
--]]---------------------------------------------------------
function base:GetType()
return self.type
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- button clas -- button clas
@ -82,11 +82,12 @@ function button:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawButton or skins[defaultskin].DrawButton
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -94,7 +95,7 @@ function button:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawButton(self) drawfunc(self)
end end
end end

View File

@ -1,9 +1,9 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- button clas -- checkbox class
checkbox = class("checkbox", base) checkbox = class("checkbox", base)
checkbox:include(loveframes.templates.default) checkbox:include(loveframes.templates.default)
@ -18,7 +18,7 @@ function checkbox:initialize()
self.height = 0 self.height = 0
self.boxwidth = 20 self.boxwidth = 20
self.boxheight = 20 self.boxheight = 20
self.font = love.graphics.newFont(12) self.font = loveframes.basicfont
self.checked = false self.checked = false
self.lastvalue = false self.lastvalue = false
self.internal = false self.internal = false
@ -58,7 +58,7 @@ function checkbox:update(dt)
end 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 and self.parent.type ~= "list" 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
@ -106,11 +106,12 @@ function checkbox:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawCheckBox or skins[defaultskin].DrawCheckBox
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -118,7 +119,7 @@ function checkbox:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawCheckBox(self) drawfunc(self)
end end
for k, v in ipairs(self.internals) do for k, v in ipairs(self.internals) do
@ -311,3 +312,43 @@ function checkbox:SetFont(font)
end end
end end
--[[---------------------------------------------------------
- func: checkbox:GetFont()
- desc: gets the font of the object's text
--]]---------------------------------------------------------
function checkbox:GetFont()
return self.font
end
--[[---------------------------------------------------------
- func: checkbox:GetBoxHeight()
- desc: gets the object's box size
--]]---------------------------------------------------------
function checkbox:GetBoxSize()
return self.boxwidth, self.boxheight
end
--[[---------------------------------------------------------
- func: checkbox:GetBoxWidth()
- desc: gets the object's box width
--]]---------------------------------------------------------
function checkbox:GetBoxWidth()
return self.boxwidth
end
--[[---------------------------------------------------------
- func: checkbox:GetBoxHeight()
- desc: gets the object's box height
--]]---------------------------------------------------------
function checkbox:GetBoxHeight()
return self.boxheight
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- button clas -- button clas
@ -49,16 +49,14 @@ function collapsiblecategory:update(dt)
self:CheckHover() self:CheckHover()
-- 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 and self.parent.type ~= "list" 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
if open == true then if open == true then
curobject:update(dt)
curobject:SetWidth(self.width - self.padding*2) curobject:SetWidth(self.width - self.padding*2)
curobject.y = (curobject.parent.y + curobject.staticy) curobject:update(dt)
curobject.x = (curobject.parent.x + curobject.staticx)
end end
if self.Update then if self.Update then
@ -82,12 +80,12 @@ function collapsiblecategory:draw()
local open = self.open local open = self.open
local children = self.children local children = self.children
local curobject = children[1] local curobject = children[1]
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawCollapsibleCategory or skins[defaultskin].DrawCollapsibleCategory
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -95,7 +93,7 @@ function collapsiblecategory:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawCollapsibleCategory(self) drawfunc(self)
end end
if open == true then if open == true then

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlist object -- columnlist object
@ -85,17 +85,20 @@ function columnlist:draw()
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawColumnList or skins[defaultskin].DrawColumnList
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawColumnList(self) drawfunc(self)
end end
for k, v in ipairs(internals) do for k, v in ipairs(internals) do

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- frame class -- frame class
@ -75,7 +75,7 @@ function frame:update(dt)
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
close:SetPos(self.width - 22, 4) close:SetPos(self.width - 20, 4)
self:CheckHover() self:CheckHover()
-- dragging check -- dragging check
@ -107,17 +107,25 @@ function frame:update(dt)
if modal == true then if modal == true then
local numtooltips = 0 local tip = false
local key = 0
for k, v in ipairs(basechildren) do for k, v in ipairs(basechildren) do
if v.type == "tooltip" then if v.type == "tooltip" and v.show == true then
numtooltips = numtooltips + 1 tip = v
key = k
end end
end end
if draworder ~= numbasechildren - numtooltips then if tip ~= false then
self.modalbackground:MoveToTop() self:Remove()
self:MoveToTop() self.modalbackground:Remove()
table.insert(basechildren, key - 2, self.modalbackground)
table.insert(basechildren, key - 1, self)
end
if self.modalbackground.draworder > self.draworder then
self:MakeTop()
end end
end end
@ -150,12 +158,12 @@ function frame:draw()
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawFrame or skins[defaultskin].DrawFrame
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -163,7 +171,7 @@ function frame:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawFrame(self) drawfunc(self)
end end
for k, v in ipairs(internals) do for k, v in ipairs(internals) do

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- progress bar class -- progress bar class
@ -61,11 +61,12 @@ function image:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawImage or skins[defaultskin].DrawImage
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -73,7 +74,7 @@ function image:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawImage(self) drawfunc(self)
end end
end end
@ -95,6 +96,16 @@ function image:SetImage(image)
end end
--[[---------------------------------------------------------
- func: GetImage()
- desc: gets the object's image
--]]---------------------------------------------------------
function image:GetImage()
return self.image
end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetColor(table) - func: SetColor(table)
- desc: sets the object's color - desc: sets the object's color
@ -104,3 +115,13 @@ function image:SetColor(data)
self.imagecolor = data self.imagecolor = data
end end
--[[---------------------------------------------------------
- func: GetColor()
- desc: gets the object's color
--]]---------------------------------------------------------
function image:GetColor()
return self.imagecolor
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- imagebutton clas -- imagebutton clas
@ -83,19 +83,20 @@ function imagebutton:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawImageButton or skins[defaultskin].DrawImageButton
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawImageButton(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- closebutton clas -- closebutton clas
@ -80,19 +80,20 @@ function closebutton:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawCloseButton or skins[defaultskin].DrawCloseButton
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawCloseButton(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlistarea object -- columnlistarea object
@ -88,28 +88,24 @@ function columnlistarea:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
self.draworder = loveframes.drawcount local stencil = love.graphics.newStencil(stencilfunc)
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawColumnListArea or skins[defaultskin].DrawColumnListArea
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawColumnListArea(self) drawfunc(self)
end end
for k, v in ipairs(self.internals) do
v:draw()
end
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local stencil = love.graphics.newStencil(stencilfunc)
love.graphics.setStencil(stencil) love.graphics.setStencil(stencil)
for k, v in ipairs(self.children) do for k, v in ipairs(self.children) do
@ -121,6 +117,10 @@ function columnlistarea:draw()
love.graphics.setStencil() love.graphics.setStencil()
for k, v in ipairs(self.internals) do
v:draw()
end
if self.Draw == nil then if self.Draw == nil then
skin.DrawOverColumnListArea(self) skin.DrawOverColumnListArea(self)
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlistrow object -- columnlistrow object
@ -16,7 +16,7 @@ function columnlistrow:initialize(parent, data)
self.type = "columnlistrow" self.type = "columnlistrow"
self.parent = parent self.parent = parent
self.colorindex = self.parent.rowcolorindex self.colorindex = self.parent.rowcolorindex
self.font = love.graphics.newFont(10) self.font = loveframes.basicfontsmall
self.textcolor = {0, 0, 0, 255} self.textcolor = {0, 0, 0, 255}
self.width = 80 self.width = 80
self.height = 25 self.height = 25
@ -68,25 +68,25 @@ function columnlistrow:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local cwidth, cheight = self:GetParent():GetParent():GetColumnSize()
self.draworder = loveframes.drawcount local x = self.textx
local textcolor = self.textcolor
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawColumnListRow or skins[defaultskin].DrawColumnListRow
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawColumnListRow(self) drawfunc(self)
end end
local cwidth, cheight = self:GetParent():GetParent():GetColumnSize()
local x = self.textx
local textcolor = self.textcolor
for k, v in ipairs(self.columndata) do for k, v in ipairs(self.columndata) do
love.graphics.setFont(self.font) love.graphics.setFont(self.font)
love.graphics.setColor(unpack(textcolor)) love.graphics.setColor(unpack(textcolor))

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlistheader object -- columnlistheader object
@ -99,19 +99,20 @@ function columnlistheader:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawColumnListHeader or skins[defaultskin].DrawColumnListHeader
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawColumnListHeader(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- modalbackground class -- modalbackground class
@ -68,11 +68,12 @@ function modalbackground:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawModalBackground or skins[defaultskin].DrawModalBackground
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -80,7 +81,7 @@ function modalbackground:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawModalBackground(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- multichoicelist class -- multichoicelist class
@ -111,23 +111,29 @@ function multichoicelist:draw()
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
-- skin variables local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local index = loveframes.config["ACTIVESKIN"] local stencil = love.graphics.newStencil(stencilfunc)
local skins = loveframes.skins.available
local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawMultiChoiceList or skins[defaultskin].DrawMultiChoiceList
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawMultiChoiceList(self) drawfunc(self)
end end
for k, v in ipairs(self.internals) do for k, v in ipairs(self.internals) do
v:draw() v:draw()
end end
love.graphics.setScissor(self.x, self.y, self.width, self.height) love.graphics.setStencil(stencil)
for k, v in ipairs(self.children) do for k, v in ipairs(self.children) do
local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, self.width, v.width, self.height, v.height) local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, self.width, v.width, self.height, v.height)
@ -136,9 +142,11 @@ function multichoicelist:draw()
end end
end end
love.graphics.setScissor() love.graphics.setStencil()
if self.Draw == nil and skin.DrawOverMultiChoiceList then
skin.DrawOverMultiChoiceList(self) skin.DrawOverMultiChoiceList(self)
end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- multichoicerow class -- multichoicerow class
@ -77,19 +77,20 @@ function multichoicerow:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawMultiChoiceRow or skins[defaultskin].DrawMultiChoiceRow
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawMultiChoiceRow(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbar class -- scrollbar class
@ -125,12 +125,12 @@ function scrollarea:draw()
end end
local internals = self.internals local internals = self.internals
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawScrollArea or skins[defaultskin].DrawScrollArea
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -138,7 +138,7 @@ function scrollarea:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawScrollArea(self) drawfunc(self)
end end
for k, v in ipairs(internals) do for k, v in ipairs(internals) do

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbar class -- scrollbar class
@ -199,11 +199,12 @@ function scrollbar:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawScrollBar or skins[defaultskin].DrawScrollBar
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -211,7 +212,7 @@ function scrollbar:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawScrollBar(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbar class -- scrollbar class
@ -130,11 +130,12 @@ function scrollbody:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawScrollBody or skins[defaultskin].DrawScrollBody
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -142,7 +143,7 @@ function scrollbody:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawScrollBody(self) drawfunc(self)
end end
for k, v in ipairs(self.internals) do for k, v in ipairs(self.internals) do

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbutton clas -- scrollbutton clas
@ -71,19 +71,20 @@ function scrollbutton:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawScrollButton or skins[defaultskin].DrawScrollButton
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawScrollButton(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- closebutton clas -- closebutton clas
@ -51,7 +51,7 @@ function sliderbutton:update(dt)
local intervals = self.intervals local intervals = self.intervals
local progress = 0 local progress = 0
local nvalue = 0 local nvalue = 0
local pvalue = 0 local pvalue = self.parent.value
local hover = self.hover local hover = self.hover
local down = self.down local down = self.down
local hoverobject = loveframes.hoverobject local hoverobject = loveframes.hoverobject
@ -77,56 +77,69 @@ function sliderbutton:update(dt)
self.y = self.parent.y + self.staticy self.y = self.parent.y + self.staticy
end end
-- start calculations if the button is being dragged
if dragging == true then
-- calculations for horizontal sliders
if slidetype == "horizontal" then if slidetype == "horizontal" then
if dragging == true then
self.staticx = self.startx + (x - self.clickx) self.staticx = self.startx + (x - self.clickx)
end
if (self.staticx + self.width) > self.parent.width then progress = self.staticx/(self.parent.width - self.width)
self.staticx = self.parent.width - self.width
end
if self.staticx < 0 then
self.staticx = 0
end
progress = loveframes.util.Round(self.staticx/(self.parent.width - self.width), 5)
nvalue = self.parent.min + (self.parent.max - self.parent.min) * progress nvalue = self.parent.min + (self.parent.max - self.parent.min) * progress
pvalue = self.parent.value nvalue = loveframes.util.Round(nvalue, self.parent.decimals)
-- calculations for vertical sliders
elseif slidetype == "vertical" then elseif slidetype == "vertical" then
if dragging == true then
self.staticy = self.starty + (y - self.clicky) self.staticy = self.starty + (y - self.clicky)
end
if (self.staticy + self.height) > self.parent.height then
self.staticy = self.parent.height - self.height
end
if self.staticy < 0 then
self.staticy = 0
end
local space = self.parent.height - self.height local space = self.parent.height - self.height
local remaining = (self.parent.height - self.height) - self.staticy local remaining = (self.parent.height - self.height) - self.staticy
local percent = loveframes.util.Round(remaining/space, 5) local percent = remaining/space
nvalue = self.parent.min + (self.parent.max - self.parent.min) * percent nvalue = self.parent.min + (self.parent.max - self.parent.min) * percent
pvalue = self.parent.value nvalue = loveframes.util.Round(nvalue, self.parent.decimals)
end end
if nvalue ~= pvalue then --
self.parent.value = loveframes.util.Round(nvalue, self.parent.decimals) if nvalue > self.parent.max then
nvalue = self.parent.max
end
if nvalue < self.parent.min then
nvalue = self.parent.min
end
self.parent.value = nvalue
if nvalue ~= pvalue and nvalue >= self.parent.min and nvalue <= self.parent.max then
if self.parent.OnValueChanged then if self.parent.OnValueChanged then
self.parent.OnValueChanged(self.parent, self.parent.value) self.parent.OnValueChanged(self.parent, self.parent.value)
end end
end end
if dragging == true then
loveframes.hoverobject = self loveframes.hoverobject = self
end
if slidetype == "horizontal" then
if (self.staticx + self.width) > self.parent.width then
self.staticx = self.parent.width - self.width
end
if self.staticx < 0 then
self.staticx = 0
end
end
if slidetype == "vertical" then
if (self.staticy + self.height) > self.parent.height then
self.staticy = self.parent.height - self.height
end
if self.staticy < 0 then
self.staticy = 0
end
end end
if self.Update then if self.Update then
@ -147,19 +160,20 @@ function sliderbutton:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawSliderButton or skins[defaultskin].DrawSliderButton
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawSliderButton(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- tabbutton clas -- tabbutton clas
@ -77,25 +77,25 @@ function tabbutton:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local font = love.graphics.getFont()
self.draworder = loveframes.drawcount local width = font:getWidth(self.text)
local image = self.image
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawTabButton or skins[defaultskin].DrawTabButton
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawTabButton(self) drawfunc(self)
end end
local font = love.graphics.getFont()
local width = font:getWidth(self.text)
local image = self.image
if image then if image then
local imagewidth = image:getWidth() local imagewidth = image:getWidth()
self.width = imagewidth + 15 + width self.width = imagewidth + 15 + width

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- tooltip clas -- tooltip clas
@ -21,8 +21,8 @@ function tooltip:initialize(object, text, width)
self.width = width or 0 self.width = width or 0
self.height = 0 self.height = 0
self.padding = 5 self.padding = 5
self.xoffset = 0 self.xoffset = 10
self.yoffset = 0 self.yoffset = -10
self.internal = true self.internal = true
self.show = false self.show = false
self.followcursor = true self.followcursor = true
@ -35,7 +35,7 @@ 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)
table.insert(loveframes.base.children, self) table.insert(loveframes.base.internals, self)
end end
@ -64,6 +64,11 @@ function tooltip:update(dt)
if object then if object then
if object == loveframes.base then
self:Remove()
return
end
local hover = object.hover local hover = object.hover
local odraworder = object.draworder local odraworder = object.draworder
@ -73,9 +78,9 @@ function tooltip:update(dt)
local show = self.show local show = self.show
if show == true then if show == true then
local top = self:IsTopInternal()
if self.followcursor == true then if self.followcursor == true then
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local top = self:IsTopChild()
self.x = x + self.xoffset self.x = x + self.xoffset
self.y = y - self.height + self.yoffset self.y = y - self.height + self.yoffset
else else
@ -91,9 +96,14 @@ function tooltip:update(dt)
end end
if odraworder > draworder then local baseparent = object:GetBaseParent()
if baseparent then
if baseparent.removed and baseparent.removed == true then
self:Remove()
end
elseif object.removed then
self:Remove() self:Remove()
table.insert(loveframes.base.children, self)
end end
end end
@ -118,24 +128,24 @@ function tooltip:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
local show = self.show local show = self.show
local text = self.text local text = self.text
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawToolTip or skins[defaultskin].DrawToolTip
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if show == true then if show == true then
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawToolTip(self) drawfunc(self)
end end
text:draw() text:draw()
@ -172,6 +182,7 @@ end
function tooltip:SetText(text) function tooltip:SetText(text)
self.text:SetText(text) self.text:SetText(text)
self.text2 = text
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- list class -- list class
@ -98,27 +98,26 @@ function list:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
-- skin variables local stencil = love.graphics.newStencil(stencilfunc)
local index = loveframes.config["ACTIVESKIN"] local skins = loveframes.skins.available
local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawList or skins[defaultskin].DrawList
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawList(self) drawfunc(self)
end end
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local stencil = love.graphics.newStencil(stencilfunc)
love.graphics.setStencil(stencil) love.graphics.setStencil(stencil)
for k, v in ipairs(children) do for k, v in ipairs(children) do

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- progress bar class -- progress bar class
@ -68,11 +68,12 @@ function multichoice:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawMultiChoice or skins[defaultskin].DrawMultiChoice
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -80,7 +81,7 @@ function multichoice:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawMultiChoice(self) drawfunc(self)
end end
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- panel class -- panel class
@ -69,12 +69,12 @@ function panel:draw()
end end
local children = self.children local children = self.children
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawPanel or skins[defaultskin].DrawPanel
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -82,7 +82,7 @@ function panel:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawPanel(self) drawfunc(self)
end end
-- loop through the object's children and draw them -- loop through the object's children and draw them

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- progress bar class -- progress bar class
@ -133,11 +133,12 @@ function progressbar:draw()
return return
end end
-- skin variables local skins = loveframes.skins.available
local index = loveframes.config["ACTIVESKIN"] local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawProgressBar or skins[defaultskin].DrawProgressBar
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -145,7 +146,7 @@ function progressbar:draw()
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawProgressBar(self) drawfunc(self)
end end
end end
@ -283,3 +284,13 @@ function progressbar:GetLerpRate()
return self.lerprate return self.lerprate
end end
--[[---------------------------------------------------------
- func: GetCompleted()
- desc: gets the value of object.completed
--]]---------------------------------------------------------
function progressbar:GetLerpRate()
return self.completed
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- text clas -- text clas
@ -55,7 +55,7 @@ function slider:update(dt)
self:CheckHover() self:CheckHover()
-- 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 and self.parent.type ~= "list" 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
@ -92,20 +92,20 @@ function slider:draw()
end end
local internals = self.internals local internals = self.internals
local skins = loveframes.skins.available
local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawSlider or skins[defaultskin].DrawSlider
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin]
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawSlider(self) drawfunc(self)
end end
-- draw internals -- draw internals
@ -230,6 +230,10 @@ function slider:SetMax(max)
self.max = max self.max = max
if self.value > self.max then
self.value = self.max
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
@ -250,6 +254,10 @@ function slider:SetMin(min)
self.min = min self.min = min
if self.value < self.min then
self.value = self.min
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
@ -271,6 +279,14 @@ function slider:SetMinMax(min, max)
self.min = min self.min = min
self.max = max self.max = max
if self.value > self.max then
self.value = self.max
end
if self.value < self.min then
self.value = self.min
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- tabs class -- tabs class
@ -25,7 +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.tooltipfont = loveframes.basicfontsmall
self.tabs = {} self.tabs = {}
self.internals = {} self.internals = {}
self.children = {} self.children = {}
@ -106,26 +106,26 @@ function tabs:draw()
end end
local internals = self.internals local internals = self.internals
local tabheight = self:GetHeightOfButtons()
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, tabheight) end
local stencil = love.graphics.newStencil(stencilfunc)
local internals = self.internals
local skins = loveframes.skins.available
local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawTabPanel or skins[defaultskin].DrawTabPanel
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin]
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawTabPanel(self) drawfunc(self)
end end
local tabheight = self:GetHeightOfButtons()
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, tabheight) end
local stencil = love.graphics.newStencil(stencilfunc)
love.graphics.setStencil(stencil) love.graphics.setStencil(stencil)
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
@ -457,3 +457,13 @@ function tabs:SetToolTipFont(font)
end end
end end
--[[---------------------------------------------------------
- func: GetTabNumber()
- desc: gets the object's tab number
--]]---------------------------------------------------------
function tabs:GetTabNumber()
return self.tabnumber
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
--[[------------------------------------------------ --[[------------------------------------------------
@ -19,7 +19,7 @@ function text:initialize()
self.type = "text" self.type = "text"
self.text = "" self.text = ""
self.font = love.graphics.newFont(12) self.font = loveframes.basicfont
self.width = 5 self.width = 5
self.height = 5 self.height = 5
self.maxw = 0 self.maxw = 0
@ -66,25 +66,52 @@ function text:draw()
return return
end end
loveframes.drawcount = loveframes.drawcount + 1 local skins = loveframes.skins.available
self.draworder = loveframes.drawcount local skinindex = loveframes.config["ACTIVESKIN"]
-- skin variables
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawText or skins[defaultskin].DrawText
loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawText(self) drawfunc(self)
end end
self:DrawText() self:DrawText()
end end
--[[---------------------------------------------------------
- func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button
--]]---------------------------------------------------------
function text:mousepressed(x, y, button)
local visible = self.visible
if visible == false then
return
end
local hover = self.hover
if hover == true and button == "l" then
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
end
end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
@ -129,7 +156,7 @@ function text:SetText(t)
elseif dtype == "string" then elseif dtype == "string" then
v = v:gsub(string.char(9), " ") v = v:gsub(string.char(9), " ")
v = v:gsub("\n", "") v = v:gsub(string.char(92) .. string.char(110), string.char(10))
local parts = loveframes.util.SplitSring(v, " ") local parts = loveframes.util.SplitSring(v, " ")
@ -189,24 +216,6 @@ function text:SetText(t)
table.insert(self.text, v.key, {color = v.color, text = v.text}) table.insert(self.text, v.key, {color = v.color, text = v.text})
end end
end
--[[---------------------------------------------------------
- func: GetText()
- desc: gets the object's text
--]]---------------------------------------------------------
function text:GetText()
return self.text
end
--[[---------------------------------------------------------
- func: Format()
- desc: formats the text
--]]---------------------------------------------------------
function text:DrawText()
local textdata = self.text local textdata = self.text
local maxw = self.maxw local maxw = self.maxw
local font = self.font local font = self.font
@ -234,7 +243,13 @@ function text:DrawText()
if k ~= 1 then if k ~= 1 then
if (twidth + width) > maxw then if string.byte(text) == 10 then
twidth = 0
drawx = 0
width = 0
drawy = drawy + height
text = ""
elseif (twidth + width) > maxw then
twidth = 0 + width twidth = 0 + width
drawx = 0 drawx = 0
drawy = drawy + height drawy = drawy + height
@ -249,9 +264,8 @@ function text:DrawText()
prevtextwidth = width prevtextwidth = width
love.graphics.setFont(font) v.x = drawx
love.graphics.setColor(unpack(color)) v.y = drawy
love.graphics.print(text, x + drawx, y + drawy)
else else
@ -261,9 +275,8 @@ function text:DrawText()
prevtextwidth = width prevtextwidth = width
love.graphics.setFont(font) v.x = drawx
love.graphics.setColor(unpack(color)) v.y = drawy
love.graphics.print(text, x + drawx, y)
end end
@ -281,6 +294,40 @@ function text:DrawText()
end end
--[[---------------------------------------------------------
- func: GetText()
- desc: gets the object's text
--]]---------------------------------------------------------
function text:GetText()
return self.text
end
--[[---------------------------------------------------------
- func: Format()
- desc: formats the text
--]]---------------------------------------------------------
function text:DrawText()
local textdata = self.text
local font = self.font
local x = self.x
local y = self.y
for k, v in ipairs(textdata) do
local text = v.text
local color = v.color
love.graphics.setFont(font)
love.graphics.setColor(unpack(color))
love.graphics.printf(text, x + v.x, y + v.y, 0, "left")
end
end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetMaxWidth(width) - func: SetMaxWidth(width)
- desc: sets the object's maximum width - desc: sets the object's maximum width
@ -358,3 +405,13 @@ function text:GetFont()
return self.font return self.font
end end
--[[---------------------------------------------------------
- func: GetLines()
- desc: gets the number of lines the object's text uses
--]]---------------------------------------------------------
function text:GetLines()
return self.lines
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- textinput clas -- textinput clas
@ -17,7 +17,7 @@ function textinput:initialize()
self.type = "textinput" self.type = "textinput"
self.text = "" self.text = ""
self.keydown = "none" self.keydown = "none"
self.font = love.graphics.newFont(12) self.font = loveframes.basicfont
self.textcolor = {0, 0, 0, 255} self.textcolor = {0, 0, 0, 255}
self.width = 200 self.width = 200
self.height = 25 self.height = 25
@ -32,6 +32,9 @@ function textinput:initialize()
self.textxoffset = 0 self.textxoffset = 0
self.textyoffset = 0 self.textyoffset = 0
self.unicode = 0 self.unicode = 0
self.limit = 0
self.usable = {}
self.unusable = {}
self.showblink = true self.showblink = true
self.focus = false self.focus = false
self.internal = false self.internal = false
@ -67,6 +70,7 @@ function textinput:update(dt)
self.y = self.parent.y + self.staticy self.y = self.parent.y + self.staticy
end end
-- keydown check
if keydown ~= "none" then if keydown ~= "none" then
if time > self.delay then if time > self.delay then
self:RunKey(keydown, unicode) self:RunKey(keydown, unicode)
@ -103,26 +107,27 @@ function textinput:draw()
local text = self.text local text = self.text
local textx = self.textx local textx = self.textx
local texty = self.texty local texty = self.texty
local skins = loveframes.skins.available
-- skin variables local skinindex = loveframes.config["ACTIVESKIN"]
local index = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin]
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local stencil = love.graphics.newStencil(stencilfunc) local stencil = love.graphics.newStencil(stencilfunc)
love.graphics.setStencil(stencil) local selfskin = self.skin
local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawTextInput or skins[defaultskin].DrawTextInput
love.graphics.setStencil(stencilfunc)
if self.Draw ~= nil then if self.Draw ~= nil then
self.Draw(self) self.Draw(self)
else else
skin.DrawTextInput(self) drawfunc(self)
end end
-- draw the object's text
love.graphics.setFont(font) love.graphics.setFont(font)
love.graphics.setColor(unpack(textcolor)) love.graphics.setColor(self.textcolor)
love.graphics.print(text, textx, self.texty) love.graphics.print(self.text, textx, texty)
love.graphics.setStencil() love.graphics.setStencil()
@ -153,6 +158,7 @@ function textinput:mousepressed(x, y, button)
if hover == true then if hover == true then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
local time = love.timer.getTime()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -253,6 +259,10 @@ function textinput:RunKey(key, unicode)
self.unicode = unicode self.unicode = unicode
if key == "left" then if key == "left" then
if self.alltextselected == true then
self.alltextselected = false
self.blinknum = 0
else
self:MoveBlinker(-1) self:MoveBlinker(-1)
if blinkx <= self.x and blinknum ~= 0 then if blinkx <= self.x and blinknum ~= 0 then
local width = self.font:getWidth(self.text:sub(blinknum, blinknum + 1)) local width = self.font:getWidth(self.text:sub(blinknum, blinknum + 1))
@ -260,7 +270,12 @@ function textinput:RunKey(key, unicode)
elseif blinknum == 0 and self.xoffset ~= 0 then elseif blinknum == 0 and self.xoffset ~= 0 then
self.xoffset = 0 self.xoffset = 0
end end
end
elseif key == "right" then elseif key == "right" then
if self.alltextselected == true then
self.alltextselected = false
self.blinknum = #self.text
else
self:MoveBlinker(1) self:MoveBlinker(1)
if blinkx >= self.x + swidth and blinknum ~= #self.text then if blinkx >= self.x + swidth and blinknum ~= #self.text then
local width = self.font:getWidth(self.text:sub(blinknum, blinknum)) local width = self.font:getWidth(self.text:sub(blinknum, blinknum))
@ -269,6 +284,7 @@ function textinput:RunKey(key, unicode)
self.xoffset = ((0 - font:getWidth(self.text)) + swidth) self.xoffset = ((0 - font:getWidth(self.text)) + swidth)
end end
end end
end
-- key input checking system -- key input checking system
if key == "backspace" then if key == "backspace" then
@ -276,13 +292,52 @@ function textinput:RunKey(key, unicode)
self.text = self:RemoveFromeText(blinknum) self.text = self:RemoveFromeText(blinknum)
self:MoveBlinker(-1) self:MoveBlinker(-1)
end end
local cwidth = font:getWidth(self.text:sub(#self.text))
if self.xoffset ~= 0 then
self.xoffset = self.xoffset + cwidth
end
elseif key == "return" then elseif key == "return" then
if self.OnEnter ~= nil then if self.OnEnter ~= nil then
self.OnEnter(self, self.text) self.OnEnter(self, self.text)
end end
else else
if unicode > 31 and unicode < 127 then if unicode > 31 and unicode < 127 then
if self.alltextselected == true then
self.alltextselected = false
self:Clear()
end
if #self.text == self.limit and self.limit ~= 0 then
return
end
ckey = string.char(unicode) ckey = string.char(unicode)
if #self.usable > 0 then
local found = false
for k, v in ipairs(self.usable) do
if v == ckey then
found = true
end
end
if found == false then
return
end
end
if #self.unusable > 0 then
local found = false
for k, v in ipairs(self.unusable) do
if v == ckey then
found = true
end
end
if found == true then
return
end
end
if blinknum ~= 0 and blinknum ~= #self.text then if blinknum ~= 0 and blinknum ~= #self.text then
self.text = self:AddIntoText(unicode, blinknum) self.text = self:AddIntoText(unicode, blinknum)
self:MoveBlinker(1) self:MoveBlinker(1)
@ -298,20 +353,14 @@ function textinput:RunKey(key, unicode)
self.OnTextEntered(self, ckey) self.OnTextEntered(self, ckey)
end end
end
end
if key == "backspace" then
local cwidth = font:getWidth(self.text:sub(#self.text))
if self.xoffset ~= 0 then
self.xoffset = self.xoffset + cwidth
end
else
local cwidth = font:getWidth(ckey) local cwidth = font:getWidth(ckey)
-- swidth - 1 is for the "-" character -- swidth - 1 is for the "-" character
if (twidth + textxoffset) >= (swidth - 1) then if (twidth + textxoffset) >= (swidth - 1) then
self.xoffset = self.xoffset - cwidth self.xoffset = self.xoffset - cwidth
end end
end
end end
end end
@ -322,7 +371,7 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:MoveBlinker(num, exact) function textinput:MoveBlinker(num, exact)
if exact == nil or false then if not exact or exact == false then
self.blinknum = self.blinknum + num self.blinknum = self.blinknum + num
else else
self.blinknum = num self.blinknum = num
@ -508,9 +557,8 @@ function textinput:SetFocus(focus)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: GetFocus - func: GetFocus()
- desc: gets the object's focus - desc: gets the object's focus
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetFocus() function textinput:GetFocus()
@ -520,7 +568,7 @@ function textinput:GetFocus()
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: GetBlinkerVisibility - func: GetBlinkerVisibility()
- desc: gets the object's blinker visibility - desc: gets the object's blinker visibility
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetBlinkerVisibility() function textinput:GetBlinkerVisibility()
@ -528,3 +576,58 @@ function textinput:GetBlinkerVisibility()
return self.showblink return self.showblink
end end
--[[---------------------------------------------------------
- func: SetLimit(limit)
- desc: sets the object's text limit
--]]---------------------------------------------------------
function textinput:SetLimit(limit)
self.limit = limit
end
--[[---------------------------------------------------------
- func: SetUsable(usable)
- desc: sets what characters can be used for the
object's text
--]]---------------------------------------------------------
function textinput:SetUsable(usable)
self.usable = usable
end
--[[---------------------------------------------------------
- func: SetUnusable(unusable)
- desc: sets what characters can not be used for the
object's text
--]]---------------------------------------------------------
function textinput:SetUnusable(unusable)
self.unusable = unusable
end
--[[---------------------------------------------------------
- func: Clear()
- desc: clears the object's text
--]]---------------------------------------------------------
function textinput:Clear()
self.text = ""
self.xoffset = 0
self.textxoffset = 0
self.blinknum = 0
end
--[[---------------------------------------------------------
- func: GetText()
- desc: gets the object's text
--]]---------------------------------------------------------
function textinput:GetText()
return self.text
end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
loveframes.skins = {} loveframes.skins = {}

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- skin table -- skin table
@ -119,6 +119,7 @@ skin.controls.tooltip_text_font = smallfont
skin.controls.textinput_border_color = bordercolor skin.controls.textinput_border_color = bordercolor
skin.controls.textinput_body_color = {240, 240, 240, 255} skin.controls.textinput_body_color = {240, 240, 240, 255}
skin.controls.textinput_blinker_color = {0, 0, 0, 255} skin.controls.textinput_blinker_color = {0, 0, 0, 255}
skin.controls.textinput_highlight_color = {51, 204, 255, 255}
-- slider -- slider
skin.controls.slider_bar_color = bordercolor skin.controls.slider_bar_color = bordercolor
@ -200,11 +201,11 @@ end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: DrawRepeatingImage(image, x, y, width, height) - func: DrawRepeatingImage(image, x, y, width, height)
- desc: draw a repeating image a box - desc: draw a repeating image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function skin.DrawRepeatingImage(image, x, y, width, height) function skin.DrawRepeatingImage(image, x, y, width, height)
local image = love.graphics.newImage(image) local image = image
local iwidth = image:getWidth() local iwidth = image:getWidth()
local iheight = image:getHeight() local iheight = image:getHeight()
local cords = {} local cords = {}
@ -212,6 +213,7 @@ function skin.DrawRepeatingImage(image, x, y, width, height)
local posy = 0 local posy = 0
local stencilfunc = function() love.graphics.rectangle("fill", x, y, width, height) end local stencilfunc = function() love.graphics.rectangle("fill", x, y, width, height) end
local stencil = love.graphics.newStencil(stencilfunc) local stencil = love.graphics.newStencil(stencilfunc)
local images = 0
while posy < height do while posy < height do
@ -231,26 +233,25 @@ function skin.DrawRepeatingImage(image, x, y, width, height)
for k, v in ipairs(cords) do for k, v in ipairs(cords) do
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(image, x + v[1], y + v[2]) love.graphics.draw(image, x + v[1], y + v[2])
images = images + 1
end end
love.graphics.setStencil() love.graphics.setStencil()
print(images)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: skin.DrawGradient(x, y, width, height, - func: skin.DrawGradient(x, y, width, height, color)
direction, color, colormod)
- desc: draws a gradient - desc: draws a gradient
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function skin.DrawGradient(x, y, width, height, direction, color, colormod) function skin.DrawGradient(x, y, width, height, color)
local color = color local color = color
local colormod = colormod or 0
local percent = 0 local percent = 0
local once = false local once = false
if direction == "up" then
for i=1, height - 1 do for i=1, height - 1 do
percent = i/height * 255 percent = i/height * 255
color = {color[1], color[2], color[3], loveframes.util.Round(percent)} color = {color[1], color[2], color[3], loveframes.util.Round(percent)}
@ -260,8 +261,6 @@ function skin.DrawGradient(x, y, width, height, direction, color, colormod)
end end
end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: DrawFrame(object) - func: DrawFrame(object)
- desc: draws the frame object - desc: draws the frame object
@ -279,7 +278,7 @@ function skin.DrawFrame(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), 25) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), 25)
gradientcolor = {skin.controls.frame_top_color[1] - 20, skin.controls.frame_top_color[2] - 20, skin.controls.frame_top_color[3] - 20, 255} gradientcolor = {skin.controls.frame_top_color[1] - 20, skin.controls.frame_top_color[2] - 20, skin.controls.frame_top_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), 25, "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), 25, gradientcolor)
love.graphics.setColor(unpack(skin.controls.frame_border_color)) love.graphics.setColor(unpack(skin.controls.frame_border_color))
skin.OutlinedRectangle(object:GetX(), object:GetY() + 25, object:GetWidth(), 1) skin.OutlinedRectangle(object:GetX(), object:GetY() + 25, object:GetWidth(), 1)
@ -316,7 +315,7 @@ function skin.DrawButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button text -- button text
love.graphics.setFont(skin.controls.button_text_font) love.graphics.setFont(skin.controls.button_text_font)
@ -334,7 +333,7 @@ function skin.DrawButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button text -- button text
love.graphics.setFont(skin.controls.button_text_font) love.graphics.setFont(skin.controls.button_text_font)
@ -352,7 +351,7 @@ function skin.DrawButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button text -- button text
love.graphics.setFont(skin.controls.button_text_font) love.graphics.setFont(skin.controls.button_text_font)
@ -497,7 +496,7 @@ function skin.DrawProgressBar(object)
love.graphics.setColor(unpack(skin.controls.progressbar_bar_color)) love.graphics.setColor(unpack(skin.controls.progressbar_bar_color))
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object.progress, object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object.progress, object:GetHeight())
gradientcolor = {skin.controls.progressbar_bar_color[1], skin.controls.progressbar_bar_color[2] - 20, skin.controls.progressbar_bar_color[3], 255} gradientcolor = {skin.controls.progressbar_bar_color[1], skin.controls.progressbar_bar_color[2] - 20, skin.controls.progressbar_bar_color[3], 255}
skin.DrawGradient(object:GetX(), object:GetY(), object.progress, object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object.progress, object:GetHeight(), gradientcolor)
love.graphics.setFont(font) love.graphics.setFont(font)
love.graphics.setColor(unpack(skin.controls.progressbar_text_color)) love.graphics.setColor(unpack(skin.controls.progressbar_text_color))
love.graphics.print(object.value .. "/" ..object.max, object:GetX() + object:GetWidth()/2 - twidth/2, object:GetY() + object:GetHeight()/2 - theight/2) love.graphics.print(object.value .. "/" ..object.max, object:GetX() + object:GetWidth()/2 - twidth/2, object:GetY() + object:GetHeight()/2 - theight/2)
@ -538,21 +537,21 @@ function skin.DrawScrollBar(object)
love.graphics.setColor(unpack(skin.controls.scrollbar_body_down_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_body_down_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.scrollbar_body_down_color[1] - 20, skin.controls.scrollbar_body_down_color[2] - 20, skin.controls.scrollbar_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.scrollbar_body_down_color[1] - 20, skin.controls.scrollbar_body_down_color[2] - 20, skin.controls.scrollbar_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.scrollbar_border_down_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
elseif object.hover == true then elseif object.hover == true then
love.graphics.setColor(unpack(skin.controls.scrollbar_body_hover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_body_hover_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.scrollbar_body_hover_color[1] - 20, skin.controls.scrollbar_body_hover_color[2] - 20, skin.controls.scrollbar_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.scrollbar_body_hover_color[1] - 20, skin.controls.scrollbar_body_hover_color[2] - 20, skin.controls.scrollbar_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.scrollbar_border_hover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_border_hover_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
else else
love.graphics.setColor(unpack(skin.controls.scrollbar_body_nohover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_body_nohover_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.scrollbar_body_nohover_color[1] - 20, skin.controls.scrollbar_body_nohover_color[2] - 20, skin.controls.scrollbar_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.scrollbar_body_nohover_color[1] - 20, skin.controls.scrollbar_body_nohover_color[2] - 20, skin.controls.scrollbar_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.scrollbar_border_nohover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_border_nohover_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
end end
@ -664,7 +663,7 @@ function skin.DrawTabButton(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
gradientcolor = {skin.controls.tab_body_hover_color[1] - 20, skin.controls.tab_body_hover_color[2] - 20, skin.controls.tab_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.tab_body_hover_color[1] - 20, skin.controls.tab_body_hover_color[2] - 20, skin.controls.tab_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.tabpanel_border_color)) love.graphics.setColor(unpack(skin.controls.tabpanel_border_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
@ -691,7 +690,7 @@ function skin.DrawTabButton(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
gradientcolor = {skin.controls.tab_body_nohover_color[1] - 20, skin.controls.tab_body_nohover_color[2] - 20, skin.controls.tab_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.tab_body_nohover_color[1] - 20, skin.controls.tab_body_nohover_color[2] - 20, skin.controls.tab_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.tabpanel_border_color)) love.graphics.setColor(unpack(skin.controls.tabpanel_border_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
@ -833,6 +832,14 @@ function skin.DrawTextInput(object)
object:SetTextOffsetX(5) object:SetTextOffsetX(5)
end end
if object.alltextselected == true then
love.graphics.setColor(unpack(skin.controls.textinput_highlight_color))
love.graphics.rectangle("fill", object.textx, object.texty, object.font:getWidth(object:GetText()), object.font:getHeight("a"))
object:SetTextColor({255, 255, 255, 255})
else
object:SetTextColor({0, 0, 0, 255})
end
if showblink == true and focus == true then if showblink == true and focus == true then
love.graphics.setColor(unpack(skin.controls.textinput_blinker_color)) love.graphics.setColor(unpack(skin.controls.textinput_blinker_color))
@ -875,7 +882,7 @@ function skin.DrawScrollButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -888,7 +895,7 @@ function skin.DrawScrollButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -901,7 +908,7 @@ function skin.DrawScrollButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -989,7 +996,7 @@ function skin.DrawSliderButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -1002,7 +1009,7 @@ function skin.DrawSliderButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -1015,7 +1022,7 @@ function skin.DrawSliderButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -1044,13 +1051,8 @@ function skin.DrawCheckBox(object)
skin.OutlinedRectangle(object:GetX(), object:GetY(), object.boxwidth, object.boxheight) skin.OutlinedRectangle(object:GetX(), object:GetY(), object.boxwidth, object.boxheight)
if checked == true then if checked == true then
love.graphics.setColor(unpack(skin.controls.checkbox_check_color)) love.graphics.setColor(unpack(skin.controls.checkbox_check_color))
love.graphics.rectangle("fill", object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8) love.graphics.rectangle("fill", object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8)
gradientcolor = {skin.controls.checkbox_check_color[1] - 20, skin.controls.checkbox_check_color[2] - 20, skin.controls.checkbox_check_color[3] - 20, 255}
skin.DrawGradient(object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8, "up", gradientcolor)
end end
end end
@ -1068,7 +1070,7 @@ function skin.DrawCollapsibleCategory(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
love.graphics.setColor(unpack(gradientcolor)) love.graphics.setColor(unpack(gradientcolor))
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.collapsiblecategory_text_color)) love.graphics.setColor(unpack(skin.controls.collapsiblecategory_text_color))
love.graphics.print(object.text, object:GetX() + 5, object:GetY() + 5) love.graphics.print(object.text, object:GetX() + 5, object:GetY() + 5)
@ -1109,7 +1111,7 @@ function skin.DrawColumnListHeader(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.columnlistheader_body_down_color[1] - 20, skin.controls.columnlistheader_body_down_color[2] - 20, skin.controls.columnlistheader_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.columnlistheader_body_down_color[1] - 20, skin.controls.columnlistheader_body_down_color[2] - 20, skin.controls.columnlistheader_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- header name -- header name
love.graphics.setFont(font) love.graphics.setFont(font)
@ -1118,7 +1120,7 @@ function skin.DrawColumnListHeader(object)
-- header border -- header border
love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color)) love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), false, false, false, true)
elseif hover == true then elseif hover == true then
@ -1127,7 +1129,7 @@ function skin.DrawColumnListHeader(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.columnlistheader_body_hover_color[1] - 20, skin.controls.columnlistheader_body_hover_color[2] - 20, skin.controls.columnlistheader_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.columnlistheader_body_hover_color[1] - 20, skin.controls.columnlistheader_body_hover_color[2] - 20, skin.controls.columnlistheader_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- header name -- header name
love.graphics.setFont(font) love.graphics.setFont(font)
@ -1136,7 +1138,7 @@ function skin.DrawColumnListHeader(object)
-- header border -- header border
love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color)) love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), false, false, false, true)
else else
@ -1145,7 +1147,7 @@ function skin.DrawColumnListHeader(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.columnlistheader_body_nohover_color[1] - 20, skin.controls.columnlistheader_body_nohover_color[2] - 20, skin.controls.columnlistheader_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.columnlistheader_body_nohover_color[1] - 20, skin.controls.columnlistheader_body_nohover_color[2] - 20, skin.controls.columnlistheader_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- header name -- header name
love.graphics.setFont(font) love.graphics.setFont(font)
@ -1154,7 +1156,7 @@ function skin.DrawColumnListHeader(object)
-- header border -- header border
love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color)) love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), false, false, false, true)
end end
@ -1201,15 +1203,15 @@ function skin.DrawColumnListRow(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
love.graphics.setColor(unpack(skin.controls.columnlistrow_border1_color)) love.graphics.setColor(unpack(skin.controls.columnlistrow_border1_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), true, false, true, true)
else else
love.graphics.setColor(unpack(skin.controls.columnlistrow_body2_color)) love.graphics.setColor(unpack(skin.controls.columnlistrow_body2_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
love.graphics.setColor(unpack(skin.controls.columnlistrow_border2_color)) love.graphics.setColor(unpack(skin.controls.columnlistrow_border2_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), true, false, true, true)
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- skin table -- skin table
@ -200,11 +200,11 @@ end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: DrawRepeatingImage(image, x, y, width, height) - func: DrawRepeatingImage(image, x, y, width, height)
- desc: draw a repeating image a box - desc: draw a repeating image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function skin.DrawRepeatingImage(image, x, y, width, height) function skin.DrawRepeatingImage(image, x, y, width, height)
local image = love.graphics.newImage(image) local image = image
local iwidth = image:getWidth() local iwidth = image:getWidth()
local iheight = image:getHeight() local iheight = image:getHeight()
local cords = {} local cords = {}
@ -238,19 +238,15 @@ function skin.DrawRepeatingImage(image, x, y, width, height)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: skin.DrawGradient(x, y, width, height, - func: skin.DrawGradient(x, y, width, height, color)
direction, color, colormod)
- desc: draws a gradient - desc: draws a gradient
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function skin.DrawGradient(x, y, width, height, direction, color, colormod) function skin.DrawGradient(x, y, width, height, color)
local color = color local color = color
local colormod = colormod or 0
local percent = 0 local percent = 0
local once = false local once = false
if direction == "up" then
for i=1, height - 1 do for i=1, height - 1 do
percent = i/height * 255 percent = i/height * 255
color = {color[1], color[2], color[3], loveframes.util.Round(percent)} color = {color[1], color[2], color[3], loveframes.util.Round(percent)}
@ -260,8 +256,6 @@ function skin.DrawGradient(x, y, width, height, direction, color, colormod)
end end
end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: DrawFrame(object) - func: DrawFrame(object)
- desc: draws the frame object - desc: draws the frame object
@ -279,7 +273,7 @@ function skin.DrawFrame(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), 25) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), 25)
gradientcolor = {skin.controls.frame_top_color[1] - 20, skin.controls.frame_top_color[2] - 20, 0, 255} gradientcolor = {skin.controls.frame_top_color[1] - 20, skin.controls.frame_top_color[2] - 20, 0, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), 25, "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), 25, gradientcolor)
love.graphics.setColor(unpack(skin.controls.frame_border_color)) love.graphics.setColor(unpack(skin.controls.frame_border_color))
skin.OutlinedRectangle(object:GetX(), object:GetY() + 25, object:GetWidth(), 1) skin.OutlinedRectangle(object:GetX(), object:GetY() + 25, object:GetWidth(), 1)
@ -316,7 +310,7 @@ function skin.DrawButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button text -- button text
love.graphics.setFont(skin.controls.button_text_font) love.graphics.setFont(skin.controls.button_text_font)
@ -334,7 +328,7 @@ function skin.DrawButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button text -- button text
love.graphics.setFont(skin.controls.button_text_font) love.graphics.setFont(skin.controls.button_text_font)
@ -352,7 +346,7 @@ function skin.DrawButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button text -- button text
love.graphics.setFont(skin.controls.button_text_font) love.graphics.setFont(skin.controls.button_text_font)
@ -498,7 +492,7 @@ function skin.DrawProgressBar(object)
love.graphics.setColor(unpack(skin.controls.progressbar_bar_color)) love.graphics.setColor(unpack(skin.controls.progressbar_bar_color))
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object.progress, object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object.progress, object:GetHeight())
gradientcolor = {skin.controls.progressbar_bar_color[1], skin.controls.progressbar_bar_color[2] - 20, skin.controls.progressbar_bar_color[3], 255} gradientcolor = {skin.controls.progressbar_bar_color[1], skin.controls.progressbar_bar_color[2] - 20, skin.controls.progressbar_bar_color[3], 255}
skin.DrawGradient(object:GetX(), object:GetY(), object.progress, object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object.progress, object:GetHeight(), gradientcolor)
love.graphics.setFont(font) love.graphics.setFont(font)
love.graphics.setColor(unpack(skin.controls.progressbar_text_color)) love.graphics.setColor(unpack(skin.controls.progressbar_text_color))
love.graphics.print(object.value .. "/" ..object.max, object:GetX() + object:GetWidth()/2 - twidth/2, object:GetY() + object:GetHeight()/2 - theight/2) love.graphics.print(object.value .. "/" ..object.max, object:GetX() + object:GetWidth()/2 - twidth/2, object:GetY() + object:GetHeight()/2 - theight/2)
@ -539,21 +533,21 @@ function skin.DrawScrollBar(object)
love.graphics.setColor(unpack(skin.controls.scrollbar_body_down_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_body_down_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.scrollbar_body_down_color[1] - 20, skin.controls.scrollbar_body_down_color[2] - 20, skin.controls.scrollbar_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.scrollbar_body_down_color[1] - 20, skin.controls.scrollbar_body_down_color[2] - 20, skin.controls.scrollbar_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.scrollbar_border_down_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
elseif object.hover == true then elseif object.hover == true then
love.graphics.setColor(unpack(skin.controls.scrollbar_body_hover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_body_hover_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.scrollbar_body_hover_color[1] - 20, skin.controls.scrollbar_body_hover_color[2] - 20, skin.controls.scrollbar_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.scrollbar_body_hover_color[1] - 20, skin.controls.scrollbar_body_hover_color[2] - 20, skin.controls.scrollbar_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.scrollbar_border_hover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_border_hover_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
else else
love.graphics.setColor(unpack(skin.controls.scrollbar_body_nohover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_body_nohover_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.scrollbar_body_nohover_color[1] - 20, skin.controls.scrollbar_body_nohover_color[2] - 20, skin.controls.scrollbar_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.scrollbar_body_nohover_color[1] - 20, skin.controls.scrollbar_body_nohover_color[2] - 20, skin.controls.scrollbar_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.scrollbar_border_nohover_color)) love.graphics.setColor(unpack(skin.controls.scrollbar_border_nohover_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
end end
@ -665,7 +659,7 @@ function skin.DrawTabButton(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
gradientcolor = {skin.controls.tab_body_hover_color[1] - 20, skin.controls.tab_body_hover_color[2] - 20, skin.controls.tab_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.tab_body_hover_color[1] - 20, skin.controls.tab_body_hover_color[2] - 20, skin.controls.tab_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.tabpanel_border_color)) love.graphics.setColor(unpack(skin.controls.tabpanel_border_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
@ -692,7 +686,7 @@ function skin.DrawTabButton(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
gradientcolor = {skin.controls.tab_body_nohover_color[1] - 20, skin.controls.tab_body_nohover_color[2] - 20, skin.controls.tab_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.tab_body_nohover_color[1] - 20, skin.controls.tab_body_nohover_color[2] - 20, skin.controls.tab_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.tabpanel_border_color)) love.graphics.setColor(unpack(skin.controls.tabpanel_border_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
@ -876,7 +870,7 @@ function skin.DrawScrollButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -889,7 +883,7 @@ function skin.DrawScrollButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -902,7 +896,7 @@ function skin.DrawScrollButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -990,7 +984,7 @@ function skin.DrawSliderButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_down_color[1] - 20, skin.controls.button_body_down_color[2] - 20, skin.controls.button_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -1003,7 +997,7 @@ function skin.DrawSliderButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_hover_color[1] - 20, skin.controls.button_body_hover_color[2] - 20, skin.controls.button_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -1016,7 +1010,7 @@ function skin.DrawSliderButton(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.button_body_nohover_color[1] - 20, skin.controls.button_body_nohover_color[2] - 20, skin.controls.button_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- button border -- button border
love.graphics.setColor(unpack(skin.controls.button_border_down_color)) love.graphics.setColor(unpack(skin.controls.button_border_down_color))
@ -1050,7 +1044,7 @@ function skin.DrawCheckBox(object)
love.graphics.rectangle("fill", object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8) love.graphics.rectangle("fill", object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8)
gradientcolor = {skin.controls.checkbox_check_color[1] - 20, skin.controls.checkbox_check_color[2] - 20, skin.controls.checkbox_check_color[3] - 20, 255} gradientcolor = {skin.controls.checkbox_check_color[1] - 20, skin.controls.checkbox_check_color[2] - 20, skin.controls.checkbox_check_color[3] - 20, 255}
skin.DrawGradient(object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8, "up", gradientcolor) skin.DrawGradient(object:GetX() + 4, object:GetY() + 4, object.boxwidth - 8, object.boxheight - 8, gradientcolor)
end end
@ -1069,7 +1063,7 @@ function skin.DrawCollapsibleCategory(object)
love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
love.graphics.setColor(unpack(gradientcolor)) love.graphics.setColor(unpack(gradientcolor))
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
love.graphics.setColor(unpack(skin.controls.collapsiblecategory_text_color)) love.graphics.setColor(unpack(skin.controls.collapsiblecategory_text_color))
love.graphics.print(object.text, object:GetX() + 5, object:GetY() + 5) love.graphics.print(object.text, object:GetX() + 5, object:GetY() + 5)
@ -1110,7 +1104,7 @@ function skin.DrawColumnListHeader(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.columnlistheader_body_down_color[1] - 20, skin.controls.columnlistheader_body_down_color[2] - 20, skin.controls.columnlistheader_body_down_color[3] - 20, 255} gradientcolor = {skin.controls.columnlistheader_body_down_color[1] - 20, skin.controls.columnlistheader_body_down_color[2] - 20, skin.controls.columnlistheader_body_down_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- header name -- header name
love.graphics.setFont(font) love.graphics.setFont(font)
@ -1119,7 +1113,7 @@ function skin.DrawColumnListHeader(object)
-- header border -- header border
love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color)) love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), false, false, false, true)
elseif hover == true then elseif hover == true then
@ -1128,7 +1122,7 @@ function skin.DrawColumnListHeader(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.columnlistheader_body_hover_color[1] - 20, skin.controls.columnlistheader_body_hover_color[2] - 20, skin.controls.columnlistheader_body_hover_color[3] - 20, 255} gradientcolor = {skin.controls.columnlistheader_body_hover_color[1] - 20, skin.controls.columnlistheader_body_hover_color[2] - 20, skin.controls.columnlistheader_body_hover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- header name -- header name
love.graphics.setFont(font) love.graphics.setFont(font)
@ -1137,7 +1131,7 @@ function skin.DrawColumnListHeader(object)
-- header border -- header border
love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color)) love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), false, false, false, true)
else else
@ -1146,7 +1140,7 @@ function skin.DrawColumnListHeader(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
gradientcolor = {skin.controls.columnlistheader_body_nohover_color[1] - 20, skin.controls.columnlistheader_body_nohover_color[2] - 20, skin.controls.columnlistheader_body_nohover_color[3] - 20, 255} gradientcolor = {skin.controls.columnlistheader_body_nohover_color[1] - 20, skin.controls.columnlistheader_body_nohover_color[2] - 20, skin.controls.columnlistheader_body_nohover_color[3] - 20, 255}
skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), "up", gradientcolor) skin.DrawGradient(object:GetX(), object:GetY() - 1, object:GetWidth(), object:GetHeight(), gradientcolor)
-- header name -- header name
love.graphics.setFont(font) love.graphics.setFont(font)
@ -1155,7 +1149,7 @@ function skin.DrawColumnListHeader(object)
-- header border -- header border
love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color)) love.graphics.setColor(unpack(skin.controls.columnlistheader_border_down_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), false, false, false, true)
end end
@ -1202,15 +1196,15 @@ function skin.DrawColumnListRow(object)
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2)
love.graphics.setColor(unpack(skin.controls.columnlistrow_border1_color)) love.graphics.setColor(unpack(skin.controls.columnlistrow_border1_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), true, false, true, true)
else else
love.graphics.setColor(unpack(skin.controls.columnlistrow_body2_color)) love.graphics.setColor(unpack(skin.controls.columnlistrow_body2_color))
love.graphics.rectangle("fill", object:GetX() + 1, object:GetY() + 1, object:GetWidth() - 2, object:GetHeight() - 2) love.graphics.rectangle("fill", object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight())
love.graphics.setColor(unpack(skin.controls.columnlistrow_border2_color)) love.graphics.setColor(unpack(skin.controls.columnlistrow_border2_color))
skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight()) skin.OutlinedRectangle(object:GetX(), object:GetY(), object:GetWidth(), object:GetHeight(), true, false, true, true)
end end

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- templates -- templates

View File

@ -1,6 +1,6 @@
--[[------------------------------------------------ --[[------------------------------------------------
-- LÖVE Frames -- -- LÖVE Frames --
-- By Nikolai Resokav -- -- By Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
-- util library -- util library
@ -76,7 +76,7 @@ function loveframes.util.GetCollisions(object, t)
if object.internals then if object.internals then
for k, v in ipairs(object.internals) do for k, v in ipairs(object.internals) do
if v.visible == true then if v.visible == true and v.type ~= "tooltip" then
loveframes.util.GetCollisions(v, t) loveframes.util.GetCollisions(v, t)
end end
end end
@ -182,22 +182,20 @@ function loveframes.util.GetDirContents(dir, t)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: Round(val, decimal) - func: Round(num, idp)
- desc: rounds a number based on the decimal limit - desc: rounds a number based on the decimal limit
- note: i take no credit for this function - note: i take no credit for this function
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.util.Round(val, decimal) function loveframes.util.Round(num, idp)
if (decimal) then local mult = 10^(idp or 0)
return math.floor( (val * 10^decimal) + 0.5) / (10^decimal) if num >= 0 then return math.floor(num * mult + 0.5) / mult
else else return math.ceil(num * mult - 0.5) / mult end
return math.floor(val+0.5)
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: Split(string, pattern) - func: SplitSring(string, pattern)
- desc: splits a string into a table based on a given pattern - desc: splits a string into a table based on a given pattern
- note: i take no credit for this function - note: i take no credit for this function
--]]--------------------------------------------------------- --]]---------------------------------------------------------
@ -249,7 +247,7 @@ function loveframes.util.SplitSring(str, pat)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: Trim(string) - func: TrimString(string)
- desc: trims spaces off of the beginning and end of - desc: trims spaces off of the beginning and end of
a string a string
- note: i take no credit for this function - note: i take no credit for this function
@ -267,5 +265,6 @@ end
function loveframes.util.RemoveAll() function loveframes.util.RemoveAll()
loveframes.base.children = {} loveframes.base.children = {}
loveframes.base.internals = {}
end end