Version 0.9.5.8 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2013-05-05 19:51:20 -04:00
parent ed8a78a10c
commit 0723726757
14 changed files with 667 additions and 29 deletions

View File

@ -1,3 +1,22 @@
================================================
Version 0.9.5.8 - Alpha (May 5 - 2013)
================================================
[ADDED] a new textinput method: SetValue(value) (alias of SetText(text))
[ADDED] a new textinput method: GetValue() (alias of GetText())
[ADDED] a new object: grid
[ADDED] a new frame method: SetIcon(icon)
[ADDED] a new frame method: GetIcon()
[ADDED] a new callback for the slider object: OnRelease(object)
[ADDED] a new text method: SetDefaultColor(r, g, b, a)
[ADDED] a new text method: GetDefaultColor()
[FIXED] OnOpened and OnClosed callbacks for tabbuttons not being asigned properly
[FIXED] the image object not checking its hover state
[FIXED] tabbutton rendering issues with the default skins
[FIXED] some padding issues with multiline textinputs
[CHANGED] loveframes.config["DIRECTORY"] no longer needs to be set when installing Love Frames
================================================ ================================================
Version 0.9.5.7 - Alpha (April 9 - 2013) Version 0.9.5.7 - Alpha (April 9 - 2013)
================================================ ================================================

View File

@ -263,6 +263,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Frame") frame1:SetName("Frame")
frame1:CenterWithinArea(unpack(centerarea)) frame1:CenterWithinArea(unpack(centerarea))
frame1:SetIcon("resources/images/application.png")
local text1 = loveframes.Create("text", frame1) local text1 = loveframes.Create("text", frame1)
text1:SetText("This is an example frame.") text1:SetText("This is an example frame.")
@ -294,6 +295,51 @@ function loveframes.debug.ExamplesMenu()
end end
exampleslist:AddItem(frameexample) exampleslist:AddItem(frameexample)
------------------------------------
-- grid example
------------------------------------
local gridexample = loveframes.Create("button")
gridexample:SetText("Grid")
gridexample.OnClick = function(object1, x, y)
local frame = loveframes.Create("frame")
frame:SetName("Grid")
frame:CenterWithinArea(unpack(centerarea))
--local panel = loveframes.Create("panel")
--panel:SetSize(500, 300)
--panel:CenterWithinArea(unpack(centerarea))
local grid = loveframes.Create("grid", frame)
grid:SetPos(5, 30)
grid:SetRows(5)
grid:SetColumns(5)
grid:SetCellWidth(25)
grid:SetCellHeight(25)
grid:SetCellPadding(5)
grid:SetItemAutoSize(true)
local id = 1
for i=1, 5 do
for n=1, 5 do
local button = loveframes.Create("button")
button:SetSize(15, 15)
button:SetText(id)
grid:AddItem(button, i, n)
id = id + 1
end
end
grid.OnSizeChanged = function(object)
frame:SetSize(object:GetWidth() + 10, object:GetHeight() + 35)
frame:CenterWithinArea(unpack(centerarea))
end
end
exampleslist:AddItem(gridexample)
------------------------------------ ------------------------------------
-- image example -- image example
------------------------------------ ------------------------------------

View File

@ -3,18 +3,21 @@
-- Copyright (c) 2013 Kenny Shields -- -- Copyright (c) 2013 Kenny Shields --
--]]------------------------------------------------ --]]------------------------------------------------
--
local path = ...
-- central library table -- central library table
loveframes = {} loveframes = {}
-- library info -- library info
loveframes.info = {} loveframes.info = {}
loveframes.info.author = "Kenny Shields" loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.5.7" loveframes.info.version = "0.9.5.8"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations
loveframes.config = {} loveframes.config = {}
loveframes.config["DIRECTORY"] = "" loveframes.config["DIRECTORY"] = nil
loveframes.config["DEFAULTSKIN"] = "Blue" loveframes.config["DEFAULTSKIN"] = "Blue"
loveframes.config["ACTIVESKIN"] = "Blue" loveframes.config["ACTIVESKIN"] = "Blue"
loveframes.config["INDEXSKINIMAGES"] = true loveframes.config["INDEXSKINIMAGES"] = true
@ -37,7 +40,7 @@ loveframes.objects = {}
function loveframes.load() function loveframes.load()
-- install directory of the library -- install directory of the library
local dir = loveframes.config["DIRECTORY"] local dir = loveframes.config["DIRECTORY"] or path
-- require the internal base libraries -- require the internal base libraries
require(dir .. ".third-party.middleclass") require(dir .. ".third-party.middleclass")

