2013-02-11 21:15:40 +00:00
|
|
|
--[[------------------------------------------------
|
|
|
|
-- Love Frames - A GUI library for LOVE --
|
2014-01-14 11:29:11 +00:00
|
|
|
-- Copyright (c) 2012-2014 Kenny Shields --
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]------------------------------------------------
|
|
|
|
|
2019-03-06 23:19:58 +00:00
|
|
|
return function(loveframes)
|
|
|
|
---------- module start ----------
|
2014-10-23 22:36:16 +00:00
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
-- util library
|
2019-03-06 23:19:58 +00:00
|
|
|
--local util = {}
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: SetState(name)
|
|
|
|
- desc: sets the current state
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function loveframes.SetState(name)
|
|
|
|
|
|
|
|
loveframes.state = name
|
|
|
|
loveframes.base.state = name
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: GetState()
|
|
|
|
- desc: gets the current state
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function loveframes.GetState()
|
|
|
|
|
|
|
|
return loveframes.state
|
|
|
|
|
|
|
|
end
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: SetActiveSkin(name)
|
|
|
|
- desc: sets the active skin
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.SetActiveSkin(name)
|
|
|
|
local skin = name and loveframes.skins[name]
|
|
|
|
if not skin then print("SetActiveSkin: no such skin") return end
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
loveframes.config["ACTIVESKIN"] = name
|
2019-03-06 23:19:58 +00:00
|
|
|
local object = loveframes.base
|
|
|
|
object:SetSkin(name)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: GetActiveSkin()
|
|
|
|
- desc: gets the active skin
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetActiveSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local index = loveframes.config["ACTIVESKIN"]
|
2019-03-06 23:19:58 +00:00
|
|
|
return loveframes.skins[index]
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: BoundingBox(x1, x2, y1, y2, w1, w2, h1, h2)
|
|
|
|
- desc: checks for a collision between two boxes
|
2013-08-12 13:48:51 +00:00
|
|
|
- note: I take no credit for this function
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.BoundingBox(x1, x2, y1, y2, w1, w2, h1, h2)
|
2013-02-11 21:15:40 +00:00
|
|
|
if x1 > x2 + w2 - 1 or y1 > y2 + h2 - 1 or x2 > x1 + w1 - 1 or y2 > y1 + h1 - 1 then
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: GetCollisions(object, table)
|
2013-02-11 21:15:40 +00:00
|
|
|
- desc: gets all objects colliding with the mouse
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetCollisions(object, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
local x, y = love.mouse.getPosition()
|
2013-05-15 18:02:55 +00:00
|
|
|
local curstate = loveframes.state
|
2013-02-11 21:15:40 +00:00
|
|
|
local object = object or loveframes.base
|
2013-05-15 18:02:55 +00:00
|
|
|
local visible = object.visible
|
|
|
|
local children = object.children
|
|
|
|
local internals = object.internals
|
|
|
|
local objectstate = object.state
|
2013-02-11 21:15:40 +00:00
|
|
|
local t = t or {}
|
|
|
|
|
2013-05-15 18:02:55 +00:00
|
|
|
if objectstate == curstate and visible then
|
|
|
|
local objectx = object.x
|
|
|
|
local objecty = object.y
|
|
|
|
local objectwidth = object.width
|
|
|
|
local objectheight = object.height
|
2019-03-06 23:19:58 +00:00
|
|
|
local col = loveframes.BoundingBox(x, objectx, y, objecty, 1, objectwidth, 1, objectheight)
|
2013-05-15 18:02:55 +00:00
|
|
|
local collide = object.collide
|
|
|
|
if col and collide then
|
|
|
|
local clickbounds = object.clickbounds
|
|
|
|
if clickbounds then
|
|
|
|
local cx = clickbounds.x
|
|
|
|
local cy = clickbounds.y
|
|
|
|
local cwidth = clickbounds.width
|
|
|
|
local cheight = clickbounds.height
|
2019-03-06 23:19:58 +00:00
|
|
|
local clickcol = loveframes.BoundingBox(x, cx, y, cy, 1, cwidth, 1, cheight)
|
2013-02-11 21:15:40 +00:00
|
|
|
if clickcol then
|
|
|
|
table.insert(t, object)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
table.insert(t, object)
|
|
|
|
end
|
|
|
|
end
|
2013-05-15 18:02:55 +00:00
|
|
|
if children then
|
|
|
|
for k, v in ipairs(children) do
|
2019-03-06 23:19:58 +00:00
|
|
|
loveframes.GetCollisions(v, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
end
|
2013-05-15 18:02:55 +00:00
|
|
|
if internals then
|
|
|
|
for k, v in ipairs(internals) do
|
|
|
|
local type = v.type
|
|
|
|
if type ~= "tooltip" then
|
2019-03-06 23:19:58 +00:00
|
|
|
loveframes.GetCollisions(v, t)
|
2013-05-15 18:02:55 +00:00
|
|
|
end
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return t
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: GetAllObjects(object, table)
|
2013-02-11 21:15:40 +00:00
|
|
|
- desc: gets all active objects
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetAllObjects(object, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
local object = object or loveframes.base
|
|
|
|
local internals = object.internals
|
|
|
|
local children = object.children
|
|
|
|
local t = t or {}
|
|
|
|
|
|
|
|
table.insert(t, object)
|
|
|
|
|
|
|
|
if internals then
|
|
|
|
for k, v in ipairs(internals) do
|
2019-03-06 23:19:58 +00:00
|
|
|
loveframes.GetAllObjects(v, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if children then
|
|
|
|
for k, v in ipairs(children) do
|
2019-03-06 23:19:58 +00:00
|
|
|
loveframes.GetAllObjects(v, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return t
|
2019-03-06 23:19:58 +00:00
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: GetDirectoryContents(directory, table)
|
|
|
|
- desc: gets the contents of a directory and all of
|
2013-03-23 19:50:44 +00:00
|
|
|
its subdirectories
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetDirectoryContents(dir, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
local dir = dir
|
|
|
|
local t = t or {}
|
|
|
|
local dirs = {}
|
2014-04-03 22:55:46 +00:00
|
|
|
local files = love.filesystem.getDirectoryItems(dir)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
for k, v in ipairs(files) do
|
2018-04-15 01:23:26 +00:00
|
|
|
local isdir = love.filesystem.getInfo(dir.. "/" ..v) ~= nil and love.filesystem.getInfo(dir.. "/" ..v)["type"] == "directory" --love.filesystem.isDirectory(dir.. "/" ..v)
|
2013-02-11 21:15:40 +00:00
|
|
|
if isdir == true then
|
|
|
|
table.insert(dirs, dir.. "/" ..v)
|
|
|
|
else
|
2019-03-06 23:19:58 +00:00
|
|
|
local parts = loveframes.SplitString(v, "([.])")
|
2014-08-10 19:11:30 +00:00
|
|
|
local extension = #parts > 1 and parts[#parts]
|
|
|
|
if #parts > 1 then
|
|
|
|
parts[#parts] = nil
|
|
|
|
end
|
|
|
|
local name = table.concat(parts, ".")
|
2014-02-26 12:37:20 +00:00
|
|
|
table.insert(t, {
|
|
|
|
path = dir,
|
|
|
|
fullpath = dir.. "/" ..v,
|
|
|
|
requirepath = dir:gsub("/", ".") .. "." ..name,
|
|
|
|
name = name,
|
|
|
|
extension = extension
|
|
|
|
})
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-10 19:11:30 +00:00
|
|
|
for k, v in ipairs(dirs) do
|
2019-03-06 23:19:58 +00:00
|
|
|
t = loveframes.GetDirectoryContents(v, t)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return t
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: Round(num, idp)
|
|
|
|
- desc: rounds a number based on the decimal limit
|
2013-08-12 13:48:51 +00:00
|
|
|
- note: I take no credit for this function
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.Round(num, idp)
|
2013-02-11 21:15:40 +00:00
|
|
|
local mult = 10^(idp or 0)
|
|
|
|
|
|
|
|
if num >= 0 then
|
|
|
|
return math.floor(num * mult + 0.5) / mult
|
|
|
|
else
|
|
|
|
return math.ceil(num * mult - 0.5) / mult
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: SplitString(string, pattern)
|
|
|
|
- desc: splits a string into a table based on a given pattern
|
2013-08-12 13:48:51 +00:00
|
|
|
- note: I take no credit for this function
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.SplitString(str, pat)
|
2013-02-11 21:15:40 +00:00
|
|
|
local t = {} -- NOTE: use {n = 0} in Lua-5.0
|
|
|
|
|
|
|
|
if pat == " " then
|
|
|
|
local fpat = "(.-)" .. pat
|
|
|
|
local last_end = 1
|
|
|
|
local s, e, cap = str:find(fpat, 1)
|
|
|
|
while s do
|
|
|
|
if s ~= #str then
|
|
|
|
cap = cap .. " "
|
|
|
|
end
|
|
|
|
if s ~= 1 or cap ~= "" then
|
|
|
|
table.insert(t,cap)
|
|
|
|
end
|
|
|
|
last_end = e+1
|
|
|
|
s, e, cap = str:find(fpat, last_end)
|
|
|
|
end
|
|
|
|
if last_end <= #str then
|
|
|
|
cap = str:sub(last_end)
|
|
|
|
table.insert(t, cap)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local fpat = "(.-)" .. pat
|
|
|
|
local last_end = 1
|
|
|
|
local s, e, cap = str:find(fpat, 1)
|
|
|
|
while s do
|
|
|
|
if s ~= 1 or cap ~= "" then
|
|
|
|
table.insert(t,cap)
|
|
|
|
end
|
|
|
|
last_end = e+1
|
|
|
|
s, e, cap = str:find(fpat, last_end)
|
|
|
|
end
|
|
|
|
if last_end <= #str then
|
|
|
|
cap = str:sub(last_end)
|
|
|
|
table.insert(t, cap)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return t
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: RemoveAll()
|
|
|
|
- desc: removes all gui elements
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.RemoveAll()
|
2013-02-11 21:15:40 +00:00
|
|
|
loveframes.base.children = {}
|
|
|
|
loveframes.base.internals = {}
|
|
|
|
|
2013-08-15 02:09:22 +00:00
|
|
|
loveframes.hoverobject = false
|
2013-10-30 23:05:10 +00:00
|
|
|
loveframes.downobject = false
|
2013-08-15 02:09:22 +00:00
|
|
|
loveframes.modalobject = false
|
|
|
|
loveframes.inputobject = false
|
|
|
|
loveframes.hover = false
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
2013-09-16 21:29:53 +00:00
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: TableHasValue(table, value)
|
2013-09-16 21:29:53 +00:00
|
|
|
- desc: checks to see if a table has a specific value
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.TableHasValue(table, value)
|
2013-09-16 21:29:53 +00:00
|
|
|
for k, v in pairs(table) do
|
|
|
|
if v == value then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: TableHasKey(table, key)
|
2013-02-11 21:15:40 +00:00
|
|
|
- desc: checks to see if a table has a specific key
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.TableHasKey(table, key)
|
2014-01-27 12:42:18 +00:00
|
|
|
return table[key] ~= nil
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: Error(message)
|
2013-02-11 21:15:40 +00:00
|
|
|
- desc: displays a formatted error message
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.Error(message)
|
2013-02-11 21:15:40 +00:00
|
|
|
error("[Love Frames] " ..message)
|
2013-06-10 16:34:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: GetCollisionCount()
|
2013-06-10 16:34:01 +00:00
|
|
|
- desc: gets the total number of objects colliding with
|
|
|
|
the mouse
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetCollisionCount()
|
2014-01-27 12:43:45 +00:00
|
|
|
return loveframes.collisioncount
|
2013-06-10 16:34:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: GetHover()
|
2013-06-10 16:34:01 +00:00
|
|
|
- desc: returns loveframes.hover, can be used to check
|
|
|
|
if the mouse is colliding with a visible
|
|
|
|
Love Frames object
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetHover()
|
2013-06-10 16:34:01 +00:00
|
|
|
return loveframes.hover
|
|
|
|
end
|
2013-08-12 13:48:51 +00:00
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: RectangleCollisionCheck(rect1, rect2)
|
|
|
|
- desc: checks for a collision between two rectangles
|
|
|
|
based on two tables containing rectangle sizes
|
|
|
|
and positions
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.RectangleCollisionCheck(rect1, rect2)
|
|
|
|
return loveframes.BoundingBox(rect1.x, rect2.x, rect1.y, rect2.y, rect1.width, rect2.width, rect1.height, rect2.height)
|
2013-08-12 13:48:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: DeepCopy(orig)
|
2013-08-12 13:48:51 +00:00
|
|
|
- desc: copies a table
|
|
|
|
- note: I take not credit for this function
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.DeepCopy(orig)
|
|
|
|
local orig_type = type(orig)
|
|
|
|
local copy
|
|
|
|
if orig_type == 'table' then
|
|
|
|
copy = {}
|
|
|
|
for orig_key, orig_value in next, orig, nil do
|
|
|
|
copy[loveframes.DeepCopy(orig_key)] = loveframes.DeepCopy(orig_value)
|
|
|
|
end
|
|
|
|
setmetatable(copy, loveframes.DeepCopy(getmetatable(orig)))
|
|
|
|
else -- number, string, boolean, etc
|
|
|
|
copy = orig
|
|
|
|
end
|
|
|
|
return copy
|
2013-10-31 08:10:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: GetHoverObject()
|
2013-10-31 08:10:56 +00:00
|
|
|
- desc: returns loveframes.hoverobject
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.GetHoverObject()
|
2013-10-31 08:10:56 +00:00
|
|
|
|
|
|
|
return loveframes.hoverobject
|
|
|
|
|
2013-12-03 21:56:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
2014-08-10 18:40:30 +00:00
|
|
|
- func: IsCtrlDown()
|
2013-12-03 21:56:33 +00:00
|
|
|
- desc: checks for ctrl, for use with multiselect, copy,
|
|
|
|
paste, and such. On OS X it actually looks for cmd.
|
|
|
|
--]]---------------------------------------------------------
|
2019-03-06 23:19:58 +00:00
|
|
|
function loveframes.IsCtrlDown()
|
2013-12-03 21:56:33 +00:00
|
|
|
if love._os == "OS X" then
|
|
|
|
return love.keyboard.isDown("lmeta") or love.keyboard.isDown("rmeta") or
|
|
|
|
love.keyboard.isDown("lgui") or love.keyboard.isDown("rgui")
|
|
|
|
end
|
|
|
|
return love.keyboard.isDown("lctrl") or love.keyboard.isDown("rctrl")
|
2014-11-09 21:24:10 +00:00
|
|
|
end
|
2019-03-06 23:19:58 +00:00
|
|
|
|
|
|
|
function loveframes.Color(s, a)
|
|
|
|
local r, g, b = string.match(s, '#?(%x%x)(%x%x)(%x%x)')
|
|
|
|
if r == nil then return end
|
|
|
|
return tonumber(r, 16) / 0xFF, tonumber(g, 16) / 0xFF, tonumber(b, 16) / 0xFF, a or 1
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: draw()
|
|
|
|
- desc: draws debug information
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function loveframes.DebugDraw()
|
|
|
|
local infox = 5
|
|
|
|
local infoy = 40
|
|
|
|
local topcol = {type = "None", children = {}, x = 0, y = 0, width = 0, height = 0}
|
|
|
|
local hoverobject = loveframes.hoverobject
|
|
|
|
--local objects = loveframes.GetAllObjects()
|
|
|
|
local version = loveframes.version
|
|
|
|
local stage = loveframes.stage
|
|
|
|
local basedir = loveframes.config["DIRECTORY"]
|
|
|
|
local loveversion = love._version
|
|
|
|
local fps = love.timer.getFPS()
|
|
|
|
local deltatime = love.timer.getDelta()
|
|
|
|
local font = loveframes.basicfontsmall
|
|
|
|
|
|
|
|
if hoverobject then
|
|
|
|
topcol = hoverobject
|
|
|
|
end
|
|
|
|
|
|
|
|
-- show frame docking zones
|
|
|
|
if topcol.type == "frame" then
|
|
|
|
for k, v in pairs(topcol.dockzones) do
|
|
|
|
love.graphics.setLineWidth(1)
|
|
|
|
love.graphics.setColor(255/255, 0, 0, 100/255)
|
|
|
|
love.graphics.rectangle("fill", v.x, v.y, v.width, v.height)
|
|
|
|
love.graphics.setColor(255/255, 0, 0, 255/255)
|
|
|
|
love.graphics.rectangle("line", v.x, v.y, v.width, v.height)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- outline the object that the mouse is hovering over
|
|
|
|
love.graphics.setColor(255/255, 204/255, 51/255, 255/255)
|
|
|
|
love.graphics.setLineWidth(2)
|
|
|
|
love.graphics.rectangle("line", topcol.x - 1, topcol.y - 1, topcol.width + 2, topcol.height + 2)
|
|
|
|
|
|
|
|
-- draw main debug box
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(0, 0, 0, 200/255)
|
|
|
|
love.graphics.rectangle("fill", infox, infoy, 200, 70)
|
|
|
|
love.graphics.setColor(255/255, 0, 0, 255/255)
|
|
|
|
love.graphics.print("Love Frames - Debug (" ..version.. " - " ..stage.. ")", infox + 5, infoy + 5)
|
|
|
|
love.graphics.setColor(255/255, 255/255, 255/255, 255/255)
|
|
|
|
love.graphics.print("LOVE Version: " ..loveversion, infox + 10, infoy + 20)
|
|
|
|
love.graphics.print("FPS: " ..fps, infox + 10, infoy + 30)
|
|
|
|
love.graphics.print("Delta Time: " ..deltatime, infox + 10, infoy + 40)
|
|
|
|
love.graphics.print("Total Objects: " ..loveframes.objectcount, infox + 10, infoy + 50)
|
|
|
|
|
|
|
|
-- draw object information if needed
|
|
|
|
if topcol.type ~= "base" then
|
|
|
|
love.graphics.setColor(0, 0, 0, 200/255)
|
|
|
|
love.graphics.rectangle("fill", infox, infoy + 75, 200, 100)
|
|
|
|
love.graphics.setColor(255/255, 0, 0, 255/255)
|
|
|
|
love.graphics.print("Object Information", infox + 5, infoy + 80)
|
|
|
|
love.graphics.setColor(255/255, 255/255, 255/255, 255/255)
|
|
|
|
love.graphics.print("Type: " ..topcol.type, infox + 10, infoy + 95)
|
|
|
|
if topcol.children then
|
|
|
|
love.graphics.print("# of children: " .. #topcol.children, infox + 10, infoy + 105)
|
|
|
|
else
|
|
|
|
love.graphics.print("# of children: 0", infox + 10, infoy + 105)
|
|
|
|
end
|
|
|
|
if topcol.internals then
|
|
|
|
love.graphics.print("# of internals: " .. #topcol.internals, infox + 10, infoy + 115)
|
|
|
|
else
|
|
|
|
love.graphics.print("# of internals: 0", infox + 10, infoy + 115)
|
|
|
|
end
|
|
|
|
love.graphics.print("X: " ..topcol.x, infox + 10, infoy + 125)
|
|
|
|
love.graphics.print("Y: " ..topcol.y, infox + 10, infoy + 135)
|
|
|
|
love.graphics.print("Width: " ..topcol.width, infox + 10, infoy + 145)
|
|
|
|
love.graphics.print("Height: " ..topcol.height, infox + 10, infoy + 155)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--return util
|
|
|
|
|
|
|
|
---------- module end ----------
|
|
|
|
end
|