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
@ -28,11 +27,17 @@ function loveframes.debug.draw()
return return
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 objects = loveframes.util.GetAllObjects()
local bchildren = #loveframes.base.children local author = loveframes.info.author
local objects = loveframes.util.GetAllObjects() 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,20 +9,22 @@ 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
loveframes.config = {} loveframes.config = {}
loveframes.config["DIRECTORY"] = "libraries/loveframes" loveframes.config["DIRECTORY"] = "libraries/loveframes"
loveframes.config["DEFAULTSKIN"] = "Blue" loveframes.config["DEFAULTSKIN"] = "Blue"
loveframes.config["ACTIVESKIN"] = "Blue" loveframes.config["ACTIVESKIN"] = "Blue"
loveframes.config["INDEXSKINIMAGES"] = true loveframes.config["INDEXSKINIMAGES"] = true
loveframes.config["DEBUG"] = true 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 the object is a tooltip, return it and go no further
if data == "tooltip" then
return object
end
-- remove the object if it is an internal
if object.internal == true then if object.internal == true then
if object.type == "tooltip" then object:Remove()
object = tooltip:new() return
else
return
end
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()
table.insert(pchildren, self)
if internal == true then
table.insert(pinternals, self)
else
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
@ -79,15 +77,15 @@ function collapsiblecategory:draw()
return return
end end
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 = skins[selfskin] or skins[skinindex]
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] 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
@ -83,19 +83,22 @@ function columnlist:draw()
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
local children = self.children local children = self.children
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.DrawColumnList or skins[defaultskin].DrawColumnList
-- skin variables loveframes.drawcount = loveframes.drawcount + 1
local index = loveframes.config["ACTIVESKIN"] self.draworder = loveframes.drawcount
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.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
@ -62,20 +62,20 @@ function frame:update(dt)
end end
end end
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local showclose = self.showclose local showclose = self.showclose
local close = self.internals[1] local close = self.internals[1]
local dragging = self.dragging local dragging = self.dragging
local screenlocked = self.screenlocked local screenlocked = self.screenlocked
local modal = self.modal local modal = self.modal
local base = loveframes.base local base = loveframes.base
local basechildren = base.children local basechildren = base.children
local numbasechildren = #basechildren local numbasechildren = #basechildren
local draworder = self.draworder local draworder = self.draworder
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
@ -148,14 +156,14 @@ function frame:draw()
return return
end end
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 = skins[selfskin] or skins[skinindex]
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] 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
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.DrawImageButton or skins[defaultskin].DrawImageButton
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.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
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.DrawCloseButton or skins[defaultskin].DrawCloseButton
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.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
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local stencil = love.graphics.newStencil(stencilfunc)
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.DrawColumnListArea or skins[defaultskin].DrawColumnListArea
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.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
local cwidth, cheight = self:GetParent():GetParent():GetColumnSize()
local x = self.textx
local textcolor = self.textcolor
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.DrawColumnListRow or skins[defaultskin].DrawColumnListRow
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.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
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.DrawColumnListHeader or skins[defaultskin].DrawColumnListHeader
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.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 defaultskin = loveframes.config["DEFAULTSKIN"] local skins = loveframes.skins.available
local selfskin = self.skin local skinindex = loveframes.config["ACTIVESKIN"]
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
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()
skin.DrawOverMultiChoiceList(self) if self.Draw == nil and skin.DrawOverMultiChoiceList then
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
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.DrawMultiChoiceRow or skins[defaultskin].DrawMultiChoiceRow
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.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
@ -124,13 +124,13 @@ function scrollarea:draw()
return return
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 = skins[selfskin] or skins[skinindex]
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] 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
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.DrawScrollButton or skins[defaultskin].DrawScrollButton
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.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
@ -47,17 +47,17 @@ function sliderbutton:update(dt)
self:CheckHover() self:CheckHover()
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
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
local parent = self.parent local parent = self.parent
local slidetype = parent.slidetype local slidetype = parent.slidetype
local dragging = self.dragging local dragging = self.dragging
if hover == false then if hover == false then
self.down = false self.down = false
@ -77,56 +77,69 @@ function sliderbutton:update(dt)
self.y = self.parent.y + self.staticy self.y = self.parent.y + self.staticy
end end
if slidetype == "horizontal" then -- start calculations if the button is being dragged
if dragging == true then
-- calculations for horizontal sliders
if slidetype == "horizontal" then
self.staticx = self.startx + (x - self.clickx)
progress = self.staticx/(self.parent.width - self.width)
nvalue = self.parent.min + (self.parent.max - self.parent.min) * progress
nvalue = loveframes.util.Round(nvalue, self.parent.decimals)
-- calculations for vertical sliders
elseif slidetype == "vertical" then
self.staticy = self.starty + (y - self.clicky)
local space = self.parent.height - self.height
local remaining = (self.parent.height - self.height) - self.staticy
local percent = remaining/space
nvalue = self.parent.min + (self.parent.max - self.parent.min) * percent
nvalue = loveframes.util.Round(nvalue, self.parent.decimals)
if dragging == true then
self.staticx = self.startx + (x - self.clickx)
end end
--
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
self.parent.OnValueChanged(self.parent, self.parent.value)
end
end
loveframes.hoverobject = self
end
if slidetype == "horizontal" then
if (self.staticx + self.width) > self.parent.width then if (self.staticx + self.width) > self.parent.width then
self.staticx = self.parent.width - self.width self.staticx = self.parent.width - self.width
end end
if self.staticx < 0 then if self.staticx < 0 then
self.staticx = 0 self.staticx = 0
end end
end
progress = loveframes.util.Round(self.staticx/(self.parent.width - self.width), 5) if slidetype == "vertical" then
nvalue = self.parent.min + (self.parent.max - self.parent.min) * progress
pvalue = self.parent.value
elseif slidetype == "vertical" then
if dragging == true then
self.staticy = self.starty + (y - self.clicky)
end
if (self.staticy + self.height) > self.parent.height then if (self.staticy + self.height) > self.parent.height then
self.staticy = self.parent.height - self.height self.staticy = self.parent.height - self.height
end end
if self.staticy < 0 then if self.staticy < 0 then
self.staticy = 0 self.staticy = 0
end end
local space = self.parent.height - self.height
local remaining = (self.parent.height - self.height) - self.staticy
local percent = loveframes.util.Round(remaining/space, 5)
nvalue = self.parent.min + (self.parent.max - self.parent.min) * percent
pvalue = self.parent.value
end
if nvalue ~= pvalue then
self.parent.value = loveframes.util.Round(nvalue, self.parent.decimals)
if self.parent.OnValueChanged then
self.parent.OnValueChanged(self.parent, self.parent.value)
end
end
if dragging == true then
loveframes.hoverobject = self
end end
if self.Update then if self.Update then
@ -147,19 +160,20 @@ function sliderbutton:draw()
return return
end end
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.DrawSliderButton or skins[defaultskin].DrawSliderButton
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.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
local font = love.graphics.getFont()
local width = font:getWidth(self.text)
local image = self.image
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.DrawTabButton or skins[defaultskin].DrawTabButton
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.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
local show = self.show
local text = self.text
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.DrawToolTip or skins[defaultskin].DrawToolTip
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
local show = self.show
local text = self.text
-- 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 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
@ -40,8 +40,8 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:update(dt) function list:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
if visible == false then if visible == false then
if alwaysupdate == false then if alwaysupdate == false then
@ -49,9 +49,9 @@ function list:update(dt)
end end
end end
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
local display = self.display local display = self.display
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
@ -98,27 +98,26 @@ function list:draw()
return return
end end
local internals = self.internals
local children = self.children
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local stencil = love.graphics.newStencil(stencilfunc)
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.DrawList or skins[defaultskin].DrawList
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
local internals = self.internals
local children = self.children
-- 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.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
@ -152,11 +151,11 @@ function list:mousepressed(x, y, button)
return return
end end
local toplist = self:IsTopList() local toplist = self:IsTopList()
local hover = self.hover local hover = self.hover
local vbar = self.vbar local vbar = self.vbar
local hbar = self.hbar local hbar = self.hbar
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
if hover == true and button == "l" then if hover == true and button == "l" then
@ -235,18 +234,18 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:CalculateSize() function list:CalculateSize()
local numitems = #self.children local numitems = #self.children
local height = self.height local height = self.height
local width = self.width local width = self.width
local padding = self.padding local padding = self.padding
local spacing = self.spacing local spacing = self.spacing
local itemheight = self.padding local itemheight = self.padding
local itemwidth = self.padding local itemwidth = self.padding
local display = self.display local display = self.display
local vbar = self.vbar local vbar = self.vbar
local hbar = self.hbar local hbar = self.hbar
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
if display == "vertical" then if display == "vertical" then
@ -322,14 +321,14 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:RedoLayout() function list:RedoLayout()
local children = self.children local children = self.children
local padding = self.padding local padding = self.padding
local spacing = self.spacing local spacing = self.spacing
local starty = padding local starty = padding
local startx = padding local startx = padding
local vbar = self.vbar local vbar = self.vbar
local hbar = self.hbar local hbar = self.hbar
local display = self.display local display = self.display
if #children > 0 then if #children > 0 then
@ -398,8 +397,8 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetDisplayType(type) function list:SetDisplayType(type)
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
self.display = type self.display = type
@ -432,8 +431,8 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetPadding(amount) function list:SetPadding(amount)
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
self.padding = amount self.padding = amount
@ -450,8 +449,8 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetSpacing(amount) function list:SetSpacing(amount)
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
self.spacing = amount self.spacing = amount

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
@ -68,13 +68,13 @@ function panel:draw()
return return
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 = skins[selfskin] or skins[skinindex]
local skin = loveframes.skins.available[selfskin] or loveframes.skins.available[index] or loveframes.skins.available[defaultskin] 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
@ -46,12 +46,12 @@ function progressbar:update(dt)
end end
end end
local lerp = self.lerp local lerp = self.lerp
local lerprate = self.lerprate local lerprate = self.lerprate
local lerpvalue = self.lerpvalue local lerpvalue = self.lerpvalue
local lerpto = self.lerpto local lerpto = self.lerpto
local lerpfrom = self.lerpfrom local lerpfrom = self.lerpfrom
local value = self.value local value = self.value
local completed = self.completed local completed = self.completed
self:CheckHover() self:CheckHover()
@ -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
@ -49,13 +49,13 @@ function slider:update(dt)
end end
end end
local internals = self.internals local internals = self.internals
local sliderbutton = internals[1] local sliderbutton = internals[1]
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
@ -91,21 +91,21 @@ function slider:draw()
return return
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
@ -186,9 +186,9 @@ function slider:SetValue(value)
return return
end end
local decimals = self.decimals local decimals = self.decimals
local newval = loveframes.util.Round(value, decimals) local newval = loveframes.util.Round(value, decimals)
local internals = self.internals local internals = self.internals
-- set the new value -- set the new value
self.value = newval self.value = newval
@ -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 = {}
@ -47,17 +47,17 @@ function tabs:update(dt)
end end
end end
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local tabheight = self.tabheight local tabheight = self.tabheight
local padding = self.padding local padding = self.padding
local autosize = self.autosize local autosize = self.autosize
local tabheight = self.tabheight local tabheight = self.tabheight
local padding = self.padding local padding = self.padding
local autosize = self.autosize local autosize = self.autosize
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
local internals = self.internals local internals = self.internals
local tab = self.tab local tab = self.tab
-- move to parent if there is a parent -- move to parent if there is a parent
if self.parent ~= loveframes.base then if self.parent ~= loveframes.base then
@ -105,27 +105,27 @@ function tabs:draw()
return return
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
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.DrawText or skins[defaultskin].DrawText
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.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
@ -14,29 +14,32 @@ textinput:include(loveframes.templates.default)
function textinput:initialize() 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
self.delay = 0 self.delay = 0
self.xoffset = 0 self.xoffset = 0
self.blink = 0 self.blink = 0
self.blinknum = 0 self.blinknum = 0
self.blinkx = 0 self.blinkx = 0
self.blinky = 0 self.blinky = 0
self.textx = 0 self.textx = 0
self.texty = 0 self.texty = 0
self.textxoffset = 0 self.textxoffset = 0
self.textyoffset = 0 self.textyoffset = 0
self.unicode = 0 self.unicode = 0
self.showblink = true self.limit = 0
self.focus = false self.usable = {}
self.internal = false self.unusable = {}
self.OnEnter = nil self.showblink = true
self.OnTextEntered = nil self.focus = false
self.internal = false
self.OnEnter = nil
self.OnTextEntered = nil
end end
@ -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)
@ -98,31 +102,32 @@ function textinput:draw()
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
local font = self.font local font = self.font
local textcolor = self.textcolor local textcolor = self.textcolor
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
local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"]
local stencilfunc = function() love.graphics.rectangle("fill", self.x, self.y, self.width, self.height) end
local stencil = love.graphics.newStencil(stencilfunc)
local selfskin = self.skin
local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawTextInput or skins[defaultskin].DrawTextInput
-- skin variables love.graphics.setStencil(stencilfunc)
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]
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)
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()
@ -138,7 +143,7 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:mousepressed(x, y, button) function textinput:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
if visible == false then if visible == false then
return return
@ -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,20 +259,30 @@ function textinput:RunKey(key, unicode)
self.unicode = unicode self.unicode = unicode
if key == "left" then if key == "left" then
self:MoveBlinker(-1) if self.alltextselected == true then
if blinkx <= self.x and blinknum ~= 0 then self.alltextselected = false
local width = self.font:getWidth(self.text:sub(blinknum, blinknum + 1)) self.blinknum = 0
self.xoffset = self.xoffset + width else
elseif blinknum == 0 and self.xoffset ~= 0 then self:MoveBlinker(-1)
self.xoffset = 0 if blinkx <= self.x and blinknum ~= 0 then
local width = self.font:getWidth(self.text:sub(blinknum, blinknum + 1))
self.xoffset = self.xoffset + width
elseif blinknum == 0 and self.xoffset ~= 0 then
self.xoffset = 0
end
end end
elseif key == "right" then elseif key == "right" then
self:MoveBlinker(1) if self.alltextselected == true then
if blinkx >= self.x + swidth and blinknum ~= #self.text then self.alltextselected = false
local width = self.font:getWidth(self.text:sub(blinknum, blinknum)) self.blinknum = #self.text
self.xoffset = self.xoffset - width*2 else
elseif blinknum == #self.text and self.xoffset ~= ((0 - font:getWidth(self.text)) + swidth) and font:getWidth(self.text) + self.textxoffset > self.width then self:MoveBlinker(1)
self.xoffset = ((0 - font:getWidth(self.text)) + swidth) if blinkx >= self.x + swidth and blinknum ~= #self.text then
local width = self.font:getWidth(self.text:sub(blinknum, blinknum))
self.xoffset = self.xoffset - width*2
elseif blinknum == #self.text and self.xoffset ~= ((0 - font:getWidth(self.text)) + swidth) and font:getWidth(self.text) + self.textxoffset > self.width then
self.xoffset = ((0 - font:getWidth(self.text)) + swidth)
end
end end
end end
@ -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,19 +353,13 @@ function textinput:RunKey(key, unicode)
self.OnTextEntered(self, ckey) self.OnTextEntered(self, ckey)
end end
end local cwidth = font:getWidth(ckey)
end
-- swidth - 1 is for the "-" character
if (twidth + textxoffset) >= (swidth - 1) then
self.xoffset = self.xoffset - cwidth
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)
-- swidth - 1 is for the "-" character
if (twidth + textxoffset) >= (swidth - 1) then
self.xoffset = self.xoffset - cwidth
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,33 +233,30 @@ 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
percent = i/height * 255
for i=1, height - 1 do color = {color[1], color[2], color[3], loveframes.util.Round(percent)}
percent = i/height * 255 love.graphics.setColor(unpack(color))
color = {color[1], color[2], color[3], loveframes.util.Round(percent)} love.graphics.rectangle("fill", x, y + i, width, 1)
love.graphics.setColor(unpack(color))
love.graphics.rectangle("fill", x, y + i, width, 1)
end
end end
end end
@ -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,26 +238,20 @@ 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
percent = i/height * 255
for i=1, height - 1 do color = {color[1], color[2], color[3], loveframes.util.Round(percent)}
percent = i/height * 255 love.graphics.setColor(unpack(color))
color = {color[1], color[2], color[3], loveframes.util.Round(percent)} love.graphics.rectangle("fill", x, y + i, width, 1)
love.graphics.setColor(unpack(color))
love.graphics.rectangle("fill", x, y + i, width, 1)
end
end end
end end
@ -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