View File

@ -28,6 +28,7 @@ function newobject:initialize()
self.showclose = true self.showclose = true
self.internals = {} self.internals = {}
self.children = {} self.children = {}
self.icon = nil
self.OnClose = nil self.OnClose = nil
-- create the close button for the frame -- create the close button for the frame
@ -536,3 +537,33 @@ function newobject:GetParentLocked()
return self.parentlocked return self.parentlocked
end end
--[[---------------------------------------------------------
- func: SetIcon(icon)
- desc: sets the object's icon
--]]---------------------------------------------------------
function newobject:SetIcon(icon)
if type(icon) == "string" then
self.icon = love.graphics.newImage(icon)
else
self.icon = icon
end
end
--[[---------------------------------------------------------
- func: GetIcon()
- desc: gets the object's icon
--]]---------------------------------------------------------
function newobject:GetIcon()
local icon = self.icon
if icon then
return icon
end
return false
end

386
objects/grid.lua Normal file
View File

@ -0,0 +1,386 @@
--[[------------------------------------------------
-- Love Frames - A GUI library for LOVE --
-- Copyright (c) 2013 Kenny Shields --
--]]------------------------------------------------
-- button class
local newobject = loveframes.NewObject("grid", "loveframes_object_grid", true)
--[[---------------------------------------------------------
- func: initialize()
- desc: initializes the object
--]]---------------------------------------------------------
function newobject:initialize()
self.type = "grid"
self.width = 100
self.height = 100
self.prevwidth = 100
self.prevheight = 100
self.rows = 0
self.columns = 0
self.cellwidth = 25
self.cellheight = 25
self.cellpadding = 5
self.itemautosize = false
self.children = {}
self.OnSizeChanged = nil
end
--[[---------------------------------------------------------
- func: update(deltatime)
- desc: updates the object
--]]---------------------------------------------------------
function newobject:update(dt)
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
local alwaysupdate = self.alwaysupdate
if not visible then
if not alwaysupdate then
return
end
end
self:CheckHover()
local parent = self.parent
local children = self.children
-- move to parent if there is a parent
if parent ~= base then
self.x = self.parent.x + self.staticx
self.y = self.parent.y + self.staticy
end
local cw = self.cellwidth + (self.cellpadding * 2)
local ch = self.cellheight + (self.cellpadding * 2)
local prevwidth = self.prevwidth
local prevheight = self.prevheight
self.width = (self.columns * self.cellwidth) + (self.columns * (self.cellpadding * 2))
self.height = (self.rows * self.cellheight) + (self.rows * (self.cellpadding * 2))
if self.width ~= prevwidth or self.height ~= prevheight then
local onsizechanged = self.OnSizeChanged
self.prevwidth = self.width
self.prevheight = self.height
if onsizechanged then
onsizechanged(self)
end
end
for k, v in ipairs(children) do
local x = 0 + ((cw * v.gridcolumn) - cw ) + (cw/2 - v.width/2)
local y = 0 + ((ch * v.gridrow) - ch) + (ch/2 - v.height/2)
v.staticx = x
v.staticy = y
v:update(dt)
end
if update then
update(self, dt)
end
end
--[[---------------------------------------------------------
- func: draw()
- desc: draws the object
--]]---------------------------------------------------------
function newobject:draw()
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
if not visible then
return
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.DrawGrid or skins[defaultskin].DrawGrid
local draw = self.Draw
local drawcount = loveframes.drawcount
local children = self.children
-- set the object's draw order
self:SetDrawOrder()
if draw then
draw(self)
else
drawfunc(self)
end
for k, v in ipairs(children) do
v:draw()
end
end
--[[---------------------------------------------------------
- func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button
--]]---------------------------------------------------------
function newobject:mousepressed(x, y, button)
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
if not visible then
return
end
local children = self.children
local hover = self.hover
if hover and button == "l" then
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
end
for k, v in ipairs(children) do
v:mousepressed(x, y, button)
end
end
--[[---------------------------------------------------------
- func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button
--]]---------------------------------------------------------
function newobject:mousereleased(x, y, button)
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
local children = self.children
if not visible then
return
end
for k, v in ipairs(children) do
v:mousereleased(x, y, button)
end
end
--[[---------------------------------------------------------
- func: AddItem(object, row, column)
- desc: adds and item to the object
--]]---------------------------------------------------------
function newobject:AddItem(object, row, column)
local itemautosize = self.itemautosize
local children = self.children
object:Remove()
table.insert(children, object)
object.parent = self
object.gridrow = row
object.gridcolumn = column
if itemautosize then
local cw = self.cellwidth + (self.cellpadding * 2)
local ch = self.cellheight + (self.cellpadding * 2)
object.width = cw - (self.cellpadding * 2)
object.height = ch - (self.cellpadding * 2)
end
end
--[[---------------------------------------------------------
- func: GetItem(row, column)
- desc: gets an item from the object at the specified
row and column
--]]---------------------------------------------------------
function newobject:GetItem(row, column)
local children = self.children
for k, v in ipairs(children) do
if v.gridrow == row and v.gridcolumn == column then
return v
end
end
return false
end
--[[---------------------------------------------------------
- func: SetItemAutoSize(bool)
- desc: sets whether or not the object should auto-size
its items
--]]---------------------------------------------------------
function newobject:SetItemAutoSize(bool)
self.itemautosize = bool
end
--[[---------------------------------------------------------
- func: GetItemAutoSize()
- desc: gets whether or not the object should auto-size
its items
--]]---------------------------------------------------------
function newobject:GetItemAutoSize()
return self.itemautosize
end
--[[---------------------------------------------------------
- func: SetRows(rows)
- desc: sets the number of rows the object should have
--]]---------------------------------------------------------
function newobject:SetRows(rows)
self.rows = rows
end
--[[---------------------------------------------------------
- func: SetRows(rows)
- desc: gets the number of rows the object has
--]]---------------------------------------------------------
function newobject:GetRows()
return self.rows
end
--[[---------------------------------------------------------
- func: SetColumns(columns)
- desc: sets the number of columns the object should
have
--]]---------------------------------------------------------
function newobject:SetColumns(columns)
self.columns = columns
end
--[[---------------------------------------------------------
- func: GetColumns()
- desc: gets the number of columns the object has
--]]---------------------------------------------------------
function newobject:GetColumns()
return self.columns
end
--[[---------------------------------------------------------
- func: SetCellWidth(width)
- desc: sets the width of the object's cells
--]]---------------------------------------------------------
function newobject:SetCellWidth(width)
self.cellwidth = width
end
--[[---------------------------------------------------------
- func: GetCellWidth()
- desc: gets the width of the object's cells
--]]---------------------------------------------------------
function newobject:GetCellWidth()
return self.cellwidth
end
--[[---------------------------------------------------------
- func: SetCellHeight(height)
- desc: sets the height of the object's cells
--]]---------------------------------------------------------
function newobject:SetCellHeight(height)
self.cellheight = height
end
--[[---------------------------------------------------------
- func: GetCellHeight()
- desc: gets the height of the object's cells
--]]---------------------------------------------------------
function newobject:GetCellHeight()
return self.cellheight
end
--[[---------------------------------------------------------
- func: SetCellSize(width, height)
- desc: sets the size of the object's cells
--]]---------------------------------------------------------
function newobject:SetCellSize(width, height)
self.cellwidth = width
self.cellheight = height
end
--[[---------------------------------------------------------
- func: GetCellSize()
- desc: gets the size of the object's cells
--]]---------------------------------------------------------
function newobject:GetCellSize()
return self.cellwidth, self.cellheight
end
--[[---------------------------------------------------------
- func: SetCellPadding(padding)
- desc: sets the padding of the object's cells
--]]---------------------------------------------------------
function newobject:SetCellPadding(padding)
self.cellpadding = padding
end
--[[---------------------------------------------------------
- func: GetCellPadding
- desc: gets the padding of the object's cells
--]]---------------------------------------------------------
function newobject:GetCellPadding()
return self.cellpadding
end

View File

@ -54,6 +54,8 @@ function newobject:update(dt)
local base = loveframes.base local base = loveframes.base
local update = self.Update local update = self.Update
self:CheckHover()
-- move to parent if there is a parent -- move to parent if there is a parent
if parent ~= base then if parent ~= base then
self.x = self.parent.x + self.staticx self.x = self.parent.x + self.staticx

View File

@ -60,7 +60,6 @@ function newobject:update(dt)
local parent = self.parent local parent = self.parent
local slidetype = parent.slidetype local slidetype = parent.slidetype
local dragging = self.dragging local dragging = self.dragging
local parent = self.parent
local base = loveframes.base local base = loveframes.base
local update = self.Update local update = self.Update
@ -218,6 +217,17 @@ function newobject:mousereleased(x, y, button)
return return
end end
local down = self.down
local dragging = self.dragging
if down and dragging then
local parent = self.parent
local onrelease = parent.OnRelease
if onrelease then
onrelease(parent)
end
end
self.down = false self.down = false
self.dragging = false self.dragging = false

View File

@ -69,7 +69,6 @@ function newobject:update(dt)
local parent = self.parent local parent = self.parent
local base = loveframes.base local base = loveframes.base
local update = self.Update local update = self.Update
local internals = self.internals
self:CheckHover() self:CheckHover()
self:SetClickBounds(parent.x, parent.y, parent.width, parent.height) self:SetClickBounds(parent.x, parent.y, parent.width, parent.height)
@ -153,11 +152,10 @@ function newobject:mousereleased(x, y, button)
local hover = self.hover local hover = self.hover
local parent = self.parent local parent = self.parent
local tabnumber = self.tabnumber local tabnumber = self.tabnumber
local internals = self.internals
if hover and button == "l" then if hover and button == "l" then
if button == "l" then if button == "l" then
local tab = self.parent.tab local tab = parent.tab
local internals = parent.internals local internals = parent.internals
local onopened = self.OnOpened local onopened = self.OnOpened
local prevtab = internals[tab] local prevtab = internals[tab]

View File

@ -28,6 +28,7 @@ function newobject:initialize()
self.internal = false self.internal = false
self.internals = {} self.internals = {}
self.OnValueChanged = nil self.OnValueChanged = nil
self.OnRelease = nil
-- create the slider button -- create the slider button
local sliderbutton = loveframes.objects["sliderbutton"]:new(self) local sliderbutton = loveframes.objects["sliderbutton"]:new(self)

View File

@ -298,7 +298,7 @@ function newobject:AddTab(name, object, tip, image, onopened, onclosed)
object.staticy = 0 object.staticy = 0
table.insert(self.children, object) table.insert(self.children, object)
internals[tabnumber] = loveframes.objects["tabbutton"]:new(self, name, tabnumber, tip, image, showclose, onopened, onclosed) internals[tabnumber] = loveframes.objects["tabbutton"]:new(self, name, tabnumber, tip, image, onopened, onclosed)
self.tabnumber = tabnumber + 1 self.tabnumber = tabnumber + 1
self:AddScrollButtons() self:AddScrollButtons()

View File

@ -27,6 +27,7 @@ function newobject:initialize()
self.shadowyoffset = 1 self.shadowyoffset = 1
self.formattedtext = {} self.formattedtext = {}
self.original = {} self.original = {}
self.defaultcolor = {0, 0, 0, 255}
self.shadowcolor = {0, 0, 0, 255} self.shadowcolor = {0, 0, 0, 255}
self.ignorenewlines = false self.ignorenewlines = false
self.shadow = false self.shadow = false
@ -152,6 +153,7 @@ function newobject:SetText(t)
local dtype = type(t) local dtype = type(t)
local maxw = self.maxw local maxw = self.maxw
local font = self.font local font = self.font
local defaultcolor = self.defaultcolor
local inserts = {} local inserts = {}
local tdata, prevcolor local tdata, prevcolor
@ -174,7 +176,7 @@ function newobject:SetText(t)
for k, v in ipairs(tdata) do for k, v in ipairs(tdata) do
local dtype = type(v) local dtype = type(v)
if k == 1 and dtype ~= "table" then if k == 1 and dtype ~= "table" then
prevcolor = {0, 0, 0, 255} prevcolor = defaultcolor
end end
if dtype == "table" then if dtype == "table" then
prevcolor = v prevcolor = v
@ -379,8 +381,10 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:SetMaxWidth(width) function newobject:SetMaxWidth(width)
local original = self.original
self.maxw = width self.maxw = width
self:SetText(self.original) self:SetText(original)
end end
@ -543,3 +547,23 @@ function newobject:GetShadowColor()
return self.shadowcolor return self.shadowcolor
end end
--[[---------------------------------------------------------
- func: SetDefaultColor(r, g, b, a)
- desc: sets the object's default text color
--]]---------------------------------------------------------
function newobject:SetDefaultColor(r, g, b, a)
self.defaultcolor = {r, g, b, a}
end
--[[---------------------------------------------------------
- func: GetDefaultColor()
- desc: gets the object's default text color
--]]---------------------------------------------------------
function newobject:GetDefaultColor()
return self.defaultcolor
end

View File

@ -153,7 +153,7 @@ function newobject:update(dt)
self.itemwidth = twidth self.itemwidth = twidth
end end
if panel then if panel then
self.itemwidth = self.itemwidth + panel.width self.itemwidth = self.itemwidth + panel.width + self.textoffsetx + 5
end end
-- item height calculation -- item height calculation
if hbar then if hbar then
@ -549,7 +549,6 @@ function newobject:RunKey(key, unicode)
self.offsetx = self.offsetx + width self.offsetx = self.offsetx + width
elseif indicatornum == #text and self.offsetx ~= ((font:getWidth(text)) - swidth + 10) and font:getWidth(text) + self.textoffsetx > self.width then elseif indicatornum == #text and self.offsetx ~= ((font:getWidth(text)) - swidth + 10) and font:getWidth(text) + self.textoffsetx > self.width then
self.offsetx = ((font:getWidth(text)) - swidth + 10) self.offsetx = ((font:getWidth(text)) - swidth + 10)
--print(((0 - font:getWidth(text)) + swidth))
end end
else else
if indicatornum == #text then if indicatornum == #text then
@ -616,7 +615,6 @@ function newobject:RunKey(key, unicode)
local cwidth = font:getWidth(text:sub(#text)) local cwidth = font:getWidth(text:sub(#text))
if self.offsetx > 0 then if self.offsetx > 0 then
self.offsetx = self.offsetx - cwidth self.offsetx = self.offsetx - cwidth
print(self.offsetx, cwidth)
elseif self.offsetx < 0 then elseif self.offsetx < 0 then
self.offsetx = 0 self.offsetx = 0
end end
@ -1612,3 +1610,23 @@ function newobject:GetRepeatRate()
return self.repeatrate return self.repeatrate
end end
--[[---------------------------------------------------------
- func: SetValue(value)
- desc: sets the object's value (alias of SetText)
--]]---------------------------------------------------------
function newobject:SetValue(value)
self:SetText(value)
end
--[[---------------------------------------------------------
- func: GetValue()
- desc: gets the object's value (alias of GetText)
--]]---------------------------------------------------------
function newobject:GetValue()
return self:GetText()
end

View File

@ -125,6 +125,7 @@ skin.controls.modalbackground_body_color = {255, 255, 255, 100}
-- linenumberspanel -- linenumberspanel
skin.controls.linenumberspanel_text_color = {100, 100, 100, 255} skin.controls.linenumberspanel_text_color = {100, 100, 100, 255}
skin.controls.linenumberspanel_body_color = {200, 200, 200, 255}
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: OutlinedRectangle(object) - func: OutlinedRectangle(object)
@ -171,6 +172,7 @@ function skin.DrawFrame(object)
local height = object:GetHeight() local height = object:GetHeight()
local hover = object:GetHover() local hover = object:GetHover()
local name = object:GetName() local name = object:GetName()
local icon = object:GetIcon()
local bodycolor = skin.controls.frame_body_color local bodycolor = skin.controls.frame_body_color
local topcolor = skin.controls.frame_top_color local topcolor = skin.controls.frame_top_color
local namecolor = skin.controls.frame_name_color local namecolor = skin.controls.frame_name_color
@ -195,8 +197,19 @@ function skin.DrawFrame(object)
-- frame name section -- frame name section
love.graphics.setFont(font) love.graphics.setFont(font)
if icon then
local iconwidth = icon:getWidth()
local iconheight = icon:getHeight()
icon:setFilter("nearest", "nearest")
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(icon, x + 5, y + 5)
love.graphics.setColor(namecolor)
love.graphics.print(name, x + iconwidth + 10, y + 5)
else
love.graphics.setColor(namecolor) love.graphics.setColor(namecolor)
love.graphics.print(name, x + 5, y + 5) love.graphics.print(name, x + 5, y + 5)
end
-- frame border -- frame border
love.graphics.setColor(bordercolor) love.graphics.setColor(bordercolor)
@ -654,13 +667,11 @@ function skin.DrawTabButton(object)
parent:SetTabHeight(imageheight + 5) parent:SetTabHeight(imageheight + 5)
object.height = imageheight + 5 object.height = imageheight + 5
else else
parent:SetTabHeight(theight + 5) object.height = parent.tabheight
object.height = theight + 5
end end
else else
object.width = 10 + twidth object.width = 10 + twidth
parent:SetTabHeight(theight + 5) object.height = parent.tabheight
object.height = theight + 5
end end
local width = object:GetWidth() local width = object:GetWidth()
@ -1445,12 +1456,13 @@ function skin.DrawLineNumbersPanel(object)
local font = parent:GetFont() local font = parent:GetFont()
local theight = font:getHeight("a") local theight = font:getHeight("a")
local textcolor = skin.controls.linenumberspanel_text_color local textcolor = skin.controls.linenumberspanel_text_color
local bodycolor = skin.controls.linenumberspanel_body_color
local mody = y local mody = y
object:SetWidth(10 + font:getWidth(#lines)) object:SetWidth(10 + font:getWidth(#lines))
love.graphics.setFont(font) love.graphics.setFont(font)
love.graphics.setColor(200, 200, 200, 255) love.graphics.setColor(bodycolor)
love.graphics.rectangle("fill", x, y, width, height) love.graphics.rectangle("fill", x, y, width, height)
love.graphics.setColor(bordercolor) love.graphics.setColor(bordercolor)
@ -1458,7 +1470,7 @@ function skin.DrawLineNumbersPanel(object)
for i=1, #lines do for i=1, #lines do
love.graphics.setColor(textcolor) love.graphics.setColor(textcolor)
love.graphics.print(i, object.x + 5, mody - offsety) love.graphics.print(i, x + 5, mody - offsety)
mody = mody + theight mody = mody + theight
end end
@ -1472,5 +1484,43 @@ function skin.DrawNumberBox(object)
end end
--[[---------------------------------------------------------
- func: skin.DrawGrid(object)
- desc: draws the grid object
--]]---------------------------------------------------------
function skin.DrawGrid(object)
local x = object:GetX()
local y = object:GetY()
local width = object:GetWidth()
local height = object:GetHeight()
love.graphics.setColor(bordercolor)
skin.OutlinedRectangle(x, y, width, height)
local cx = x
local cy = y
local cw = object.cellwidth + (object.cellpadding * 2)
local ch = object.cellheight + (object.cellpadding * 2)
for i=1, object.rows do
for n=1, object.columns do
local ovt = false
local ovl = false
if i > 1 then
ovt = true
end
if n > 1 then
ovl = true
end
skin.OutlinedRectangle(cx, cy, cw, ch, ovt, false, ovl, false)
cx = cx + cw
end
cx = x
cy = cy + ch
end
end
-- register the skin -- register the skin
loveframes.skins.Register(skin) loveframes.skins.Register(skin)

View File

@ -125,6 +125,7 @@ skin.controls.modalbackground_body_color = {255, 255, 255, 100}
-- linenumberspanel -- linenumberspanel
skin.controls.linenumberspanel_text_color = {100, 100, 100, 255} skin.controls.linenumberspanel_text_color = {100, 100, 100, 255}
skin.controls.linenumberspanel_body_color = {200, 200, 200, 255}
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: OutlinedRectangle(object) - func: OutlinedRectangle(object)
@ -171,6 +172,7 @@ function skin.DrawFrame(object)
local height = object:GetHeight() local height = object:GetHeight()
local hover = object:GetHover() local hover = object:GetHover()
local name = object:GetName() local name = object:GetName()
local icon = object:GetIcon()
local bodycolor = skin.controls.frame_body_color local bodycolor = skin.controls.frame_body_color
local topcolor = skin.controls.frame_top_color local topcolor = skin.controls.frame_top_color
local namecolor = skin.controls.frame_name_color local namecolor = skin.controls.frame_name_color
@ -195,8 +197,19 @@ function skin.DrawFrame(object)
-- frame name section -- frame name section
love.graphics.setFont(font) love.graphics.setFont(font)
if icon then
local iconwidth = icon:getWidth()
local iconheight = icon:getHeight()
icon:setFilter("nearest", "nearest")
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(icon, x + 5, y + 5)
love.graphics.setColor(namecolor)
love.graphics.print(name, x + iconwidth + 10, y + 5)
else
love.graphics.setColor(namecolor) love.graphics.setColor(namecolor)
love.graphics.print(name, x + 5, y + 5) love.graphics.print(name, x + 5, y + 5)
end
-- frame border -- frame border
love.graphics.setColor(bordercolor) love.graphics.setColor(bordercolor)
@ -654,13 +667,11 @@ function skin.DrawTabButton(object)
parent:SetTabHeight(imageheight + 5) parent:SetTabHeight(imageheight + 5)
object.height = imageheight + 5 object.height = imageheight + 5
else else
parent:SetTabHeight(theight + 5) object.height = parent.tabheight
object.height = theight + 5
end end
else else
object.width = 10 + twidth object.width = 10 + twidth
parent:SetTabHeight(theight + 5) object.height = parent.tabheight
object.height = theight + 5
end end
local width = object:GetWidth() local width = object:GetWidth()
@ -1445,12 +1456,13 @@ function skin.DrawLineNumbersPanel(object)
local font = parent:GetFont() local font = parent:GetFont()
local theight = font:getHeight("a") local theight = font:getHeight("a")
local textcolor = skin.controls.linenumberspanel_text_color local textcolor = skin.controls.linenumberspanel_text_color
local bodycolor = skin.controls.linenumberspanel_body_color
local mody = y local mody = y
object:SetWidth(10 + font:getWidth(#lines)) object:SetWidth(10 + font:getWidth(#lines))
love.graphics.setFont(font) love.graphics.setFont(font)
love.graphics.setColor(200, 200, 200, 255) love.graphics.setColor(bodycolor)
love.graphics.rectangle("fill", x, y, width, height) love.graphics.rectangle("fill", x, y, width, height)
love.graphics.setColor(bordercolor) love.graphics.setColor(bordercolor)
@ -1458,7 +1470,7 @@ function skin.DrawLineNumbersPanel(object)
for i=1, #lines do for i=1, #lines do
love.graphics.setColor(textcolor) love.graphics.setColor(textcolor)
love.graphics.print(i, object.x + 5, mody - offsety) love.graphics.print(i, x + 5, mody - offsety)
mody = mody + theight mody = mody + theight
end end
@ -1472,5 +1484,43 @@ function skin.DrawNumberBox(object)
end end
--[[---------------------------------------------------------
- func: skin.DrawGrid(object)
- desc: draws the grid object
--]]---------------------------------------------------------
function skin.DrawGrid(object)
local x = object:GetX()
local y = object:GetY()
local width = object:GetWidth()
local height = object:GetHeight()
love.graphics.setColor(bordercolor)
skin.OutlinedRectangle(x, y, width, height)
local cx = x
local cy = y
local cw = object.cellwidth + (object.cellpadding * 2)
local ch = object.cellheight + (object.cellpadding * 2)
for i=1, object.rows do
for n=1, object.columns do
local ovt = false
local ovl = false
if i > 1 then
ovt = true
end
if n > 1 then
ovl = true
end
skin.OutlinedRectangle(cx, cy, cw, ch, ovt, false, ovl, false)
cx = cx + cw
end
cx = x
cy = cy + ch
end
end
-- register the skin -- register the skin
loveframes.skins.Register(skin) loveframes.skins.Register(skin)