Version 0.9.4.4 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2012-11-24 17:42:16 -05:00
parent b4d8dd786f
commit 53731d9a01
38 changed files with 1009 additions and 729 deletions

View File

@ -1,3 +1,33 @@
================================================
Version 0.9.4.4 - Alpha (November 24 - 2012)
================================================
[ADDED] a new text input method: SetButtonScrollAmount(amount)
[ADDED] a new text input method: GetButtonScrollAmount()
[ADDED] a new text input method: SetMouseWheelScrollAmount(amount)
[ADDED] a new text input method: GetMouseWheelScrollAmount()
[ADDED] a new multichoice method: SetButtonScrollAmount(amount)
[ADDED] a new multichoice method: GetButtonScrollAmount()
[ADDED] a new multichoice method: SetMouseWheelScrollAmount(amount)
[ADDED] a new multichoice method: GetMouseWheelScrollAmount()
[ADDED] a new column list method: SetButtonScrollAmount(amount)
[ADDED] a new column list method: GetButtonScrollAmount()
[ADDED] a new column list method: SetMouseWheelScrollAmount(amount)
[ADDED] a new column list method: GetMouseWheelScrollAmount()
[ADDED] a new frame method: SetParentLocked(bool)
[ADDED] a new frame method: GetParentLocked()
[ADDED] a new base method: CenterWithinArea(x, y, width, height)
[ADDED] a new library function: loveframes.NewObject(id, name, inherit_from_base)
[FIXED] an error that would occur when clicking a scroll button on a multiline text input or a multichoice list
[FIXED] a button calculation error that caused the button object to flash while moving the cursor out of it's bounding box while it was down
[FIXED] several errors that could occur when a collapsible category did not have an object
[FIXED] the value of the slider object becoming -0 in certain situations
[CHANGED] the close button object is no longer positioned internally by the frame object and should now be positioned by it's skin drawing function
[CHANGED] all Love Frames objects are now stored within loveframes.objects
[CHANGED] frames are now draggable when parented to any object
[CHANGED] the look of the debug overlay
================================================ ================================================
Version 0.9.4.3 - Alpha (November 20 - 2012) Version 0.9.4.3 - Alpha (November 20 - 2012)
================================================ ================================================

114
debug.lua
View File

@ -6,7 +6,8 @@
-- debug library -- debug library
loveframes.debug = {} loveframes.debug = {}
local font = love.graphics.newFont(10) local font = loveframes.basicfontsmall
local centerarea = {210, 5, 585, 590}
local loremipsum = local loremipsum =
[[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean laoreet massa mattis tortor faucibus non congue mauris mattis. Aliquam ultricies scelerisque mi, sit amet tempor metus pharetra vel. Etiam eu arcu a dolor porttitor condimentum in malesuada urna. Mauris vel nulla mi, quis aliquet neque. In aliquet turpis eget purus malesuada tincidunt. Donec rutrum purus vel diam suscipit vehicula. Cras sem nibh, tempus at dictum non, consequat non justo. In sed tellus nec orci scelerisque scelerisque id vitae leo. Maecenas pharetra, nibh eget commodo gravida, augue nisl blandit dui, ut malesuada augue dui nec erat. Phasellus nec mauris pharetra metus iaculis viverra sit amet ut tortor. Duis et viverra magna. Nunc orci dolor, placerat a iaculis non, mattis sed nibh. [[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean laoreet massa mattis tortor faucibus non congue mauris mattis. Aliquam ultricies scelerisque mi, sit amet tempor metus pharetra vel. Etiam eu arcu a dolor porttitor condimentum in malesuada urna. Mauris vel nulla mi, quis aliquet neque. In aliquet turpis eget purus malesuada tincidunt. Donec rutrum purus vel diam suscipit vehicula. Cras sem nibh, tempus at dictum non, consequat non justo. In sed tellus nec orci scelerisque scelerisque id vitae leo. Maecenas pharetra, nibh eget commodo gravida, augue nisl blandit dui, ut malesuada augue dui nec erat. Phasellus nec mauris pharetra metus iaculis viverra sit amet ut tortor. Duis et viverra magna. Nunc orci dolor, placerat a iaculis non, mattis sed nibh.
@ -52,66 +53,67 @@ function loveframes.debug.draw()
end end
end end
-- font for debug text -- main font
love.graphics.setFont(font) love.graphics.setFont(font)
love.graphics.setColor(0, 0, 0, 150) -- main box
love.graphics.rectangle("fill", 5, 5, 200, 250) love.graphics.setColor(0, 0, 0, 200)
love.graphics.rectangle("fill", 5, 30, 200, 220)
love.graphics.setColor(0, 0, 0, 50) -------------------------------------------------------
love.graphics.rectangle("fill", 10, 10, 190, 20) -- library information section
-------------------------------------------------------
love.graphics.setColor(255, 0, 0, 255) love.graphics.setColor(255, 0, 0, 255)
love.graphics.print("Library Information", 15, 15) love.graphics.print("Library Information", 10, 35)
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
love.graphics.print("Author: " ..author, 15, 30) love.graphics.print("Author: " ..author, 15, 50)
love.graphics.print("Version: " ..version, 15, 40) love.graphics.print("Version: " ..version, 15, 60)
love.graphics.print("Stage: " ..stage, 15, 50) love.graphics.print("Stage: " ..stage, 15, 70)
love.graphics.print("Base Directory: " ..basedir, 15, 60) love.graphics.print("Base Directory: " ..basedir, 15, 80)
-- object information box -------------------------------------------------------
love.graphics.setColor(0, 0, 0, 50) -- object information section
love.graphics.rectangle("fill", 10, 80, 190, 20) -------------------------------------------------------
love.graphics.setColor(255, 0, 0, 255) love.graphics.setColor(255, 0, 0, 255)
love.graphics.print("Object Information", 15, 85) love.graphics.print("Object Information", 10, 95)
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
if #cols > 0 then if #cols > 0 then
love.graphics.print("Type: " ..topcol.type, 15, 100) love.graphics.print("Type: " ..topcol.type, 15, 110)
else else
love.graphics.print("Type: none", 10, 100) love.graphics.print("Type: none", 10, 120)
end end
if topcol.children then if topcol.children then
love.graphics.print("# of children: " .. #topcol.children, 15, 110) love.graphics.print("# of children: " .. #topcol.children, 15, 120)
else else
love.graphics.print("# of children: 0", 15, 110) love.graphics.print("# of children: 0", 15, 120)
end end
if topcol.internals then if topcol.internals then
love.graphics.print("# of internals: " .. #topcol.internals, 15, 120) love.graphics.print("# of internals: " .. #topcol.internals, 15, 130)
else else
love.graphics.print("# of internals: 0", 15, 120) love.graphics.print("# of internals: 0", 15, 130)
end end
love.graphics.print("X: " ..topcol.x, 15, 130) love.graphics.print("X: " ..topcol.x, 15, 140)
love.graphics.print("Y: " ..topcol.y, 15, 140) love.graphics.print("Y: " ..topcol.y, 15, 150)
love.graphics.print("Width: " ..topcol.width, 15, 150) love.graphics.print("Width: " ..topcol.width, 15, 160)
love.graphics.print("Height: " ..topcol.height, 15, 160) love.graphics.print("Height: " ..topcol.height, 15, 170)
-- Miscellaneous box -------------------------------------------------------
love.graphics.setColor(0, 0, 0, 50) -- miscellaneous section
love.graphics.rectangle("fill", 10, 190, 190, 20) -------------------------------------------------------
love.graphics.setColor(255, 0, 0, 255) love.graphics.setColor(255, 0, 0, 255)
love.graphics.print("Miscellaneous", 15, 195) love.graphics.print("Miscellaneous", 10, 185)
love.graphics.setColor(255, 255, 255, 255) love.graphics.setColor(255, 255, 255, 255)
love.graphics.print("LOVE Version: " ..loveversion, 15, 200)
love.graphics.print("LOVE Version: " ..loveversion, 15, 210) love.graphics.print("FPS: " ..fps, 15, 210)
love.graphics.print("FPS: " ..fps, 15, 220) love.graphics.print("Delta Time: " ..deltatime, 15, 220)
love.graphics.print("Delta Time: " ..deltatime, 15, 230) love.graphics.print("Total Objects: " ..#objects, 15, 230)
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
love.graphics.setColor(255, 204, 51, 255) love.graphics.setColor(255, 204, 51, 255)
@ -132,8 +134,8 @@ function loveframes.debug.ExamplesMenu()
------------------------------------ ------------------------------------
local examplesframe = loveframes.Create("frame") local examplesframe = loveframes.Create("frame")
examplesframe:SetName("Examples List") examplesframe:SetName("Examples List")
examplesframe:SetSize(200, love.graphics.getHeight() - 330) examplesframe:SetSize(200, love.graphics.getHeight() - 325)
examplesframe:SetPos(5, 325) examplesframe:SetPos(5, 320)
------------------------------------ ------------------------------------
-- examples list -- examples list
@ -154,7 +156,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Button") frame1:SetName("Button")
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local button1 = loveframes.Create("button", frame1) local button1 = loveframes.Create("button", frame1)
button1:SetWidth(200) button1:SetWidth(200)
@ -182,7 +184,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Checkbox") frame1:SetName("Checkbox")
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
frame1:SetHeight(85) frame1:SetHeight(85)
local checkbox1 = loveframes.Create("checkbox", frame1) local checkbox1 = loveframes.Create("checkbox", frame1)
@ -210,7 +212,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Collapsible Category") frame1:SetName("Collapsible Category")
frame1:SetSize(500, 300) frame1:SetSize(500, 300)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local panel1 = loveframes.Create("panel") local panel1 = loveframes.Create("panel")
panel1:SetHeight(230) panel1:SetHeight(230)
@ -234,7 +236,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Column List") frame1:SetName("Column List")
frame1:SetSize(500, 300) frame1:SetSize(500, 300)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local list1 = loveframes.Create("columnlist", frame1) local list1 = loveframes.Create("columnlist", frame1)
list1:SetPos(5, 30) list1:SetPos(5, 30)
@ -260,7 +262,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Frame") frame1:SetName("Frame")
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
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.")
@ -302,7 +304,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Image") frame1:SetName("Image")
frame1:SetSize(138, 315) frame1:SetSize(138, 315)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local image1 = loveframes.Create("image", frame1) local image1 = loveframes.Create("image", frame1)
image1:SetImage("resources/images/carlsagan.png") image1:SetImage("resources/images/carlsagan.png")
@ -394,7 +396,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Image Button") frame1:SetName("Image Button")
frame1:SetSize(138, 163) frame1:SetSize(138, 163)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local imagebutton1 = loveframes.Create("imagebutton", frame1) local imagebutton1 = loveframes.Create("imagebutton", frame1)
imagebutton1:SetImage("resources/images/carlsagan.png") imagebutton1:SetImage("resources/images/carlsagan.png")
@ -414,7 +416,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("List") frame1:SetName("List")
frame1:SetSize(500, 455) frame1:SetSize(500, 455)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local list1 = loveframes.Create("list", frame1) local list1 = loveframes.Create("list", frame1)
list1:SetPos(5, 30) list1:SetPos(5, 30)
@ -499,7 +501,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Multichoice") frame1:SetName("Multichoice")
frame1:SetSize(210, 60) frame1:SetSize(210, 60)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local multichoice1 = loveframes.Create("multichoice", frame1) local multichoice1 = loveframes.Create("multichoice", frame1)
multichoice1:SetPos(5, 30) multichoice1:SetPos(5, 30)
@ -521,7 +523,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Panel") frame1:SetName("Panel")
frame1:SetSize(210, 85) frame1:SetSize(210, 85)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local panel1 = loveframes.Create("panel", frame1) local panel1 = loveframes.Create("panel", frame1)
panel1:SetPos(5, 30) panel1:SetPos(5, 30)
@ -539,7 +541,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Progress Bar") frame1:SetName("Progress Bar")
frame1:SetSize(500, 160) frame1:SetSize(500, 160)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local progressbar1 = loveframes.Create("progressbar", frame1) local progressbar1 = loveframes.Create("progressbar", frame1)
progressbar1:SetPos(5, 30) progressbar1:SetPos(5, 30)
@ -570,7 +572,7 @@ function loveframes.debug.ExamplesMenu()
slider1:SetPos(5, 135) slider1:SetPos(5, 135)
slider1:SetWidth(490) slider1:SetWidth(490)
slider1:SetText("Progressbar lerp rate") slider1:SetText("Progressbar lerp rate")
slider1:SetMinMax(1, 50) slider1:SetMinMax(0, 50)
slider1:SetDecimals(0) slider1:SetDecimals(0)
slider1.OnValueChanged = function(object2, value) slider1.OnValueChanged = function(object2, value)
progressbar1:SetLerpRate(value) progressbar1:SetLerpRate(value)
@ -601,7 +603,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Slider") frame1:SetName("Slider")
frame1:SetSize(300, 275) frame1:SetSize(300, 275)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local slider1 = loveframes.Create("slider", frame1) local slider1 = loveframes.Create("slider", frame1)
slider1:SetPos(5, 30) slider1:SetPos(5, 30)
@ -631,7 +633,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Tabs") frame1:SetName("Tabs")
frame1:SetSize(500, 300) frame1:SetSize(500, 300)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local tabs1 = loveframes.Create("tabs", frame1) local tabs1 = loveframes.Create("tabs", frame1)
tabs1:SetPos(5, 30) tabs1:SetPos(5, 30)
@ -668,7 +670,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Text") frame1:SetName("Text")
frame1:SetSize(500, 300) frame1:SetSize(500, 300)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local list1 = loveframes.Create("list", frame1) local list1 = loveframes.Create("list", frame1)
list1:SetPos(5, 30) list1:SetPos(5, 30)
@ -676,11 +678,9 @@ function loveframes.debug.ExamplesMenu()
list1:SetPadding(5) list1:SetPadding(5)
list1:SetSpacing(5) list1:SetSpacing(5)
--for i=1, 5 do
local text1 = loveframes.Create("text") local text1 = loveframes.Create("text")
text1:SetText(loremipsum) text1:SetText(loremipsum)
list1:AddItem(text1) list1:AddItem(text1)
--end
end end
exampleslist:AddItem(textexample) exampleslist:AddItem(textexample)
@ -695,7 +695,7 @@ function loveframes.debug.ExamplesMenu()
local frame1 = loveframes.Create("frame") local frame1 = loveframes.Create("frame")
frame1:SetName("Text Input") frame1:SetName("Text Input")
frame1:SetSize(500, 90) frame1:SetSize(500, 90)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
local textinput1 = loveframes.Create("textinput", frame1) local textinput1 = loveframes.Create("textinput", frame1)
textinput1:SetPos(5, 30) textinput1:SetPos(5, 30)
@ -714,14 +714,14 @@ function loveframes.debug.ExamplesMenu()
togglebutton.OnClick = function(object) togglebutton.OnClick = function(object)
if textinput1.multiline then if textinput1.multiline then
frame1:SetHeight(90) frame1:SetHeight(90)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
togglebutton:SetPos(5, 60) togglebutton:SetPos(5, 60)
textinput1:SetMultiline(false) textinput1:SetMultiline(false)
textinput1:SetHeight(25) textinput1:SetHeight(25)
textinput1:SetText("") textinput1:SetText("")
else else
frame1:SetHeight(365) frame1:SetHeight(365)
frame1:Center() frame1:CenterWithinArea(unpack(centerarea))
togglebutton:SetPos(5, 335) togglebutton:SetPos(5, 335)
textinput1:SetMultiline(true) textinput1:SetMultiline(true)
textinput1:SetHeight(300) textinput1:SetHeight(300)
@ -745,7 +745,7 @@ function loveframes.debug.SkinSelector()
local frame = loveframes.Create("frame") local frame = loveframes.Create("frame")
frame:SetName("Skin Selector") frame:SetName("Skin Selector")
frame:SetSize(200, 60) frame:SetSize(200, 60)
frame:SetPos(5, 260) frame:SetPos(5, 255)
local skinslist = loveframes.Create("multichoice", frame) local skinslist = loveframes.Create("multichoice", frame)
skinslist:SetPos(5, 30) skinslist:SetPos(5, 30)

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info -- library info
loveframes.info = {} loveframes.info = {}
loveframes.info.author = "Kenny Shields" loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.3" loveframes.info.version = "0.9.4.4"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations
@ -26,6 +26,7 @@ loveframes.hoverobject = false
loveframes.modalobject = false loveframes.modalobject = false
loveframes.basicfont = love.graphics.newFont(12) loveframes.basicfont = love.graphics.newFont(12)
loveframes.basicfontsmall = love.graphics.newFont(10) loveframes.basicfontsmall = love.graphics.newFont(10)
loveframes.objects = {}
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: load() - func: load()
@ -70,7 +71,7 @@ function loveframes.load()
end end
-- create the base gui object -- create the base gui object
loveframes.base = base:new() loveframes.base = loveframes.objects["base"]:new()
end end
@ -80,9 +81,9 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.update(dt) function loveframes.update(dt)
local object = loveframes.base local base = loveframes.base
object:update(dt) base:update(dt)
end end
@ -92,13 +93,13 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.draw() function loveframes.draw()
local object = loveframes.base local base = loveframes.base
-- set the drawcount to zero -- set the drawcount to zero
loveframes.drawcount = 0 loveframes.drawcount = 0
-- draw the base object -- draw the base object
object:draw() base:draw()
-- draw the debug library -- draw the debug library
loveframes.debug.draw() loveframes.debug.draw()
@ -111,9 +112,9 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.mousepressed(x, y, button) function loveframes.mousepressed(x, y, button)
local object = loveframes.base local base = loveframes.base
object:mousepressed(x, y, button) base:mousepressed(x, y, button)
end end
@ -123,9 +124,9 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.mousereleased(x, y, button) function loveframes.mousereleased(x, y, button)
local object = loveframes.base local base = loveframes.base
object:mousereleased(x, y, button) base:mousereleased(x, y, button)
-- reset the hover object -- reset the hover object
if button == "l" then if button == "l" then
@ -141,9 +142,9 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.keypressed(key, unicode) function loveframes.keypressed(key, unicode)
local object = loveframes.base local base = loveframes.base
object:keypressed(key, unicode) base:keypressed(key, unicode)
end end
@ -153,9 +154,9 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function loveframes.keyreleased(key) function loveframes.keyreleased(key)
local object = loveframes.base local base = loveframes.base
object:keyreleased(key) base:keyreleased(key)
end end
@ -169,13 +170,15 @@ function loveframes.Create(data, parent)
if type(data) == "string" then if type(data) == "string" then
-- make sure the object specified is valid local objects = loveframes.objects
if not _G[data] then local object = objects[data]
if not object then
loveframes.util.Error("Error creating object: Invalid object '" ..data.. "'.") loveframes.util.Error("Error creating object: Invalid object '" ..data.. "'.")
end end
-- create the object -- create the object
local object = _G[data]:new() object = object:new()
-- apply template properties to the object -- apply template properties to the object
loveframes.templates.ApplyToObject(object) loveframes.templates.ApplyToObject(object)
@ -269,5 +272,27 @@ function loveframes.Create(data, parent)
end end
--[[---------------------------------------------------------
- func: NewObject(id, name, inherit_from_base)
- desc: creates a new object
--]]---------------------------------------------------------
function loveframes.NewObject(id, name, inherit_from_base)
local objects = loveframes.objects
local object = false
if inherit_from_base then
local base = objects["base"]
object = class(name, base)
objects[id] = object
else
object = class(name)
objects[id] = object
end
return object
end
-- load the library -- load the library
loveframes.load() loveframes.load()

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- base object -- base object
base = class("base") local newobject = loveframes.NewObject("base", "loveframes_object_base")
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: intializes the element - desc: intializes the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:initialize() function newobject:initialize()
-- width and height of the window -- width and height of the window
local w = love.graphics.getWidth() local w = love.graphics.getWidth()
@ -29,7 +29,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:update(dt) function newobject:update(dt)
local children = self.children local children = self.children
@ -47,7 +47,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:draw() function newobject:draw()
local children = self.children local children = self.children
@ -68,7 +68,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
local children = self.children local children = self.children
@ -96,7 +96,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
local children = self.children local children = self.children
@ -124,7 +124,7 @@ end
- func: keypressed(key) - func: keypressed(key)
- desc: called when the player presses a key - desc: called when the player presses a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:keypressed(key, unicode) function newobject:keypressed(key, unicode)
local visible = self.visible local visible = self.visible
local children = self.children local children = self.children
@ -152,7 +152,7 @@ end
- func: keyreleased(key) - func: keyreleased(key)
- desc: called when the player releases a key - desc: called when the player releases a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:keyreleased(key) function newobject:keyreleased(key)
local visible = self.visible local visible = self.visible
local children = self.children local children = self.children
@ -182,7 +182,7 @@ end
- func: SetPos(x, y) - func: SetPos(x, y)
- desc: sets the object's position - desc: sets the object's position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetPos(x, y) function newobject:SetPos(x, y)
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
@ -201,7 +201,7 @@ end
- func: SetX(x) - func: SetX(x)
- desc: sets the object's x position - desc: sets the object's x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetX(x) function newobject:SetX(x)
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
@ -218,7 +218,7 @@ end
- func: SetY(y) - func: SetY(y)
- desc: sets the object's y position - desc: sets the object's y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetY(y) function newobject:SetY(y)
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
@ -235,7 +235,7 @@ end
- func: GetPos() - func: GetPos()
- desc: gets the object's position - desc: gets the object's position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetPos() function newobject:GetPos()
return self.x, self.y return self.x, self.y
@ -245,7 +245,7 @@ end
- func: GetX() - func: GetX()
- desc: gets the object's x position - desc: gets the object's x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetX() function newobject:GetX()
return self.x return self.x
@ -255,7 +255,7 @@ end
- func: GetY() - func: GetY()
- desc: gets the object's y position - desc: gets the object's y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetY() function newobject:GetY()
return self.y return self.y
@ -265,7 +265,7 @@ end
- func: GetStaticPos() - func: GetStaticPos()
- desc: gets the object's static position - desc: gets the object's static position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetStaticPos() function newobject:GetStaticPos()
return self.staticx, self.staticy return self.staticx, self.staticy
@ -275,7 +275,7 @@ end
- func: GetStaticX() - func: GetStaticX()
- desc: gets the object's static x position - desc: gets the object's static x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetStaticX() function newobject:GetStaticX()
return self.staticx return self.staticx
@ -285,7 +285,7 @@ end
- func: GetStaticY() - func: GetStaticY()
- desc: gets the object's static y position - desc: gets the object's static y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetStaticY() function newobject:GetStaticY()
return self.staticy return self.staticy
@ -296,7 +296,7 @@ end
- desc: centers the object in the game window or in - desc: centers the object in the game window or in
it's parent if it has one it's parent if it has one
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:Center() function newobject:Center(area)
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
@ -321,7 +321,7 @@ end
- func: CenterX() - func: CenterX()
- desc: centers the object by it's x value - desc: centers the object by it's x value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:CenterX() function newobject:CenterX()
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
@ -340,7 +340,7 @@ end
- func: CenterY() - func: CenterY()
- desc: centers the object by it's y value - desc: centers the object by it's y value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:CenterY() function newobject:CenterY()
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
@ -355,11 +355,25 @@ function base:CenterY()
end end
--[[---------------------------------------------------------
- func: CenterWithinArea()
- desc: centers the object within the given area
--]]---------------------------------------------------------
function newobject:CenterWithinArea(x, y, width, height)
local selfwidth = self.width
local selfheight = self.height
self.x = x + width/2 - selfwidth/2
self.y = y + height/2 - selfheight/2
end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetSize(width, height) - func: SetSize(width, height)
- desc: sets the object's size - desc: sets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetSize(width, height) function newobject:SetSize(width, height)
self.width = width self.width = width
self.height = height self.height = height
@ -370,7 +384,7 @@ end
- func: SetWidth(width) - func: SetWidth(width)
- desc: sets the object's width - desc: sets the object's width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetWidth(width) function newobject:SetWidth(width)
self.width = width self.width = width
@ -380,7 +394,7 @@ end
- func: SetHeight(height) - func: SetHeight(height)
- desc: sets the object's height - desc: sets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetHeight(height) function newobject:SetHeight(height)
self.height = height self.height = height
@ -390,7 +404,7 @@ end
- func: GetSize() - func: GetSize()
- desc: gets the object's size - desc: gets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetSize() function newobject:GetSize()
return self.width, self.height return self.width, self.height
@ -400,7 +414,7 @@ end
- func: GetWidth() - func: GetWidth()
- desc: gets the object's width - desc: gets the object's width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetWidth() function newobject:GetWidth()
return self.width return self.width
@ -410,7 +424,7 @@ end
- func: GetHeight() - func: GetHeight()
- desc: gets the object's height - desc: gets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetHeight() function newobject:GetHeight()
return self.height return self.height
@ -420,7 +434,7 @@ end
- func: SetVisible(bool) - func: SetVisible(bool)
- desc: sets the object's visibility - desc: sets the object's visibility
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetVisible(bool) function newobject:SetVisible(bool)
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
@ -445,7 +459,7 @@ end
- func: GetVisible() - func: GetVisible()
- desc: gets the object's visibility - desc: gets the object's visibility
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetVisible() function newobject:GetVisible()
return self.visible return self.visible
@ -455,7 +469,7 @@ end
- func: SetParent(parent) - func: SetParent(parent)
- desc: sets the object's parent - desc: sets the object's parent
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetParent(parent) function newobject:SetParent(parent)
local tparent = parent local tparent = parent
local cparent = self.parent local cparent = self.parent
@ -477,7 +491,7 @@ end
- func: GetParent() - func: GetParent()
- desc: gets the object's parent - desc: gets the object's parent
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetParent() function newobject:GetParent()
local parent = self.parent local parent = self.parent
return parent return parent
@ -488,7 +502,7 @@ end
- func: Remove() - func: Remove()
- desc: removes the object - desc: removes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:Remove() function newobject:Remove()
local pinternals = self.parent.internals local pinternals = self.parent.internals
local pchildren = self.parent.children local pchildren = self.parent.children
@ -518,7 +532,7 @@ end
- desc: sets a boundary box for the object's collision - desc: sets a boundary box for the object's collision
detection detection
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetClickBounds(x, y, width, height) function newobject:SetClickBounds(x, y, width, height)
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
@ -544,7 +558,7 @@ end
- desc: gets the boundary box for the object's collision - desc: gets the boundary box for the object's collision
detection detection
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetClickBounds() function newobject:GetClickBounds()
return self.clickbounds return self.clickbounds
@ -555,7 +569,7 @@ end
- desc: removes the collision detection boundary for the - desc: removes the collision detection boundary for the
object object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:RemoveClickBounds() function newobject:RemoveClickBounds()
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
@ -581,7 +595,7 @@ end
- desc: checks if the mouse is inside the object's - desc: checks if the mouse is inside the object's
collision detection boundaries collision detection boundaries
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:InClickBounds() function newobject:InClickBounds()
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local bounds = self.clickbounds local bounds = self.clickbounds
@ -600,7 +614,7 @@ end
- desc: checks if the object the top most object in a - desc: checks if the object the top most object in a
collision table collision table
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:IsTopCollision() function newobject:IsTopCollision()
local cols = loveframes.util.GetCollisions() local cols = loveframes.util.GetCollisions()
local draworder = self.draworder local draworder = self.draworder
@ -621,7 +635,7 @@ end
- func: GetBaseParent(object, t) - func: GetBaseParent(object, t)
- desc: finds the object's base parent - desc: finds the object's base parent
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetBaseParent(t) function newobject:GetBaseParent(t)
local t = t or {} local t = t or {}
local base = loveframes.base local base = loveframes.base
@ -641,7 +655,7 @@ end
- desc: checks to see if the object should be in a - desc: checks to see if the object should be in a
hover state hover state
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:CheckHover() function newobject:CheckHover()
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local selfcol = loveframes.util.BoundingBox(x, self.x, y, self.y, 1, self.width, 1, self.height) local selfcol = loveframes.util.BoundingBox(x, self.x, y, self.y, 1, self.width, 1, self.height)
@ -735,7 +749,7 @@ end
- func: GetHover() - func: GetHover()
- desc: return if the object is in a hover state or not - desc: return if the object is in a hover state or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetHover() function newobject:GetHover()
return self.hover return self.hover
@ -745,7 +759,7 @@ end
- func: GetChildren() - func: GetChildren()
- desc: returns the object's children - desc: returns the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetChildren() function newobject:GetChildren()
local children = self.children local children = self.children
@ -760,7 +774,7 @@ end
- desc: returns true if the object is the top most list - desc: returns true if the object is the top most list
object or false if not object or false if not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:IsTopList() function newobject:IsTopList()
local cols = loveframes.util.GetCollisions() local cols = loveframes.util.GetCollisions()
local children = self:GetChildren() local children = self:GetChildren()
@ -808,7 +822,7 @@ end
- desc: returns true if the object is the top most child - desc: returns true if the object is the top most child
in it's parent's children table or false if not in it's parent's children table or false if not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:IsTopChild() function newobject:IsTopChild()
local children = self.parent.children local children = self.parent.children
local num = #children local num = #children
@ -826,7 +840,7 @@ end
- desc: moves the object to the top of it's parent's - desc: moves the object to the top of it's parent's
children table children table
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:MoveToTop() function newobject:MoveToTop()
local pchildren = self.parent.children local pchildren = self.parent.children
local pinternals = self.parent.internals local pinternals = self.parent.internals
@ -853,7 +867,7 @@ end
- func: SetSkin(name) - func: SetSkin(name)
- desc: sets the object's skin - desc: sets the object's skin
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetSkin(name) function newobject:SetSkin(name)
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
@ -878,7 +892,7 @@ end
- func: GetSkin(name) - func: GetSkin(name)
- desc: gets the object's skin - desc: gets the object's skin
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetSkin(name) function newobject:GetSkin(name)
return self.skin return self.skin
@ -888,7 +902,7 @@ end
- func: SetAlwaysUpdate(bool) - func: SetAlwaysUpdate(bool)
- desc: sets the object's skin - desc: sets the object's skin
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetAlwaysUpdate(bool) function newobject:SetAlwaysUpdate(bool)
self.alwaysupdate = bool self.alwaysupdate = bool
@ -898,7 +912,7 @@ end
- func: GetAlwaysUpdate() - func: GetAlwaysUpdate()
- desc: gets whether or not the object will always update - desc: gets whether or not the object will always update
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetAlwaysUpdate() function newobject:GetAlwaysUpdate()
return self.alwaysupdate return self.alwaysupdate
@ -909,7 +923,7 @@ end
- desc: sets whether or not the object should retain it's - desc: sets whether or not the object should retain it's
size when another object tries to resize it size when another object tries to resize it
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetRetainSize(bool) function newobject:SetRetainSize(bool)
self.retainsize = bool self.retainsize = bool
@ -920,7 +934,7 @@ end
- desc: gets whether or not the object should retain it's - desc: gets whether or not the object should retain it's
size when another object tries to resize it size when another object tries to resize it
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetRetainSize() function newobject:GetRetainSize()
return self.retainsize return self.retainsize
@ -931,7 +945,7 @@ end
- desc: gets whether or not the object is active within - desc: gets whether or not the object is active within
it's parent's child table it's parent's child table
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:IsActive() function newobject:IsActive()
local parent = self.parent local parent = self.parent
local pchildren = parent.children local pchildren = parent.children
@ -952,7 +966,7 @@ end
- desc: returns a table of the object's parents and it's - desc: returns a table of the object's parents and it's
sub-parents sub-parents
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetParents() function newobject:GetParents()
local function GetParents(object, t) local function GetParents(object, t)
@ -981,7 +995,7 @@ end
internal in it's parent's internals table or internal in it's parent's internals table or
false if not false if not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:IsTopInternal() function newobject:IsTopInternal()
local internals = self.parent.internals local internals = self.parent.internals
@ -998,7 +1012,7 @@ end
- desc: returns true if the object is internal or - desc: returns true if the object is internal or
false if not false if not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:IsInternal() function newobject:IsInternal()
return self.internal return self.internal
@ -1008,7 +1022,7 @@ end
- func: GetType() - func: GetType()
- desc: gets the type of the object - desc: gets the type of the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetType() function newobject:GetType()
return self.type return self.type
@ -1018,7 +1032,7 @@ end
- func: SetDrawOrder() - func: SetDrawOrder()
- desc: sets the object's draw order - desc: sets the object's draw order
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetDrawOrder() function newobject:SetDrawOrder()
loveframes.drawcount = loveframes.drawcount + 1 loveframes.drawcount = loveframes.drawcount + 1
self.draworder = loveframes.drawcount self.draworder = loveframes.drawcount
@ -1029,7 +1043,7 @@ end
- func: GetDrawOrder() - func: GetDrawOrder()
- desc: sets the object's draw order - desc: sets the object's draw order
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetDrawOrder() function newobject:GetDrawOrder()
return self.draworder return self.draworder
@ -1039,7 +1053,7 @@ end
- func: SetProperty(name, value) - func: SetProperty(name, value)
- desc: sets a property on the object - desc: sets a property on the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:SetProperty(name, value) function newobject:SetProperty(name, value)
self[name] = value self[name] = value
@ -1049,7 +1063,7 @@ end
- func: GetProperty(name) - func: GetProperty(name)
- desc: gets the value of an object's property - desc: gets the value of an object's property
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function base:GetProperty(name) function newobject:GetProperty(name)
return self[name] return self[name]

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- button class -- button class
button = class("button", base) local newobject = loveframes.NewObject("button", "loveframes_object_button", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:initialize() function newobject:initialize()
self.type = "button" self.type = "button"
self.text = "Button" self.text = "Button"
@ -28,7 +28,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -50,16 +50,15 @@ function button:update(dt)
if not hover then if not hover then
self.down = false self.down = false
if hoverobject == self then
self.hover = true
end
else else
if hoverobject == self then if hoverobject == self then
self.down = true self.down = true
end end
end end
if not down and hoverobject == self then
self.hover = true
end
-- 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
@ -76,7 +75,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -108,7 +107,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -137,7 +136,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -167,7 +166,7 @@ end
- func: keypressed(key) - func: keypressed(key)
- desc: called when the player presses a key - desc: called when the player presses a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:keypressed(key, unicode) function newobject:keypressed(key, unicode)
local visible = self.visible local visible = self.visible
@ -188,7 +187,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -198,7 +197,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:GetText() function newobject:GetText()
return self.text return self.text
@ -208,7 +207,7 @@ end
- func: SetClickable(bool) - func: SetClickable(bool)
- desc: sets whether the object can be clicked or not - desc: sets whether the object can be clicked or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:SetClickable(bool) function newobject:SetClickable(bool)
self.clickable = bool self.clickable = bool
@ -218,7 +217,7 @@ end
- func: GetClickable(bool) - func: GetClickable(bool)
- desc: gets whether the object can be clicked or not - desc: gets whether the object can be clicked or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:GetClickable() function newobject:GetClickable()
return self.clickable return self.clickable
@ -228,7 +227,7 @@ end
- func: SetClickable(bool) - func: SetClickable(bool)
- desc: sets whether the object is enabled or not - desc: sets whether the object is enabled or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:SetEnabled(bool) function newobject:SetEnabled(bool)
self.enabled = bool self.enabled = bool
@ -238,7 +237,7 @@ end
- func: GetEnabled() - func: GetEnabled()
- desc: gets whether the object is enabled or not - desc: gets whether the object is enabled or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function button:GetEnabled() function newobject:GetEnabled()
return self.enabled return self.enabled

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- checkbox class -- checkbox class
checkbox = class("checkbox", base) local newobject = loveframes.NewObject("checkbox", "loveframes_object_checkbox", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:initialize() function newobject:initialize()
self.type = "checkbox" self.type = "checkbox"
self.width = 0 self.width = 0
@ -31,7 +31,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -105,7 +105,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -142,7 +142,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -171,7 +171,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -203,7 +203,7 @@ end
- func: keypressed(key) - func: keypressed(key)
- desc: called when the player presses a key - desc: called when the player presses a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:keypressed(key, unicode) function newobject:keypressed(key, unicode)
local checked = self.checked local checked = self.checked
local onchanged = self.OnChanged local onchanged = self.OnChanged
@ -227,7 +227,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:SetText(text) function newobject:SetText(text)
local boxwidth = self.boxwidth local boxwidth = self.boxwidth
local boxheight = self.boxheight local boxheight = self.boxheight
@ -266,7 +266,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:GetText() function newobject:GetText()
local internals = self.internals local internals = self.internals
local text = internals[1] local text = internals[1]
@ -283,7 +283,7 @@ end
- func: SetSize(width, height) - func: SetSize(width, height)
- desc: sets the object's size - desc: sets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:SetSize(width, height) function newobject:SetSize(width, height)
self.boxwidth = width self.boxwidth = width
self.boxheight = height self.boxheight = height
@ -294,7 +294,7 @@ end
- func: SetWidth(width) - func: SetWidth(width)
- desc: sets the object's width - desc: sets the object's width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:SetWidth(width) function newobject:SetWidth(width)
self.boxwidth = width self.boxwidth = width
@ -304,7 +304,7 @@ end
- func: SetHeight(height) - func: SetHeight(height)
- desc: sets the object's height - desc: sets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:SetHeight(height) function newobject:SetHeight(height)
self.boxheight = height self.boxheight = height
@ -314,7 +314,7 @@ end
- func: SetChecked(bool) - func: SetChecked(bool)
- desc: sets whether the object is checked or not - desc: sets whether the object is checked or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:SetChecked(bool) function newobject:SetChecked(bool)
local onchanged = self.OnChanged local onchanged = self.OnChanged
@ -330,7 +330,7 @@ end
- func: GetChecked() - func: GetChecked()
- desc: gets whether the object is checked or not - desc: gets whether the object is checked or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:GetChecked() function newobject:GetChecked()
return self.checked return self.checked
@ -340,7 +340,7 @@ end
- func: SetFont(font) - func: SetFont(font)
- desc: sets the font of the object's text - desc: sets the font of the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:SetFont(font) function newobject:SetFont(font)
local internals = self.internals local internals = self.internals
local text = internals[1] local text = internals[1]
@ -354,40 +354,40 @@ function checkbox:SetFont(font)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: checkbox:GetFont() - func: newobject:GetFont()
- desc: gets the font of the object's text - desc: gets the font of the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:GetFont() function newobject:GetFont()
return self.font return self.font
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: checkbox:GetBoxHeight() - func: newobject:GetBoxHeight()
- desc: gets the object's box size - desc: gets the object's box size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:GetBoxSize() function newobject:GetBoxSize()
return self.boxwidth, self.boxheight return self.boxwidth, self.boxheight
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: checkbox:GetBoxWidth() - func: newobject:GetBoxWidth()
- desc: gets the object's box width - desc: gets the object's box width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:GetBoxWidth() function newobject:GetBoxWidth()
return self.boxwidth return self.boxwidth
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: checkbox:GetBoxHeight() - func: newobject:GetBoxHeight()
- desc: gets the object's box height - desc: gets the object's box height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function checkbox:GetBoxHeight() function newobject:GetBoxHeight()
return self.boxheight return self.boxheight

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- collapsiblecategory class -- collapsiblecategory class
collapsiblecategory = class("collapsiblecategory", base) local newobject = loveframes.NewObject("collapsiblecategory", "loveframes_object_collapsiblecategory", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:initialize() function newobject:initialize()
self.type = "collapsiblecategory" self.type = "collapsiblecategory"
self.text = "Category" self.text = "Category"
@ -30,7 +30,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -56,7 +56,7 @@ function collapsiblecategory:update(dt)
self.y = self.parent.y + self.staticy self.y = self.parent.y + self.staticy
end end
if open == true then if open and curobject then
curobject:SetWidth(self.width - self.padding * 2) curobject:SetWidth(self.width - self.padding * 2)
curobject:update(dt) curobject:update(dt)
end end
@ -71,7 +71,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -100,7 +100,7 @@ function collapsiblecategory:draw()
drawfunc(self) drawfunc(self)
end end
if open then if open and curobject then
curobject:draw() curobject:draw()
end end
@ -110,7 +110,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -142,7 +142,7 @@ function collapsiblecategory:mousepressed(x, y, button)
end end
if open then if open and curobject then
curobject:mousepressed(x, y, button) curobject:mousepressed(x, y, button)
end end
@ -152,7 +152,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -181,7 +181,7 @@ function collapsiblecategory:mousereleased(x, y, button)
end end
if open then if open and curobject then
curobject:mousepressed(x, y, button) curobject:mousepressed(x, y, button)
end end
@ -191,7 +191,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -201,7 +201,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:GetText() function newobject:GetText()
return self.text return self.text
@ -211,7 +211,7 @@ end
- func: SetObject(object) - func: SetObject(object)
- desc: sets the category's object - desc: sets the category's object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:SetObject(object) function newobject:SetObject(object)
local children = self.children local children = self.children
local curobject = children[1] local curobject = children[1]
@ -234,7 +234,7 @@ end
- func: SetObject(object) - func: SetObject(object)
- desc: sets the category's object - desc: sets the category's object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:GetObject() function newobject:GetObject()
local children = self.children local children = self.children
local curobject = children[1] local curobject = children[1]
@ -251,7 +251,7 @@ end
- func: SetSize(width, height) - func: SetSize(width, height)
- desc: sets the object's size - desc: sets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:SetSize(width, height) function newobject:SetSize(width, height)
self.width = width self.width = width
@ -261,7 +261,7 @@ end
- func: SetHeight(height) - func: SetHeight(height)
- desc: sets the object's height - desc: sets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:SetHeight(height) function newobject:SetHeight(height)
return return
@ -271,7 +271,7 @@ end
- func: SetClosedHeight(height) - func: SetClosedHeight(height)
- desc: sets the object's closed height - desc: sets the object's closed height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:SetClosedHeight(height) function newobject:SetClosedHeight(height)
self.closedheight = height self.closedheight = height
@ -281,7 +281,7 @@ end
- func: GetClosedHeight() - func: GetClosedHeight()
- desc: gets the object's closed height - desc: gets the object's closed height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:GetClosedHeight() function newobject:GetClosedHeight()
return self.closedheight return self.closedheight
@ -291,13 +291,12 @@ end
- func: SetOpen(bool) - func: SetOpen(bool)
- desc: sets whether the object is opened or closed - desc: sets whether the object is opened or closed
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:SetOpen(bool) function newobject:SetOpen(bool)
local children = self.children local children = self.children
local curobject = children[1] local curobject = children[1]
local closedheight = self.closedheight local closedheight = self.closedheight
local padding = self.padding local padding = self.padding
local curobjectheight = curobject.height
local onopenedclosed = self.OnOpenedClosed local onopenedclosed = self.OnOpenedClosed
self.open = bool self.open = bool
@ -305,11 +304,13 @@ function collapsiblecategory:SetOpen(bool)
if not bool then if not bool then
self.height = closedheight self.height = closedheight
if curobject then if curobject then
local curobjectheight = curobject.height
curobject:SetVisible(false) curobject:SetVisible(false)
end end
else else
self.height = closedheight + padding * 2 + curobjectheight
if curobject then if curobject then
local curobjectheight = curobject.height
self.height = closedheight + padding * 2 + curobjectheight
curobject:SetVisible(true) curobject:SetVisible(true)
end end
end end
@ -325,7 +326,7 @@ end
- func: GetOpen() - func: GetOpen()
- desc: gets whether the object is opened or closed - desc: gets whether the object is opened or closed
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function collapsiblecategory:GetOpen() function newobject:GetOpen()
return self.opened return self.opened

View File

@ -4,17 +4,19 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlist class -- columnlist class
columnlist = class("columnlist", base) local newobject = loveframes.NewObject("columnlist", "loveframes_object_columnlist", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: intializes the element - desc: intializes the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:initialize() function newobject:initialize()
self.type = "columnlist" self.type = "columnlist"
self.width = 300 self.width = 300
self.height = 100 self.height = 100
self.buttonscrollamount = 0.10
self.mousewheelscrollamount = 5
self.autoscroll = false self.autoscroll = false
self.internal = false self.internal = false
self.children = {} self.children = {}
@ -22,7 +24,7 @@ function columnlist:initialize()
self.OnRowClicked = nil self.OnRowClicked = nil
self.OnScroll = nil self.OnScroll = nil
local list = columnlistarea:new(self) local list = loveframes.objects["columnlistarea"]:new(self)
table.insert(self.internals, list) table.insert(self.internals, list)
end end
@ -31,7 +33,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -74,7 +76,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -116,7 +118,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -152,7 +154,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -177,7 +179,7 @@ end
- func: Adjustchildren() - func: Adjustchildren()
- desc: adjusts the width of the object's children - desc: adjusts the width of the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:AdjustColumns() function newobject:AdjustColumns()
local width = self.width local width = self.width
local bar = self.internals[1].bar local bar = self.internals[1].bar
@ -208,13 +210,13 @@ end
- desc: gives the object a new column with the specified - desc: gives the object a new column with the specified
name name
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:AddColumn(name) function newobject:AddColumn(name)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
local height = self.height local height = self.height
columnlistheader:new(name, self) loveframes.objects["columnlistheader"]:new(name, self)
self:AdjustColumns() self:AdjustColumns()
list:SetSize(self.width, height) list:SetSize(self.width, height)
@ -226,7 +228,7 @@ end
- func: AddRow(...) - func: AddRow(...)
- desc: adds a row of data to the object's list - desc: adds a row of data to the object's list
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:AddRow(...) function newobject:AddRow(...)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -239,7 +241,7 @@ end
- func: Getchildrenize() - func: Getchildrenize()
- desc: gets the size of the object's children - desc: gets the size of the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:GetColumnSize() function newobject:GetColumnSize()
local children = self.children local children = self.children
local numchildren = #self.children local numchildren = #self.children
@ -259,7 +261,7 @@ end
- func: SetSize(width, height) - func: SetSize(width, height)
- desc: sets the object's size - desc: sets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:SetSize(width, height) function newobject:SetSize(width, height)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -276,7 +278,7 @@ end
- func: SetWidth(width) - func: SetWidth(width)
- desc: sets the object's width - desc: sets the object's width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:SetWidth(width) function newobject:SetWidth(width)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -292,7 +294,7 @@ end
- func: SetHeight(height) - func: SetHeight(height)
- desc: sets the object's height - desc: sets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:SetHeight(height) function newobject:SetHeight(height)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -309,7 +311,7 @@ end
- desc: sets the object's max color index for - desc: sets the object's max color index for
alternating row colors alternating row colors
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:SetMaxColorIndex(num) function newobject:SetMaxColorIndex(num)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -322,7 +324,7 @@ end
- func: Clear() - func: Clear()
- desc: removes all items from the object's list - desc: removes all items from the object's list
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:Clear() function newobject:Clear()
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -337,7 +339,7 @@ end
auto scroll to the bottom when a new object is auto scroll to the bottom when a new object is
added to the list added to the list
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlist:SetAutoScroll(bool) function newobject:SetAutoScroll(bool)
local internals = self.internals local internals = self.internals
local list = internals[1] local list = internals[1]
@ -352,3 +354,47 @@ function columnlist:SetAutoScroll(bool)
end end
end end
--[[---------------------------------------------------------
- func: SetButtonScrollAmount(speed)
- desc: sets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:SetButtonScrollAmount(amount)
self.buttonscrollamount = amount
self.internals[1].buttonscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetButtonScrollAmount()
- desc: gets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.buttonscrollamount
end
--[[---------------------------------------------------------
- func: SetMouseWheelScrollAmount(amount)
- desc: sets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:SetMouseWheelScrollAmount(amount)
self.mousewheelscrollamount = amount
self.internals[1].mousewheelscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetMouseWheelScrollAmount()
- desc: gets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.mousewheelscrollamount
end

View File

@ -4,14 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- frame class -- frame class
frame = class("frame", base) local newobject = loveframes.NewObject("frame", "loveframes_object_frame", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:initialize() function newobject:initialize()
self.type = "frame" self.type = "frame"
self.name = "Frame" self.name = "Frame"
@ -22,6 +21,7 @@ function frame:initialize()
self.internal = false self.internal = false
self.draggable = true self.draggable = true
self.screenlocked = false self.screenlocked = false
self.parentlocked = false
self.dragging = false self.dragging = false
self.modal = false self.modal = false
self.modalbackground = false self.modalbackground = false
@ -31,7 +31,7 @@ function frame:initialize()
self.OnClose = nil self.OnClose = nil
-- create the close button for the frame -- create the close button for the frame
local close = closebutton:new() local close = loveframes.objects["closebutton"]:new()
close.parent = self close.parent = self
close:SetSize(16, 16) close:SetSize(16, 16)
close.OnClick = function() close.OnClick = function()
@ -50,7 +50,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the element - desc: updates the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -66,6 +66,7 @@ function frame:update(dt)
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 parentlocked = self.parentlocked
local modal = self.modal local modal = self.modal
local base = loveframes.base local base = loveframes.base
local basechildren = base.children local basechildren = base.children
@ -76,7 +77,6 @@ function frame:update(dt)
local parent = self.parent local parent = self.parent
local update = self.Update local update = self.Update
close:SetPos(self.width - 20, 4)
self:CheckHover() self:CheckHover()
-- dragging check -- dragging check
@ -84,11 +84,14 @@ function frame:update(dt)
if parent == base then if parent == base then
self.x = x - self.clickx self.x = x - self.clickx
self.y = y - self.clicky self.y = y - self.clicky
else
self.staticx = x - self.clickx
self.staticy = y - self.clicky
end end
end end
-- if screenlocked then keep within screen -- if screenlocked then keep within screen
if screenlocked == true then if screenlocked then
local width = love.graphics.getWidth() local width = love.graphics.getWidth()
local height = love.graphics.getHeight() local height = love.graphics.getHeight()
@ -110,6 +113,28 @@ function frame:update(dt)
end end
if parentlocked then
local width = self.parent.width
local height = self.parent.height
local selfwidth = self.width
local selfheight = self.height
if self.staticx < 0 then
self.staticx = 0
end
if self.staticx + selfwidth > width then
self.staticx = width - selfwidth
end
if self.staticy < 0 then
self.staticy = 0
end
if self.staticy + selfheight > height then
self.staticy = height - selfheight
end
end
if modal then if modal then
local tip = false local tip = false
@ -158,7 +183,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -201,7 +226,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -215,6 +240,8 @@ function frame:mousepressed(x, y, button)
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
local dragging = self.dragging local dragging = self.dragging
local parent = self.parent
local base = loveframes.base
if selfcol then if selfcol then
@ -223,8 +250,13 @@ function frame:mousepressed(x, y, button)
-- initiate dragging if not currently dragging -- initiate dragging if not currently dragging
if not dragging and top and button == "l" then if not dragging and top and button == "l" then
if y < self.y + 25 and self.draggable then if y < self.y + 25 and self.draggable then
if parent == base then
self.clickx = x - self.x self.clickx = x - self.x
self.clicky = y - self.y self.clicky = y - self.y
else
self.clickx = x - self.staticx
self.clicky = y - self.staticy
end
self.dragging = true self.dragging = true
end end
end end
@ -249,7 +281,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -280,7 +312,7 @@ end
- func: SetName(name) - func: SetName(name)
- desc: sets the frame's name - desc: sets the frame's name
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:SetName(name) function newobject:SetName(name)
self.name = name self.name = name
@ -290,7 +322,7 @@ end
- func: GetName() - func: GetName()
- desc: gets the frame's name - desc: gets the frame's name
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:GetName() function newobject:GetName()
return self.name return self.name
@ -300,7 +332,7 @@ end
- func: SetDraggable(true/false) - func: SetDraggable(true/false)
- desc: sets whether the frame can be dragged or not - desc: sets whether the frame can be dragged or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:SetDraggable(bool) function newobject:SetDraggable(bool)
self.draggable = bool self.draggable = bool
@ -310,7 +342,7 @@ end
- func: GetDraggable() - func: GetDraggable()
- desc: gets whether the frame can be dragged ot not - desc: gets whether the frame can be dragged ot not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:GetDraggable() function newobject:GetDraggable()
return self.draggable return self.draggable
@ -322,7 +354,7 @@ end
- desc: sets whether the frame can be moved passed the - desc: sets whether the frame can be moved passed the
boundaries of the window or not boundaries of the window or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:SetScreenLocked(bool) function newobject:SetScreenLocked(bool)
self.screenlocked = bool self.screenlocked = bool
@ -333,7 +365,7 @@ end
- desc: gets whether the frame can be moved passed the - desc: gets whether the frame can be moved passed the
boundaries of window or not boundaries of window or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:GetScreenLocked() function newobject:GetScreenLocked()
return self.screenlocked return self.screenlocked
@ -343,7 +375,7 @@ end
- func: ShowCloseButton(bool) - func: ShowCloseButton(bool)
- desc: sets whether the close button should be drawn - desc: sets whether the close button should be drawn
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:ShowCloseButton(bool) function newobject:ShowCloseButton(bool)
local close = self.internals[1] local close = self.internals[1]
@ -357,7 +389,7 @@ end
- desc: makes the object the top object in the drawing - desc: makes the object the top object in the drawing
order order
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:MakeTop() function newobject:MakeTop()
local x, y = love.mouse.getPosition() local x, y = love.mouse.getPosition()
local key = 0 local key = 0
@ -402,7 +434,7 @@ end
- desc: makes the object the top object in the drawing - desc: makes the object the top object in the drawing
order order
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:SetModal(bool) function newobject:SetModal(bool)
local modalobject = loveframes.modalobject local modalobject = loveframes.modalobject
local mbackground = self.modalbackground local mbackground = self.modalbackground
@ -424,7 +456,7 @@ function frame:SetModal(bool)
loveframes.modalobject = self loveframes.modalobject = self
if not mbackground then if not mbackground then
self.modalbackground = modalbackground:new(self) self.modalbackground = loveframes.objects["modalbackground"]:new(self)
self.modal = true self.modal = true
end end
@ -451,7 +483,7 @@ end
- desc: gets whether or not the object is in a modal - desc: gets whether or not the object is in a modal
state state
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:GetModal() function newobject:GetModal()
return self.modal return self.modal
@ -461,7 +493,7 @@ end
- func: SetVisible(bool) - func: SetVisible(bool)
- desc: set's whether the object is visible or not - desc: set's whether the object is visible or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function frame:SetVisible(bool) function newobject:SetVisible(bool)
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
@ -478,3 +510,25 @@ function frame:SetVisible(bool)
end end
end end
--[[---------------------------------------------------------
- func: SetParentLocked(bool)
- desc: sets whether the frame can be moved passed the
boundaries of it's parent or not
--]]---------------------------------------------------------
function newobject:SetParentLocked(bool)
self.parentlocked = bool
end
--[[---------------------------------------------------------
- func: GetParentLocked(bool)
- desc: gets whether the frame can be moved passed the
boundaries of it's parent or not
--]]---------------------------------------------------------
function newobject:GetParentLocked()
return self.parentlocked
end

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- progressbar class -- progressbar class
image = class("image", base) local newobject = loveframes.NewObject("image", "loveframes_object_image", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:initialize() function newobject:initialize()
self.type = "image" self.type = "image"
self.width = 0 self.width = 0
@ -32,7 +32,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -63,7 +63,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -95,7 +95,7 @@ end
- func: SetImage(image) - func: SetImage(image)
- desc: sets the object's image - desc: sets the object's image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetImage(image) function newobject:SetImage(image)
if type(image) == "string" then if type(image) == "string" then
self.image = love.graphics.newImage(image) self.image = love.graphics.newImage(image)
@ -112,7 +112,7 @@ end
- func: GetImage() - func: GetImage()
- desc: gets the object's image - desc: gets the object's image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetImage() function newobject:GetImage()
return self.image return self.image
@ -122,7 +122,7 @@ end
- func: SetColor(table) - func: SetColor(table)
- desc: sets the object's color - desc: sets the object's color
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetColor(data) function newobject:SetColor(data)
self.imagecolor = data self.imagecolor = data
@ -132,7 +132,7 @@ end
- func: GetColor() - func: GetColor()
- desc: gets the object's color - desc: gets the object's color
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetColor() function newobject:GetColor()
return self.imagecolor return self.imagecolor
@ -142,7 +142,7 @@ end
- func: SetOrientation(orientation) - func: SetOrientation(orientation)
- desc: sets the object's orientation - desc: sets the object's orientation
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetOrientation(orientation) function newobject:SetOrientation(orientation)
self.orientation = orientation self.orientation = orientation
@ -152,7 +152,7 @@ end
- func: GetOrientation() - func: GetOrientation()
- desc: gets the object's orientation - desc: gets the object's orientation
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetOrientation() function newobject:GetOrientation()
return self.orientation return self.orientation
@ -162,7 +162,7 @@ end
- func: SetScaleX(scalex) - func: SetScaleX(scalex)
- desc: sets the object's x scale - desc: sets the object's x scale
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetScaleX(scalex) function newobject:SetScaleX(scalex)
self.scalex = scalex self.scalex = scalex
@ -172,7 +172,7 @@ end
- func: GetScaleX() - func: GetScaleX()
- desc: gets the object's x scale - desc: gets the object's x scale
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetScaleX() function newobject:GetScaleX()
return self.scalex return self.scalex
@ -182,7 +182,7 @@ end
- func: SetScaleY(scaley) - func: SetScaleY(scaley)
- desc: sets the object's y scale - desc: sets the object's y scale
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetScaleY(scaley) function newobject:SetScaleY(scaley)
self.scaley = scaley self.scaley = scaley
@ -192,7 +192,7 @@ end
- func: GetScaleY() - func: GetScaleY()
- desc: gets the object's y scale - desc: gets the object's y scale
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetScaleY() function newobject:GetScaleY()
return self.scaley return self.scaley
@ -202,7 +202,7 @@ end
- func: SetScale(scalex, scaley) - func: SetScale(scalex, scaley)
- desc: sets the object's x and y scale - desc: sets the object's x and y scale
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetScale(scalex, scaley) function newobject:SetScale(scalex, scaley)
self.scalex = scalex self.scalex = scalex
self.scaley = scaley self.scaley = scaley
@ -213,7 +213,7 @@ end
- func: GetScale() - func: GetScale()
- desc: gets the object's x and y scale - desc: gets the object's x and y scale
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetScale() function newobject:GetScale()
return self.scalex, self.scaley return self.scalex, self.scaley
@ -223,7 +223,7 @@ end
- func: SetOffsetX(x) - func: SetOffsetX(x)
- desc: sets the object's x offset - desc: sets the object's x offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetOffsetX(x) function newobject:SetOffsetX(x)
self.offsetx = x self.offsetx = x
@ -233,7 +233,7 @@ end
- func: GetOffsetX() - func: GetOffsetX()
- desc: gets the object's x offset - desc: gets the object's x offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetOffsetX() function newobject:GetOffsetX()
return self.offsetx return self.offsetx
@ -243,7 +243,7 @@ end
- func: SetOffsetY(y) - func: SetOffsetY(y)
- desc: sets the object's y offset - desc: sets the object's y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetOffsetY(y) function newobject:SetOffsetY(y)
self.offsety = y self.offsety = y
@ -253,7 +253,7 @@ end
- func: GetOffsetY() - func: GetOffsetY()
- desc: gets the object's y offset - desc: gets the object's y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetOffsetY() function newobject:GetOffsetY()
return self.offsety return self.offsety
@ -263,7 +263,7 @@ end
- func: SetOffset(x, y) - func: SetOffset(x, y)
- desc: sets the object's x and y offset - desc: sets the object's x and y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetOffset(x, y) function newobject:SetOffset(x, y)
self.offsetx = x self.offsetx = x
self.offsety = y self.offsety = y
@ -274,7 +274,7 @@ end
- func: GetOffset() - func: GetOffset()
- desc: gets the object's x and y offset - desc: gets the object's x and y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetOffset() function newobject:GetOffset()
return self.offsetx, self.offsety return self.offsetx, self.offsety
@ -284,7 +284,7 @@ end
- func: SetShearX(shearx) - func: SetShearX(shearx)
- desc: sets the object's x shear - desc: sets the object's x shear
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetShearX(shearx) function newobject:SetShearX(shearx)
self.shearx = shearx self.shearx = shearx
@ -294,7 +294,7 @@ end
- func: GetShearX() - func: GetShearX()
- desc: gets the object's x shear - desc: gets the object's x shear
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetShearX() function newobject:GetShearX()
return self.shearx return self.shearx
@ -304,7 +304,7 @@ end
- func: SetShearY(sheary) - func: SetShearY(sheary)
- desc: sets the object's y shear - desc: sets the object's y shear
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetShearY(sheary) function newobject:SetShearY(sheary)
self.sheary = sheary self.sheary = sheary
@ -314,7 +314,7 @@ end
- func: GetShearY() - func: GetShearY()
- desc: gets the object's y shear - desc: gets the object's y shear
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetShearY() function newobject:GetShearY()
return self.sheary return self.sheary
@ -324,7 +324,7 @@ end
- func: SetShear(shearx, sheary) - func: SetShear(shearx, sheary)
- desc: sets the object's x and y shear - desc: sets the object's x and y shear
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:SetShear(shearx, sheary) function newobject:SetShear(shearx, sheary)
self.shearx = shearx self.shearx = shearx
self.sheary = sheary self.sheary = sheary
@ -335,7 +335,7 @@ end
- func: GetShear() - func: GetShear()
- desc: gets the object's x and y shear - desc: gets the object's x and y shear
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function image:GetShear() function newobject:GetShear()
return self.shearx, self.sheary return self.shearx, self.sheary

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- imagebutton class -- imagebutton class
imagebutton = class("imagebutton", base) local newobject = loveframes.NewObject("imagebutton", "loveframes_object_imagebutton", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:initialize() function newobject:initialize()
self.type = "imagebutton" self.type = "imagebutton"
self.text = "Image Button" self.text = "Image Button"
@ -29,7 +29,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -77,7 +77,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -109,7 +109,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -138,7 +138,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -168,7 +168,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -178,7 +178,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:GetText() function newobject:GetText()
return self.text return self.text
@ -188,7 +188,7 @@ end
- func: SetClickable(bool) - func: SetClickable(bool)
- desc: sets whether the object can be clicked or not - desc: sets whether the object can be clicked or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:SetClickable(bool) function newobject:SetClickable(bool)
self.clickable = bool self.clickable = bool
@ -198,7 +198,7 @@ end
- func: GetClickable(bool) - func: GetClickable(bool)
- desc: gets whether the object can be clicked or not - desc: gets whether the object can be clicked or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:GetClickable() function newobject:GetClickable()
return self.clickable return self.clickable
@ -208,7 +208,7 @@ end
- func: SetClickable(bool) - func: SetClickable(bool)
- desc: sets whether the object is enabled or not - desc: sets whether the object is enabled or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:SetEnabled(bool) function newobject:SetEnabled(bool)
self.enabled = bool self.enabled = bool
@ -218,7 +218,7 @@ end
- func: GetEnabled() - func: GetEnabled()
- desc: gets whether the object is enabled or not - desc: gets whether the object is enabled or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:GetEnabled() function newobject:GetEnabled()
return self.enabled return self.enabled
@ -228,7 +228,7 @@ end
- func: SetImage(image) - func: SetImage(image)
- desc: sets the object's image - desc: sets the object's image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:SetImage(image) function newobject:SetImage(image)
if type(image) == "string" then if type(image) == "string" then
self.image = love.graphics.newImage(image) self.image = love.graphics.newImage(image)
@ -242,7 +242,7 @@ end
- func: GetImage() - func: GetImage()
- desc: gets whether the object is enabled or not - desc: gets whether the object is enabled or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:GetImage() function newobject:GetImage()
return self.image return self.image
@ -252,7 +252,7 @@ end
- func: SizeToImage() - func: SizeToImage()
- desc: makes the object the same size as it's image - desc: makes the object the same size as it's image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function imagebutton:SizeToImage() function newobject:SizeToImage()
local image = self.image local image = self.image

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- closebutton class -- closebutton class
closebutton = class("closebutton", base) local newobject = loveframes.NewObject("closebutton", "loveframes_object_closebutton", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function closebutton:initialize() function newobject:initialize()
self.type = "closebutton" self.type = "closebutton"
self.width = 80 self.width = 80
@ -29,7 +29,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function closebutton:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -77,7 +77,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function closebutton:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -108,7 +108,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function closebutton:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -137,7 +137,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function closebutton:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlistarea class -- columnlistarea class
columnlistarea = class("columnlistarea", base) local newobject = loveframes.NewObject("columnlistarea", "loveframes_object_columnlistarea", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: intializes the element - desc: intializes the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:initialize(parent) function newobject:initialize(parent)
self.type = "columnlistarea" self.type = "columnlistarea"
self.display = "vertical" self.display = "vertical"
@ -25,6 +25,8 @@ function columnlistarea:initialize(parent)
self.extraheight = 0 self.extraheight = 0
self.rowcolorindex = 1 self.rowcolorindex = 1
self.rowcolorindexmax = 2 self.rowcolorindexmax = 2
self.buttonscrollamount = parent.buttonscrollamount
self.mousewheelscrollamount = parent.mousewheelscrollamount
self.bar = false self.bar = false
self.internal = true self.internal = true
self.internals = {} self.internals = {}
@ -39,7 +41,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -86,7 +88,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -142,9 +144,10 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local toplist = self:IsTopList() local toplist = self:IsTopList()
local scrollamount = self.mousewheelscrollamount
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
@ -163,9 +166,9 @@ function columnlistarea:mousepressed(x, y, button)
local bar = self:GetScrollBar() local bar = self:GetScrollBar()
if button == "wu" then if button == "wu" then
bar:Scroll(-5) bar:Scroll(-scrollamount)
elseif button == "wd" then elseif button == "wd" then
bar:Scroll(5) bar:Scroll(scrollamount)
end end
end end
@ -184,7 +187,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
@ -203,7 +206,7 @@ end
- func: CalculateSize() - func: CalculateSize()
- desc: calculates the size of the object's children - desc: calculates the size of the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:CalculateSize() function newobject:CalculateSize()
local iw, ih = self.parent:GetColumnSize() local iw, ih = self.parent:GetColumnSize()
local numitems = #self.children local numitems = #self.children
@ -225,7 +228,7 @@ function columnlistarea:CalculateSize()
self.extraheight = self.itemheight - height self.extraheight = self.itemheight - height
if not bar then if not bar then
table.insert(self.internals, scrollbody:new(self, "vertical")) table.insert(self.internals, loveframes.objects["scrollbody"]:new(self, "vertical"))
self.bar = true self.bar = true
self:GetScrollBar().autoscroll = self.parent.autoscroll self:GetScrollBar().autoscroll = self.parent.autoscroll
end end
@ -246,7 +249,7 @@ end
- func: RedoLayout() - func: RedoLayout()
- desc: used to redo the layour of the object - desc: used to redo the layour of the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:RedoLayout() function newobject:RedoLayout()
local children = self.children local children = self.children
local starty = 0 local starty = 0
@ -285,9 +288,9 @@ end
- func: AddRow(data) - func: AddRow(data)
- desc: adds a row to the object - desc: adds a row to the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:AddRow(data) function newobject:AddRow(data)
local row = columnlistrow:new(self, data) local row = loveframes.objects["columnlistrow"]:new(self, data)
local colorindex = self.rowcolorindex local colorindex = self.rowcolorindex
local colorindexmax = self.rowcolorindexmax local colorindexmax = self.rowcolorindexmax
@ -309,7 +312,7 @@ end
- func: GetScrollBar() - func: GetScrollBar()
- desc: gets the object's scroll bar - desc: gets the object's scroll bar
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:GetScrollBar() function newobject:GetScrollBar()
local internals = self.internals local internals = self.internals
@ -328,7 +331,7 @@ end
- func: Sort() - func: Sort()
- desc: sorts the object's children - desc: sorts the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:Sort(column, desc) function newobject:Sort(column, desc)
self.rowcolorindex = 1 self.rowcolorindex = 1
@ -366,7 +369,7 @@ end
- func: Clear() - func: Clear()
- desc: removes all items from the object's list - desc: removes all items from the object's list
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistarea:Clear() function newobject:Clear()
self.children = {} self.children = {}
self:CalculateSize() self:CalculateSize()

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlistrow class -- columnlistrow class
columnlistrow = class("columnlistrow", base) local newobject = loveframes.NewObject("columnlistrow", "loveframes_object_columnlistrow", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: intializes the element - desc: intializes the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:initialize(parent, data) function newobject:initialize(parent, data)
self.type = "columnlistrow" self.type = "columnlistrow"
self.parent = parent self.parent = parent
@ -32,7 +32,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -65,7 +65,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -97,7 +97,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
if not self.visible then if not self.visible then
return return
@ -119,7 +119,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
if not self.visible then if not self.visible then
return return
@ -143,7 +143,7 @@ end
- func: SetTextPos(x, y) - func: SetTextPos(x, y)
- desc: sets the positions of the object's text - desc: sets the positions of the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:SetTextPos(x, y) function newobject:SetTextPos(x, y)
self.textx = x self.textx = x
self.texty = y self.texty = y
@ -154,7 +154,7 @@ end
- func: GetTextX() - func: GetTextX()
- desc: gets the object's text x position - desc: gets the object's text x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:GetTextX() function newobject:GetTextX()
return self.textx return self.textx
@ -164,7 +164,7 @@ end
- func: GetTextY() - func: GetTextY()
- desc: gets the object's text y position - desc: gets the object's text y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:GetTextY() function newobject:GetTextY()
return self.texty return self.texty
@ -174,7 +174,7 @@ end
- func: SetFont(font) - func: SetFont(font)
- desc: sets the object's font - desc: sets the object's font
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:SetFont(font) function newobject:SetFont(font)
self.font = font self.font = font
@ -184,7 +184,7 @@ end
- func: GetFont() - func: GetFont()
- desc: gets the object's font - desc: gets the object's font
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:GetFont() function newobject:GetFont()
return self.font return self.font
@ -194,7 +194,7 @@ end
- func: GetColorIndex() - func: GetColorIndex()
- desc: gets the object's color index - desc: gets the object's color index
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:GetColorIndex() function newobject:GetColorIndex()
return self.colorindex return self.colorindex
@ -204,7 +204,7 @@ end
- func: GetColumnData() - func: GetColumnData()
- desc: gets the object's column data - desc: gets the object's column data
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistrow:GetColumnData() function newobject:GetColumnData()
return self.columndata return self.columndata

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- columnlistheader class -- columnlistheader class
columnlistheader = class("columnlistheader", base) local newobject = loveframes.NewObject("columnlistheader", "loveframes_object_columnlistheader", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: intializes the element - desc: intializes the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistheader:initialize(name, parent) function newobject:initialize(name, parent)
self.type = "columnlistheader" self.type = "columnlistheader"
self.parent = parent self.parent = parent
@ -52,7 +52,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistheader:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -97,7 +97,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistheader:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -129,7 +129,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistheader:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
if self.hover and button == "l" then if self.hover and button == "l" then
@ -150,7 +150,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistheader:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
if not self.visible then if not self.visible then
return return
@ -176,7 +176,7 @@ end
- func: GetName() - func: GetName()
- desc: gets the object's name - desc: gets the object's name
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function columnlistheader:GetName() function newobject:GetName()
return self.name return self.name

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- linenumberspanel class -- linenumberspanel class
linenumberspanel = class("linenumberspanel", base) local newobject = loveframes.NewObject("linenumberspanel", "loveframes_object_linenumberspanel", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function linenumberspanel:initialize(parent) function newobject:initialize(parent)
self.parent = parent self.parent = parent
self.type = "linenumberspanel" self.type = "linenumberspanel"
@ -30,7 +30,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the element - desc: updates the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function linenumberspanel:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -74,7 +74,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function linenumberspanel:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -116,7 +116,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function linenumberspanel:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -142,7 +142,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function linenumberspanel:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -156,7 +156,7 @@ end
- func: GetOffsetY() - func: GetOffsetY()
- desc: gets the object's y offset - desc: gets the object's y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function linenumberspanel:GetOffsetY() function newobject:GetOffsetY()
return self.offsety return self.offsety

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- modalbackground class -- modalbackground class
modalbackground = class("modalbackground", base) local newobject = loveframes.NewObject("modalbackground", "loveframes_object_modalbackground", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function modalbackground:initialize(object) function newobject:initialize(object)
self.type = "modalbackground" self.type = "modalbackground"
self.width = love.graphics.getWidth() self.width = love.graphics.getWidth()
@ -36,7 +36,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the element - desc: updates the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function modalbackground:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -74,7 +74,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function modalbackground:draw() function newobject:draw()
if not self.visible then if not self.visible then
return return

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- multichoicelist class -- multichoicelist class
multichoicelist = class("multichoicelist", base) local newobject = loveframes.NewObject("multichoicelist", "loveframes_object_multichoicelist", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:initialize(object) function newobject:initialize(object)
self.type = "multichoice-list" self.type = "multichoice-list"
self.parent = loveframes.base self.parent = loveframes.base
@ -23,6 +23,8 @@ function multichoicelist:initialize(object)
self.clicky = 0 self.clicky = 0
self.padding = self.list.listpadding self.padding = self.list.listpadding
self.spacing = self.list.listspacing self.spacing = self.list.listspacing
self.buttonscrollamount = object.buttonscrollamount
self.mousewheelscrollamount = object.mousewheelscrollamount
self.offsety = 0 self.offsety = 0
self.offsetx = 0 self.offsetx = 0
self.extrawidth = 0 self.extrawidth = 0
@ -34,7 +36,7 @@ function multichoicelist:initialize(object)
self.internals = {} self.internals = {}
for k, v in ipairs(object.choices) do for k, v in ipairs(object.choices) do
local row = multichoicerow:new() local row = loveframes.objects["multichoicerow"]:new()
row:SetText(v) row:SetText(v)
self:AddItem(row) self:AddItem(row)
end end
@ -50,7 +52,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -114,7 +116,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -170,7 +172,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -182,6 +184,7 @@ function multichoicelist:mousepressed(x, y, button)
local toplist = self:IsTopList() local toplist = self:IsTopList()
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
local scrollamount = self.mousewheelscrollamount
if not selfcol and self.canremove and button == "l" then if not selfcol and self.canremove and button == "l" then
self:Close() self:Close()
@ -190,9 +193,9 @@ function multichoicelist:mousepressed(x, y, button)
if self.vbar and toplist then if self.vbar and toplist then
if button == "wu" then if button == "wu" then
internals[1].internals[1].internals[1]:Scroll(-5) internals[1].internals[1].internals[1]:Scroll(-scrollamount)
elseif button == "wd" then elseif button == "wd" then
internals[1].internals[1].internals[1]:Scroll(5) internals[1].internals[1].internals[1]:Scroll(scrollamount)
end end
end end
@ -211,7 +214,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -238,7 +241,7 @@ end
- func: AddItem(object) - func: AddItem(object)
- desc: adds an item to the object - desc: adds an item to the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:AddItem(object) function newobject:AddItem(object)
if object.type ~= "multichoice-row" then if object.type ~= "multichoice-row" then
return return
@ -257,7 +260,7 @@ end
- func: RemoveItem(object) - func: RemoveItem(object)
- desc: removes an item from the object - desc: removes an item from the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:RemoveItem(object) function newobject:RemoveItem(object)
local children = self.children local children = self.children
@ -278,7 +281,7 @@ end
- func: CalculateSize() - func: CalculateSize()
- desc: calculates the size of the object's children - desc: calculates the size of the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:CalculateSize() function newobject:CalculateSize()
self.height = self.padding self.height = self.padding
@ -313,7 +316,7 @@ function multichoicelist:CalculateSize()
self.extraheight = self.itemheight - height self.extraheight = self.itemheight - height
if not vbar then if not vbar then
local scroll = scrollbody:new(self, "vertical") local scroll = loveframes.objects["scrollbody"]:new(self, "vertical")
table.insert(self.internals, scroll) table.insert(self.internals, scroll)
self.vbar = true self.vbar = true
end end
@ -334,7 +337,7 @@ end
- func: RedoLayout() - func: RedoLayout()
- desc: used to redo the layour of the object - desc: used to redo the layour of the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:RedoLayout() function newobject:RedoLayout()
local children = self.children local children = self.children
local padding = self.padding local padding = self.padding
@ -370,7 +373,7 @@ end
- func: SetPadding(amount) - func: SetPadding(amount)
- desc: sets the object's padding - desc: sets the object's padding
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:SetPadding(amount) function newobject:SetPadding(amount)
self.padding = amount self.padding = amount
@ -380,13 +383,13 @@ end
- func: SetSpacing(amount) - func: SetSpacing(amount)
- desc: sets the object's spacing - desc: sets the object's spacing
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicelist:SetSpacing(amount) function newobject:SetSpacing(amount)
self.spacing = amount self.spacing = amount
end end
function multichoicelist:Close() function newobject:Close()
self:Remove() self:Remove()
self.list.haslist = false self.list.haslist = false

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- multichoicerow class -- multichoicerow class
multichoicerow = class("multichoicerow", base) local newobject = loveframes.NewObject("multichoicerow", "loveframes_object_multichoicerow", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:initialize() function newobject:initialize()
self.type = "multichoice-row" self.type = "multichoice-row"
self.text = "" self.text = ""
@ -30,7 +30,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -75,7 +75,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -106,7 +106,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -129,7 +129,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -152,7 +152,7 @@ end
- func: keypressed(key) - func: keypressed(key)
- desc: called when the player presses a key - desc: called when the player presses a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:keypressed(key, unicode) function newobject:keypressed(key, unicode)
local text = self.text local text = self.text
local selectedobject = loveframes.selectedobject local selectedobject = loveframes.selectedobject
@ -167,7 +167,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -177,7 +177,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoicerow:GetText() function newobject:GetText()
return self.text return self.text

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollarea class -- scrollarea class
scrollarea = class("scrollarea", base) local newobject = loveframes.NewObject("scrollarea", "loveframes_object_scrollarea", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollarea:initialize(parent, bartype) function newobject:initialize(parent, bartype)
self.type = "scroll-area" self.type = "scroll-area"
self.bartype = bartype self.bartype = bartype
@ -23,7 +23,7 @@ function scrollarea:initialize(parent, bartype)
self.internal = true self.internal = true
self.internals = {} self.internals = {}
table.insert(self.internals, scrollbar:new(self, bartype)) table.insert(self.internals, loveframes.objects["scrollbar"]:new(self, bartype))
-- apply template properties to the object -- apply template properties to the object
loveframes.templates.ApplyToObject(self) loveframes.templates.ApplyToObject(self)
@ -34,7 +34,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollarea:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -123,7 +123,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollarea:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -160,7 +160,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollarea:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -213,7 +213,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollarea:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -237,7 +237,7 @@ end
- func: GetBarType() - func: GetBarType()
- desc: gets the object's bar type - desc: gets the object's bar type
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollarea:GetBarType() function newobject:GetBarType()
return self.bartype return self.bartype

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbar class -- scrollbar class
scrollbar = class("scrollbar", base) local newobject = loveframes.NewObject("scrollbar", "loveframes_object_scrollbar", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:initialize(parent, bartype) function newobject:initialize(parent, bartype)
self.type = "scrollbar" self.type = "scrollbar"
self.bartype = bartype self.bartype = bartype
@ -51,7 +51,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -193,7 +193,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -225,7 +225,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
local hover = self.hover local hover = self.hover
@ -267,7 +267,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -285,7 +285,7 @@ end
- func: SetMaxX(x) - func: SetMaxX(x)
- desc: sets the object's max x position - desc: sets the object's max x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:SetMaxX(x) function newobject:SetMaxX(x)
self.maxx = x self.maxx = x
@ -295,7 +295,7 @@ end
- func: SetMaxY(y) - func: SetMaxY(y)
- desc: sets the object's max y position - desc: sets the object's max y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:SetMaxY(y) function newobject:SetMaxY(y)
self.maxy = y self.maxy = y
@ -305,7 +305,7 @@ end
- func: Scroll(amount) - func: Scroll(amount)
- desc: scrolls the object - desc: scrolls the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:Scroll(amount) function newobject:Scroll(amount)
local bartype = self.bartype local bartype = self.bartype
local listo = self.parent.parent.parent local listo = self.parent.parent.parent
@ -343,7 +343,7 @@ end
- func: IsDragging() - func: IsDragging()
- desc: gets whether the object is being dragged or not - desc: gets whether the object is being dragged or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:IsDragging() function newobject:IsDragging()
return self.dragging return self.dragging
@ -353,7 +353,7 @@ end
- func: GetBarType() - func: GetBarType()
- desc: gets the object's bartype - desc: gets the object's bartype
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbar:GetBarType() function newobject:GetBarType()
return self.bartype return self.bartype

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbar class -- scrollbar class
scrollbody = class("scrollbody", base) local newobject = loveframes.NewObject("scrollbody", "loveframes_object_scrollbody", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbody:initialize(parent, bartype) function newobject:initialize(parent, bartype)
self.type = "scrollbody" self.type = "scrollbody"
self.bartype = bartype self.bartype = bartype
@ -32,13 +32,13 @@ function scrollbody:initialize(parent, bartype)
self.staticy = self.parent.height - self.height self.staticy = self.parent.height - self.height
end end
table.insert(self.internals, scrollarea:new(self, bartype)) table.insert(self.internals, loveframes.objects["scrollarea"]:new(self, bartype))
local bar = self.internals[1].internals[1] local bar = self.internals[1].internals[1]
if self.bartype == "vertical" then if self.bartype == "vertical" then
local upbutton = scrollbutton:new("up") local upbutton = loveframes.objects["scrollbutton"]:new("up")
upbutton.parent = self upbutton.parent = self
upbutton.Update = function(object, dt) upbutton.Update = function(object, dt)
upbutton.staticx = 0 + self.width - upbutton.width upbutton.staticx = 0 + self.width - upbutton.width
@ -48,7 +48,7 @@ function scrollbody:initialize(parent, bartype)
end end
end end
local downbutton = scrollbutton:new("down") local downbutton = loveframes.objects["scrollbutton"]:new("down")
downbutton.parent = self downbutton.parent = self
downbutton.Update = function(object, dt) downbutton.Update = function(object, dt)
downbutton.staticx = 0 + self.width - downbutton.width downbutton.staticx = 0 + self.width - downbutton.width
@ -63,7 +63,7 @@ function scrollbody:initialize(parent, bartype)
elseif self.bartype == "horizontal" then elseif self.bartype == "horizontal" then
local leftbutton = scrollbutton:new("left") local leftbutton = loveframes.objects["scrollbutton"]:new("left")
leftbutton.parent = self leftbutton.parent = self
leftbutton.Update = function(object, dt) leftbutton.Update = function(object, dt)
leftbutton.staticx = 0 leftbutton.staticx = 0
@ -73,7 +73,7 @@ function scrollbody:initialize(parent, bartype)
end end
end end
local rightbutton = scrollbutton:new("right") local rightbutton = loveframes.objects["scrollbutton"]:new("right")
rightbutton.parent = self rightbutton.parent = self
rightbutton.Update = function(object, dt) rightbutton.Update = function(object, dt)
rightbutton.staticx = 0 + self.width - rightbutton.width rightbutton.staticx = 0 + self.width - rightbutton.width
@ -97,7 +97,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbody:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -135,7 +135,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbody:draw() function newobject:draw()
local visible = self.visible local visible = self.visible

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- scrollbutton clas -- scrollbutton clas
scrollbutton = class("scrollbutton", base) local newobject = loveframes.NewObject("scrollbutton", "loveframes_object_scrollbutton", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:initialize(scrolltype) function newobject:initialize(scrolltype)
self.type = "scrollbutton" self.type = "scrollbutton"
self.scrolltype = scrolltype self.scrolltype = scrolltype
@ -29,7 +29,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -75,7 +75,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -107,7 +107,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -136,7 +136,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -164,7 +164,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:SetText(text) function newobject:SetText(text)
return return
@ -175,7 +175,7 @@ end
- func: GetScrollType() - func: GetScrollType()
- desc: gets the object's scroll type - desc: gets the object's scroll type
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function scrollbutton:GetScrollType() function newobject:GetScrollType()
return self.scrolltype return self.scrolltype

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- sliderbutton class -- sliderbutton class
sliderbutton = class("sliderbutton", base) local newobject = loveframes.NewObject("sliderbutton", "loveframes_object_sliderbutton", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:initialize(parent) function newobject:initialize(parent)
self.type = "sliderbutton" self.type = "sliderbutton"
self.width = 10 self.width = 10
@ -36,7 +36,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -108,7 +108,6 @@ function sliderbutton:update(dt)
end end
--
if nvalue > self.parent.max then if nvalue > self.parent.max then
nvalue = self.parent.max nvalue = self.parent.max
end end
@ -119,6 +118,10 @@ function sliderbutton:update(dt)
self.parent.value = nvalue self.parent.value = nvalue
if self.parent.value == -0 then
self.parent.value = math.abs(self.parent.value)
end
if nvalue ~= pvalue and nvalue >= self.parent.min and nvalue <= self.parent.max then if nvalue ~= pvalue and nvalue >= self.parent.min and nvalue <= self.parent.max then
if self.parent.OnValueChanged then if self.parent.OnValueChanged then
self.parent.OnValueChanged(self.parent, self.parent.value) self.parent.OnValueChanged(self.parent, self.parent.value)
@ -157,7 +160,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -189,7 +192,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -223,7 +226,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -240,7 +243,7 @@ end
- func: MoveToX(x) - func: MoveToX(x)
- desc: moves the object to the specified x position - desc: moves the object to the specified x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:MoveToX(x) function newobject:MoveToX(x)
self.staticx = x self.staticx = x
@ -250,7 +253,7 @@ end
- func: MoveToY(y) - func: MoveToY(y)
- desc: moves the object to the specified y position - desc: moves the object to the specified y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function sliderbutton:MoveToY(y) function newobject:MoveToY(y)
self.staticy = y self.staticy = y

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- tabbutton class -- tabbutton class
tabbutton = class("tabbutton", base) local newobject = loveframes.NewObject("tabbutton", "loveframes_object_tabbutton", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:initialize(parent, text, tabnumber, tip, image) function newobject:initialize(parent, text, tabnumber, tip, image)
self.type = "tabbutton" self.type = "tabbutton"
self.font = loveframes.smallfont self.font = loveframes.smallfont
@ -26,7 +26,7 @@ function tabbutton:initialize(parent, text, tabnumber, tip, image)
self.image = nil self.image = nil
if tip then if tip then
self.tooltip = tooltip:new(self, tip) self.tooltip = loveframes.objects["tooltip"]:new(self, tip)
self.tooltip:SetFollowCursor(false) self.tooltip:SetFollowCursor(false)
self.tooltip:SetOffsets(0, -5) self.tooltip:SetOffsets(0, -5)
end end
@ -44,7 +44,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -78,7 +78,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:draw() function newobject:draw()
if not self.visible then if not self.visible then
return return
@ -109,7 +109,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -138,7 +138,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -166,7 +166,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -176,7 +176,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:GetText() function newobject:GetText()
return self.text return self.text
@ -186,7 +186,7 @@ end
- func: SetImage(image) - func: SetImage(image)
- desc: adds an image to the object - desc: adds an image to the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:SetImage(image) function newobject:SetImage(image)
if type(image) == "string" then if type(image) == "string" then
self.image = love.graphics.newImage(image) self.image = love.graphics.newImage(image)
@ -200,7 +200,7 @@ end
- func: GetImage() - func: GetImage()
- desc: gets the object's image - desc: gets the object's image
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:GetImage() function newobject:GetImage()
return self.image return self.image
@ -210,7 +210,7 @@ end
- func: GetTabNumber() - func: GetTabNumber()
- desc: gets the object's tab number - desc: gets the object's tab number
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabbutton:GetTabNumber() function newobject:GetTabNumber()
return self.tabnumber return self.tabnumber

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- tooltip clas -- tooltip clas
tooltip = class("tooltip", base) local newobject = loveframes.NewObject("tooltip", "loveframes_object_tooltip", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:initialize(object, text, width) function newobject:initialize(object, text, width)
local width = width or 0 local width = width or 0
@ -45,7 +45,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -122,7 +122,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -163,7 +163,7 @@ end
- desc: sets whether or not the tooltip should follow the - desc: sets whether or not the tooltip should follow the
cursor cursor
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetFollowCursor(bool) function newobject:SetFollowCursor(bool)
self.followcursor = bool self.followcursor = bool
@ -173,7 +173,7 @@ end
- func: SetObject(object) - func: SetObject(object)
- desc: sets the tooltip's object - desc: sets the tooltip's object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetObject(object) function newobject:SetObject(object)
self.object = object self.object = object
@ -183,7 +183,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the tooltip's text - desc: sets the tooltip's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetText(text) function newobject:SetText(text)
self.text:SetText(text) self.text:SetText(text)
self.text2 = text self.text2 = text
@ -194,7 +194,7 @@ end
- func: SetTextMaxWidth(text) - func: SetTextMaxWidth(text)
- desc: sets the tooltip's text max width - desc: sets the tooltip's text max width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetTextMaxWidth(width) function newobject:SetTextMaxWidth(width)
self.text:SetMaxWidth(width) self.text:SetMaxWidth(width)
@ -204,7 +204,7 @@ end
- func: SetOffsets(xoffset, yoffset) - func: SetOffsets(xoffset, yoffset)
- desc: sets the tooltip's x and y offset - desc: sets the tooltip's x and y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetOffsets(xoffset, yoffset) function newobject:SetOffsets(xoffset, yoffset)
self.xoffset = xoffset self.xoffset = xoffset
self.yoffset = yoffset self.yoffset = yoffset
@ -215,7 +215,7 @@ end
- func: SetPadding(padding) - func: SetPadding(padding)
- desc: sets the tooltip's padding - desc: sets the tooltip's padding
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetPadding(padding) function newobject:SetPadding(padding)
self.padding = padding self.padding = padding
@ -225,7 +225,7 @@ end
- func: SetFont(font) - func: SetFont(font)
- desc: sets the tooltip's font - desc: sets the tooltip's font
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tooltip:SetFont(font) function newobject:SetFont(font)
self.text:SetFont(font) self.text:SetFont(font)

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- list class -- list class
list = class("list", base) local newobject = loveframes.NewObject("list", "loveframes_object_list", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:initialize() function newobject:initialize()
self.type = "list" self.type = "list"
self.display = "vertical" self.display = "vertical"
@ -40,7 +40,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -95,7 +95,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -151,7 +151,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -207,7 +207,7 @@ end
- func: AddItem(object) - func: AddItem(object)
- desc: adds an item to the object - desc: adds an item to the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:AddItem(object) function newobject:AddItem(object)
if object.type == "frame" then if object.type == "frame" then
return return
@ -232,7 +232,7 @@ end
- func: RemoveItem(object) - func: RemoveItem(object)
- desc: removes an item from the object - desc: removes an item from the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:RemoveItem(object) function newobject:RemoveItem(object)
object:Remove() object:Remove()
self:CalculateSize() self:CalculateSize()
@ -244,7 +244,7 @@ end
- func: CalculateSize() - func: CalculateSize()
- desc: calculates the size of the object's children - desc: calculates the size of the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:CalculateSize() function newobject:CalculateSize()
local numitems = #self.children local numitems = #self.children
local height = self.height local height = self.height
@ -274,7 +274,7 @@ function list:CalculateSize()
self.extraheight = itemheight - height self.extraheight = itemheight - height
if not vbar then if not vbar then
local scrollbar = scrollbody:new(self, display) local scrollbar = loveframes.objects["scrollbody"]:new(self, display)
table.insert(internals, scrollbar) table.insert(internals, scrollbar)
self.vbar = true self.vbar = true
self:GetScrollBar().autoscroll = self.autoscroll self:GetScrollBar().autoscroll = self.autoscroll
@ -306,7 +306,7 @@ function list:CalculateSize()
self.extrawidth = itemwidth - width self.extrawidth = itemwidth - width
if not hbar then if not hbar then
local scrollbar = scrollbody:new(self, display) local scrollbar = loveframes.objects["scrollbody"]:new(self, display)
table.insert(internals, scrollbar) table.insert(internals, scrollbar)
self.hbar = true self.hbar = true
self:GetScrollBar().autoscroll = self.autoscroll self:GetScrollBar().autoscroll = self.autoscroll
@ -331,7 +331,7 @@ end
- func: RedoLayout() - func: RedoLayout()
- desc: used to redo the layour of the object - desc: used to redo the layour of the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:RedoLayout() function newobject:RedoLayout()
local children = self.children local children = self.children
local padding = self.padding local padding = self.padding
@ -407,7 +407,7 @@ end
- func: SetDisplayType(type) - func: SetDisplayType(type)
- desc: sets the object's display type - desc: sets the object's display type
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetDisplayType(type) function newobject:SetDisplayType(type)
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
@ -430,7 +430,7 @@ end
- func: GetDisplayType() - func: GetDisplayType()
- desc: gets the object's display type - desc: gets the object's display type
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:GetDisplayType() function newobject:GetDisplayType()
return self.display return self.display
@ -440,7 +440,7 @@ end
- func: SetPadding(amount) - func: SetPadding(amount)
- desc: sets the object's padding - desc: sets the object's padding
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetPadding(amount) function newobject:SetPadding(amount)
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
@ -458,7 +458,7 @@ end
- func: SetSpacing(amount) - func: SetSpacing(amount)
- desc: sets the object's spacing - desc: sets the object's spacing
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetSpacing(amount) function newobject:SetSpacing(amount)
local children = self.children local children = self.children
local numchildren = #children local numchildren = #children
@ -476,7 +476,7 @@ end
- func: Clear() - func: Clear()
- desc: removes all of the object's children - desc: removes all of the object's children
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:Clear() function newobject:Clear()
self.children = {} self.children = {}
self:CalculateSize() self:CalculateSize()
@ -488,7 +488,7 @@ end
- func: SetWidth(width) - func: SetWidth(width)
- desc: sets the object's width - desc: sets the object's width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetWidth(width) function newobject:SetWidth(width)
self.width = width self.width = width
self:CalculateSize() self:CalculateSize()
@ -500,7 +500,7 @@ end
- func: SetHeight(height) - func: SetHeight(height)
- desc: sets the object's height - desc: sets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetHeight(height) function newobject:SetHeight(height)
self.height = height self.height = height
self:CalculateSize() self:CalculateSize()
@ -512,7 +512,7 @@ end
- func: GetSize() - func: GetSize()
- desc: gets the object's size - desc: gets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetSize(width, height) function newobject:SetSize(width, height)
self.width = width self.width = width
self.height = height self.height = height
@ -525,7 +525,7 @@ end
- func: GetScrollBar() - func: GetScrollBar()
- desc: gets the object's scroll bar - desc: gets the object's scroll bar
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:GetScrollBar() function newobject:GetScrollBar()
local vbar = self.vbar local vbar = self.vbar
local hbar = self.hbar local hbar = self.hbar
@ -548,7 +548,7 @@ end
auto scroll to the bottom when a new object is auto scroll to the bottom when a new object is
added to the list added to the list
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetAutoScroll(bool) function newobject:SetAutoScroll(bool)
local scrollbar = self:GetScrollBar() local scrollbar = self:GetScrollBar()
@ -565,7 +565,7 @@ end
- desc: sets the scroll amount of the object's scrollbar - desc: sets the scroll amount of the object's scrollbar
buttons buttons
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetButtonScrollAmount(amount) function newobject:SetButtonScrollAmount(amount)
self.buttonscrollamount = amount self.buttonscrollamount = amount
@ -576,7 +576,7 @@ end
- desc: gets the scroll amount of the object's scrollbar - desc: gets the scroll amount of the object's scrollbar
buttons buttons
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:GetButtonScrollAmount() function newobject:GetButtonScrollAmount()
return self.buttonscrollamount return self.buttonscrollamount
@ -586,7 +586,7 @@ end
- func: SetMouseWheelScrollAmount(amount) - func: SetMouseWheelScrollAmount(amount)
- desc: sets the scroll amount of the mouse wheel - desc: sets the scroll amount of the mouse wheel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:SetMouseWheelScrollAmount(amount) function newobject:SetMouseWheelScrollAmount(amount)
self.mousewheelscrollamount = amount self.mousewheelscrollamount = amount
@ -596,7 +596,7 @@ end
- func: GetMouseWheelScrollAmount() - func: GetMouseWheelScrollAmount()
- desc: gets the scroll amount of the mouse wheel - desc: gets the scroll amount of the mouse wheel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function list:GetButtonScrollAmount() function newobject:GetButtonScrollAmount()
return self.mousewheelscrollamount return self.mousewheelscrollamount

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- multichoice class -- multichoice class
multichoice = class("multichoice", base) local newobject = loveframes.NewObject("multichoice", "loveframes_object_multichoice", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:initialize() function newobject:initialize()
self.type = "multichoice" self.type = "multichoice"
self.choice = "" self.choice = ""
@ -19,6 +19,8 @@ function multichoice:initialize()
self.height = 25 self.height = 25
self.listpadding = 0 self.listpadding = 0
self.listspacing = 0 self.listspacing = 0
self.buttonscrollamount = 0.10
self.mousewheelscrollamount = 5
self.haslist = false self.haslist = false
self.internal = false self.internal = false
self.choices = {} self.choices = {}
@ -30,7 +32,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -63,7 +65,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -95,7 +97,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -115,7 +117,7 @@ function multichoice:mousepressed(x, y, button)
end end
self.haslist = true self.haslist = true
self.list = multichoicelist:new(self) self.list = loveframes.objects["multichoicelist"]:new(self)
loveframes.hoverobject = self loveframes.hoverobject = self
end end
@ -126,7 +128,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -140,7 +142,7 @@ end
- func: AddChoice(choice) - func: AddChoice(choice)
- desc: adds a choice to the current list of choices - desc: adds a choice to the current list of choices
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:AddChoice(choice) function newobject:AddChoice(choice)
local choices = self.choices local choices = self.choices
table.insert(choices, choice) table.insert(choices, choice)
@ -151,7 +153,7 @@ end
- func: SetChoice(choice) - func: SetChoice(choice)
- desc: sets the current choice - desc: sets the current choice
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:SetChoice(choice) function newobject:SetChoice(choice)
self.choice = choice self.choice = choice
@ -161,7 +163,7 @@ end
- func: SelectChoice(choice) - func: SelectChoice(choice)
- desc: selects a choice - desc: selects a choice
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:SelectChoice(choice) function newobject:SelectChoice(choice)
local onchoiceselected = self.OnChoiceSelected local onchoiceselected = self.OnChoiceSelected
@ -178,7 +180,7 @@ end
- func: SetListHeight(height) - func: SetListHeight(height)
- desc: sets the height of the list of choices - desc: sets the height of the list of choices
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:SetListHeight(height) function newobject:SetListHeight(height)
self.listheight = height self.listheight = height
@ -188,7 +190,7 @@ end
- func: SetPadding(padding) - func: SetPadding(padding)
- desc: sets the padding of the list of choices - desc: sets the padding of the list of choices
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:SetPadding(padding) function newobject:SetPadding(padding)
self.listpadding = padding self.listpadding = padding
@ -198,7 +200,7 @@ end
- func: SetSpacing(spacing) - func: SetSpacing(spacing)
- desc: sets the spacing of the list of choices - desc: sets the spacing of the list of choices
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:SetSpacing(spacing) function newobject:SetSpacing(spacing)
self.listspacing = spacing self.listspacing = spacing
@ -208,7 +210,7 @@ end
- func: GetValue() - func: GetValue()
- desc: gets the value (choice) of the object - desc: gets the value (choice) of the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:GetValue() function newobject:GetValue()
return self.choice return self.choice
@ -218,7 +220,7 @@ end
- func: GetChoice() - func: GetChoice()
- desc: gets the current choice (same as get value) - desc: gets the current choice (same as get value)
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:GetChoice() function newobject:GetChoice()
return self.choice return self.choice
@ -228,7 +230,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -238,8 +240,50 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function multichoice:GetText() function newobject:GetText()
return self.text return self.text
end end
--[[---------------------------------------------------------
- func: SetButtonScrollAmount(speed)
- desc: sets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:SetButtonScrollAmount(amount)
self.buttonscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetButtonScrollAmount()
- desc: gets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.buttonscrollamount
end
--[[---------------------------------------------------------
- func: SetMouseWheelScrollAmount(amount)
- desc: sets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:SetMouseWheelScrollAmount(amount)
self.mousewheelscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetMouseWheelScrollAmount()
- desc: gets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.mousewheelscrollamount
end

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- panel class -- panel class
panel = class("panel", base) local newobject = loveframes.NewObject("panel", "loveframes_object_panel", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function panel:initialize() function newobject:initialize()
self.type = "panel" self.type = "panel"
self.width = 200 self.width = 200
@ -24,7 +24,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the element - desc: updates the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function panel:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -62,7 +62,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function panel:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -100,7 +100,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function panel:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -131,7 +131,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function panel:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
local children = self.children local children = self.children

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- progressbar class -- progressbar class
progressbar = class("progressbar", base) local newobject = loveframes.NewObject("progressbar", "loveframes_object_progressbar", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:initialize() function newobject:initialize()
self.type = "progressbar" self.type = "progressbar"
self.width = 100 self.width = 100
@ -34,7 +34,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -125,7 +125,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -157,7 +157,7 @@ end
- func: SetMax(max) - func: SetMax(max)
- desc: sets the object's maximum value - desc: sets the object's maximum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:SetMax(max) function newobject:SetMax(max)
self.max = max self.max = max
@ -167,7 +167,7 @@ end
- func: GetMax() - func: GetMax()
- desc: gets the object's maximum value - desc: gets the object's maximum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetMax() function newobject:GetMax()
return self.max return self.max
@ -177,7 +177,7 @@ end
- func: SetMin(min) - func: SetMin(min)
- desc: sets the object's minimum value - desc: sets the object's minimum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:SetMin(min) function newobject:SetMin(min)
self.min = min self.min = min
@ -187,7 +187,7 @@ end
- func: GetMin() - func: GetMin()
- desc: gets the object's minimum value - desc: gets the object's minimum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetMin() function newobject:GetMin()
return self.min return self.min
@ -197,7 +197,7 @@ end
- func: SetMinMax() - func: SetMinMax()
- desc: sets the object's minimum and maximum values - desc: sets the object's minimum and maximum values
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:SetMinMax(min, max) function newobject:SetMinMax(min, max)
self.min = min self.min = min
self.max = max self.max = max
@ -208,7 +208,7 @@ end
- func: GetMinMax() - func: GetMinMax()
- desc: gets the object's minimum and maximum values - desc: gets the object's minimum and maximum values
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetMinMax() function newobject:GetMinMax()
return self.min, self.max return self.min, self.max
@ -218,7 +218,7 @@ end
- func: SetValue(value) - func: SetValue(value)
- desc: sets the object's value - desc: sets the object's value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:SetValue(value) function newobject:SetValue(value)
local lerp = self.lerp local lerp = self.lerp
@ -237,7 +237,7 @@ end
- func: GetValue() - func: GetValue()
- desc: gets the object's value - desc: gets the object's value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetValue() function newobject:GetValue()
return self.value return self.value
@ -248,7 +248,7 @@ end
- desc: sets whether or not the object should lerp - desc: sets whether or not the object should lerp
when changing between values when changing between values
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:SetLerp(bool) function newobject:SetLerp(bool)
self.lerp = bool self.lerp = bool
self.lerpto = self:GetValue() self.lerpto = self:GetValue()
@ -261,7 +261,7 @@ end
- desc: gets whether or not the object should lerp - desc: gets whether or not the object should lerp
when changing between values when changing between values
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetLerp() function newobject:GetLerp()
return self.lerp return self.lerp
@ -271,7 +271,7 @@ end
- func: SetLerpRate(rate) - func: SetLerpRate(rate)
- desc: sets the object's lerp rate - desc: sets the object's lerp rate
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:SetLerpRate(rate) function newobject:SetLerpRate(rate)
self.lerprate = rate self.lerprate = rate
@ -281,7 +281,7 @@ end
- func: GetLerpRate() - func: GetLerpRate()
- desc: gets the object's lerp rate - desc: gets the object's lerp rate
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetLerpRate() function newobject:GetLerpRate()
return self.lerprate return self.lerprate
@ -292,7 +292,7 @@ end
- desc: gets whether or not the object has reached it's - desc: gets whether or not the object has reached it's
maximum value maximum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetCompleted() function newobject:GetCompleted()
return self.completed return self.completed
@ -302,7 +302,7 @@ end
- func: GetBarWidth() - func: GetBarWidth()
- desc: gets the object's bar width - desc: gets the object's bar width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function progressbar:GetBarWidth() function newobject:GetBarWidth()
return self.barwidth return self.barwidth

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- slider class -- slider class
slider = class("slider", base) local newobject = loveframes.NewObject("slider", "loveframes_object_slider", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:initialize() function newobject:initialize()
self.type = "slider" self.type = "slider"
self.text = "Slider" self.text = "Slider"
@ -26,7 +26,7 @@ function slider:initialize()
self.OnValueChanged = nil self.OnValueChanged = nil
-- create the slider button -- create the slider button
table.insert(self.internals, sliderbutton:new(self)) table.insert(self.internals, loveframes.objects["sliderbutton"]:new(self))
-- set initial value to minimum -- set initial value to minimum
self:SetValue(self.min) self:SetValue(self.min)
@ -37,7 +37,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -85,7 +85,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -123,7 +123,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -182,7 +182,7 @@ end
- func: SetValue(value) - func: SetValue(value)
- desc: sets the object's value - desc: sets the object's value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetValue(value) function newobject:SetValue(value)
if value > self.max then if value > self.max then
return return
@ -228,7 +228,7 @@ end
- func: GetValue() - func: GetValue()
- desc: gets the object's value - desc: gets the object's value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetValue() function newobject:GetValue()
return self.value return self.value
@ -238,7 +238,7 @@ end
- func: SetMax(max) - func: SetMax(max)
- desc: sets the object's maximum value - desc: sets the object's maximum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetMax(max) function newobject:SetMax(max)
self.max = max self.max = max
@ -252,7 +252,7 @@ end
- func: GetMax() - func: GetMax()
- desc: gets the object's maximum value - desc: gets the object's maximum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetMax() function newobject:GetMax()
return self.max return self.max
@ -262,7 +262,7 @@ end
- func: SetMin(min) - func: SetMin(min)
- desc: sets the object's minimum value - desc: sets the object's minimum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetMin(min) function newobject:SetMin(min)
self.min = min self.min = min
@ -276,7 +276,7 @@ end
- func: GetMin() - func: GetMin()
- desc: gets the object's minimum value - desc: gets the object's minimum value
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetMin() function newobject:GetMin()
return self.min return self.min
@ -286,7 +286,7 @@ end
- func: SetMinMax() - func: SetMinMax()
- desc: sets the object's minimum and maximum values - desc: sets the object's minimum and maximum values
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetMinMax(min, max) function newobject:SetMinMax(min, max)
self.min = min self.min = min
self.max = max self.max = max
@ -305,7 +305,7 @@ end
- func: GetMinMax() - func: GetMinMax()
- desc: gets the object's minimum and maximum values - desc: gets the object's minimum and maximum values
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetMinMax() function newobject:GetMinMax()
return self.min, self.max return self.min, self.max
@ -315,7 +315,7 @@ end
- func: SetText(name) - func: SetText(name)
- desc: sets the objects's text - desc: sets the objects's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetText(text) function newobject:SetText(text)
self.text = text self.text = text
@ -325,7 +325,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the objects's text - desc: gets the objects's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetText() function newobject:GetText()
return self.text return self.text
@ -335,7 +335,7 @@ end
- func: SetDecimals(decimals) - func: SetDecimals(decimals)
- desc: sets the objects's decimals - desc: sets the objects's decimals
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetDecimals(decimals) function newobject:SetDecimals(decimals)
self.decimals = decimals self.decimals = decimals
@ -345,7 +345,7 @@ end
- func: SetButtonSize(width, height) - func: SetButtonSize(width, height)
- desc: sets the objects's button size - desc: sets the objects's button size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetButtonSize(width, height) function newobject:SetButtonSize(width, height)
local internals = self.internals local internals = self.internals
local sliderbutton = internals[1] local sliderbutton = internals[1]
@ -361,7 +361,7 @@ end
- func: GetButtonSize() - func: GetButtonSize()
- desc: gets the objects's button size - desc: gets the objects's button size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetButtonSize() function newobject:GetButtonSize()
local internals = self.internals local internals = self.internals
local sliderbutton = internals[1] local sliderbutton = internals[1]
@ -378,7 +378,7 @@ end
- func: SetSlideType(slidetype) - func: SetSlideType(slidetype)
- desc: sets the objects's slide type - desc: sets the objects's slide type
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:SetSlideType(slidetype) function newobject:SetSlideType(slidetype)
self.slidetype = slidetype self.slidetype = slidetype
@ -392,7 +392,7 @@ end
- func: GetSlideType() - func: GetSlideType()
- desc: gets the objects's slide type - desc: gets the objects's slide type
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function slider:GetSlideType() function newobject:GetSlideType()
return self.slidetype return self.slidetype

View File

@ -4,13 +4,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- tabs class -- tabs class
tabs = class("tabpanel", base) local newobject = loveframes.NewObject("tabs", "loveframes_object_tabs", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:initialize() function newobject:initialize()
self.type = "tabs" self.type = "tabs"
self.width = 100 self.width = 100
@ -36,7 +36,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the element - desc: updates the element
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -100,7 +100,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -149,7 +149,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -224,7 +224,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
local children = self.children local children = self.children
@ -250,7 +250,7 @@ end
- func: AddTab(name, object, tip, image) - func: AddTab(name, object, tip, image)
- desc: adds a new tab to the tab panel - desc: adds a new tab to the tab panel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:AddTab(name, object, tip, image) function newobject:AddTab(name, object, tip, image)
local padding = self.padding local padding = self.padding
local autosize = self.autosize local autosize = self.autosize
@ -264,7 +264,7 @@ function tabs:AddTab(name, object, tip, image)
object.staticy = 0 object.staticy = 0
table.insert(self.children, object) table.insert(self.children, object)
internals[tabnumber] = tabbutton:new(self, name, tabnumber, tip, image) internals[tabnumber] = loveframes.objects["tabbutton"]:new(self, name, tabnumber, tip, image)
self.tabnumber = tabnumber + 1 self.tabnumber = tabnumber + 1
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
@ -285,7 +285,7 @@ end
- desc: creates scroll buttons fot the tab panel - desc: creates scroll buttons fot the tab panel
- note: for internal use only - note: for internal use only
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:AddScrollButtons() function newobject:AddScrollButtons()
local internals = self.internals local internals = self.internals
@ -295,7 +295,7 @@ function tabs:AddScrollButtons()
end end
end end
local leftbutton = scrollbutton:new("left") local leftbutton = loveframes.objects["scrollbutton"]:new("left")
leftbutton.parent = self leftbutton.parent = self
leftbutton:SetPos(0, 0) leftbutton:SetPos(0, 0)
leftbutton:SetSize(15, 25) leftbutton:SetSize(15, 25)
@ -316,7 +316,7 @@ function tabs:AddScrollButtons()
end end
end end
local rightbutton = scrollbutton:new("right") local rightbutton = loveframes.objects["scrollbutton"]:new("right")
rightbutton.parent = self rightbutton.parent = self
rightbutton:SetPos(self.width - 15, 0) rightbutton:SetPos(self.width - 15, 0)
rightbutton:SetSize(15, 25) rightbutton:SetSize(15, 25)
@ -347,7 +347,7 @@ end
- func: GetWidthOfButtons() - func: GetWidthOfButtons()
- desc: gets the total width of all of the tab buttons - desc: gets the total width of all of the tab buttons
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:GetWidthOfButtons() function newobject:GetWidthOfButtons()
local width = 0 local width = 0
local internals = self.internals local internals = self.internals
@ -366,7 +366,7 @@ end
- func: GetHeightOfButtons() - func: GetHeightOfButtons()
- desc: gets the height of one tab button - desc: gets the height of one tab button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:GetHeightOfButtons() function newobject:GetHeightOfButtons()
return self.tabheight return self.tabheight
@ -376,7 +376,7 @@ end
- func: SwitchToTab(tabnumber) - func: SwitchToTab(tabnumber)
- desc: makes the specified tab the active tab - desc: makes the specified tab the active tab
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:SwitchToTab(tabnumber) function newobject:SwitchToTab(tabnumber)
local children = self.children local children = self.children
@ -393,7 +393,7 @@ end
- func: SetScrollButtonSize(width, height) - func: SetScrollButtonSize(width, height)
- desc: sets the size of the scroll buttons - desc: sets the size of the scroll buttons
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:SetScrollButtonSize(width, height) function newobject:SetScrollButtonSize(width, height)
local internals = self.internals local internals = self.internals
@ -409,7 +409,7 @@ end
- func: SetPadding(paddint) - func: SetPadding(paddint)
- desc: sets the padding for the tab panel - desc: sets the padding for the tab panel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:SetPadding(padding) function newobject:SetPadding(padding)
self.padding = padding self.padding = padding
@ -419,7 +419,7 @@ end
- func: SetPadding(paddint) - func: SetPadding(paddint)
- desc: gets the padding of the tab panel - desc: gets the padding of the tab panel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:GetPadding() function newobject:GetPadding()
return self.padding return self.padding
@ -429,7 +429,7 @@ end
- func: SetTabHeight(height) - func: SetTabHeight(height)
- desc: sets the height of the tab buttons - desc: sets the height of the tab buttons
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:SetTabHeight(height) function newobject:SetTabHeight(height)
local autosize = self.autosize local autosize = self.autosize
local padding = self.padding local padding = self.padding
@ -463,7 +463,7 @@ end
- func: SetToolTipFont(font) - func: SetToolTipFont(font)
- desc: sets the height of the tab buttons - desc: sets the height of the tab buttons
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:SetToolTipFont(font) function newobject:SetToolTipFont(font)
local internals = self.internals local internals = self.internals
@ -479,7 +479,7 @@ end
- func: GetTabNumber() - func: GetTabNumber()
- desc: gets the object's tab number - desc: gets the object's tab number
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function tabs:GetTabNumber() function newobject:GetTabNumber()
return self.tab return self.tab

View File

@ -9,13 +9,13 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- text class -- text class
text = class("text", base) local newobject = loveframes.NewObject("text", "loveframes_object_text", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:initialize() function newobject:initialize()
self.type = "text" self.type = "text"
self.text = "" self.text = ""
@ -35,7 +35,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:update(dt) function newobject:update(dt)
if not self.visible then if not self.visible then
if not self.alwaysupdate then if not self.alwaysupdate then
@ -65,7 +65,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:draw() function newobject:draw()
if not self.visible then if not self.visible then
return return
@ -97,7 +97,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -123,7 +123,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetText(t) function newobject:SetText(t)
local dtype = type(t) local dtype = type(t)
local maxw = self.maxw local maxw = self.maxw
@ -311,7 +311,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:GetText() function newobject:GetText()
return self.text return self.text
@ -321,7 +321,7 @@ end
- func: GetFormattedText() - func: GetFormattedText()
- desc: gets the object's formatted text - desc: gets the object's formatted text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:GetFormattedText() function newobject:GetFormattedText()
return self.formattedtext return self.formattedtext
@ -331,7 +331,7 @@ end
- func: Format() - func: Format()
- desc: formats the text - desc: formats the text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:DrawText() function newobject:DrawText()
local textdata = self.formattedtext local textdata = self.formattedtext
local font = self.font local font = self.font
@ -363,7 +363,7 @@ end
- func: SetMaxWidth(width) - func: SetMaxWidth(width)
- desc: sets the object's maximum width - desc: sets the object's maximum width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetMaxWidth(width) function newobject:SetMaxWidth(width)
self.maxw = width self.maxw = width
self:SetText(self.original) self:SetText(self.original)
@ -374,7 +374,7 @@ end
- func: GetMaxWidth() - func: GetMaxWidth()
- desc: gets the object's maximum width - desc: gets the object's maximum width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:GetMaxWidth() function newobject:GetMaxWidth()
return self.maxw return self.maxw
@ -384,7 +384,7 @@ end
- func: SetWidth(width) - func: SetWidth(width)
- desc: sets the object's width - desc: sets the object's width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetWidth(width) function newobject:SetWidth(width)
self:SetMaxWidth(width) self:SetMaxWidth(width)
@ -394,7 +394,7 @@ end
- func: SetHeight() - func: SetHeight()
- desc: sets the object's height - desc: sets the object's height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetHeight(height) function newobject:SetHeight(height)
return return
@ -404,7 +404,7 @@ end
- func: SetSize() - func: SetSize()
- desc: sets the object's size - desc: sets the object's size
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetSize(width, height) function newobject:SetSize(width, height)
self:SetMaxWidth(width) self:SetMaxWidth(width)
@ -415,7 +415,7 @@ end
- desc: sets the object's font - desc: sets the object's font
- note: font argument must be a font object - note: font argument must be a font object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetFont(font) function newobject:SetFont(font)
local original = self.original local original = self.original
@ -431,7 +431,7 @@ end
- func: GetFont() - func: GetFont()
- desc: gets the object's font - desc: gets the object's font
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:GetFont() function newobject:GetFont()
return self.font return self.font
@ -441,7 +441,7 @@ end
- func: GetLines() - func: GetLines()
- desc: gets the number of lines the object's text uses - desc: gets the number of lines the object's text uses
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:GetLines() function newobject:GetLines()
return self.lines return self.lines
@ -451,7 +451,7 @@ end
- func: SetIgnoreNewlines(bool) - func: SetIgnoreNewlines(bool)
- desc: sets whether the object should ignore \n or not - desc: sets whether the object should ignore \n or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:SetIgnoreNewlines(bool) function newobject:SetIgnoreNewlines(bool)
self.ignorenewlines = bool self.ignorenewlines = bool
@ -461,7 +461,7 @@ end
- func: GetIgnoreNewlines() - func: GetIgnoreNewlines()
- desc: gets whether the object should ignore \n or not - desc: gets whether the object should ignore \n or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function text:GetIgnoreNewlines() function newobject:GetIgnoreNewlines()
return self.ignorenewlines return self.ignorenewlines

View File

@ -4,14 +4,14 @@
--]]------------------------------------------------ --]]------------------------------------------------
-- textinput class -- textinput class
textinput = class("textinput", base) local newobject = loveframes.NewObject("textinput", "loveframes_object_textinput", true)
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:initialize() function newobject:initialize()
self.type = "textinput" self.type = "textinput"
self.keydown = "none" self.keydown = "none"
@ -41,6 +41,8 @@ function textinput:initialize()
self.bottompadding = 0 self.bottompadding = 0
self.lastclicktime = 0 self.lastclicktime = 0
self.maxx = 0 self.maxx = 0
self.buttonscrollamount = 0.10
self.mousewheelscrollamount = 5
self.usable = {} self.usable = {}
self.unusable = {} self.unusable = {}
self.lines = {""} self.lines = {""}
@ -64,7 +66,7 @@ end
- func: update(deltatime) - func: update(deltatime)
- desc: updates the object - desc: updates the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:update(dt) function newobject:update(dt)
local visible = self.visible local visible = self.visible
local alwaysupdate = self.alwaysupdate local alwaysupdate = self.alwaysupdate
@ -156,7 +158,7 @@ function textinput:update(dt)
if itemheight > height then if itemheight > height then
if not vbar then if not vbar then
local scrollbody = scrollbody:new(self, "vertical") local scrollbody = loveframes.objects["scrollbody"]:new(self, "vertical")
scrollbody.internals[1].internals[1].autoscroll = false scrollbody.internals[1].internals[1].autoscroll = false
table.insert(self.internals, scrollbody) table.insert(self.internals, scrollbody)
self.vbar = true self.vbar = true
@ -181,7 +183,7 @@ function textinput:update(dt)
if itemwidth > width then if itemwidth > width then
if not hbar then if not hbar then
local scrollbody = scrollbody:new(self, "horizontal") local scrollbody = loveframes.objects["scrollbody"]:new(self, "horizontal")
scrollbody.internals[1].internals[1].autoscroll = false scrollbody.internals[1].internals[1].autoscroll = false
table.insert(self.internals, scrollbody) table.insert(self.internals, scrollbody)
self.hbar = true self.hbar = true
@ -208,7 +210,7 @@ function textinput:update(dt)
if self.linenumbers then if self.linenumbers then
if not self.linenumberspanel then if not self.linenumberspanel then
local linenumberspanel = linenumberspanel:new(self) local linenumberspanel = loveframes.objects["linenumberspanel"]:new(self)
table.insert(self.internals, linenumberspanel) table.insert(self.internals, linenumberspanel)
self.linenumberspanel = true self.linenumberspanel = true
end end
@ -235,7 +237,7 @@ end
- func: draw() - func: draw()
- desc: draws the object - desc: draws the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:draw() function newobject:draw()
local visible = self.visible local visible = self.visible
@ -289,7 +291,7 @@ end
- func: mousepressed(x, y, button) - func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button - desc: called when the player presses a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:mousepressed(x, y, button) function newobject:mousepressed(x, y, button)
local visible = self.visible local visible = self.visible
@ -302,6 +304,7 @@ function textinput:mousepressed(x, y, button)
local internals = self.internals local internals = self.internals
local vbar = self.vbar local vbar = self.vbar
local hbar = self.hbar local hbar = self.hbar
local scrollamount = self.mousewheelscrollamount
if hover and button == "l" then if hover and button == "l" then
@ -336,24 +339,24 @@ function textinput:mousepressed(x, y, button)
if button == "wu" then if button == "wu" then
if vbar and not hbar then if vbar and not hbar then
local vbar = self:GetVerticalScrollBody().internals[1].internals[1] local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
vbar:Scroll(-5) vbar:Scroll(-scrollamount)
elseif vbar and hbar then elseif vbar and hbar then
local vbar = self:GetVerticalScrollBody().internals[1].internals[1] local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
vbar:Scroll(-5) vbar:Scroll(-scrollamount)
elseif not vbar and hbar then elseif not vbar and hbar then
local hbar = self:GetHorizontalScrollBody().internals[1].internals[1] local hbar = self:GetHorizontalScrollBody().internals[1].internals[1]
hbar:Scroll(-5) hbar:Scroll(-scrollamount)
end end
elseif button == "wd" then elseif button == "wd" then
if vbar and not hbar then if vbar and not hbar then
local vbar = self:GetVerticalScrollBody().internals[1].internals[1] local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
vbar:Scroll(5) vbar:Scroll(scrollamount)
elseif vbar and hbar then elseif vbar and hbar then
local vbar = self:GetVerticalScrollBody().internals[1].internals[1] local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
vbar:Scroll(5) vbar:Scroll(scrollamount)
elseif not vbar and hbar then elseif not vbar and hbar then
local hbar = self:GetHorizontalScrollBody().internals[1].internals[1] local hbar = self:GetHorizontalScrollBody().internals[1].internals[1]
hbar:Scroll(5) hbar:Scroll(scrollamount)
end end
end end
end end
@ -368,7 +371,7 @@ end
- func: mousereleased(x, y, button) - func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button - desc: called when the player releases a mouse button
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:mousereleased(x, y, button) function newobject:mousereleased(x, y, button)
local visible = self.visible local visible = self.visible
@ -388,7 +391,7 @@ end
- func: keypressed(key) - func: keypressed(key)
- desc: called when the player presses a key - desc: called when the player presses a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:keypressed(key, unicode) function newobject:keypressed(key, unicode)
local visible = self.visible local visible = self.visible
@ -418,7 +421,7 @@ end
- func: keyreleased(key) - func: keyreleased(key)
- desc: called when the player releases a key - desc: called when the player releases a key
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:keyreleased(key) function newobject:keyreleased(key)
local visible = self.visible local visible = self.visible
@ -434,7 +437,7 @@ end
- func: RunKey(key, unicode) - func: RunKey(key, unicode)
- desc: runs a key event on the object - desc: runs a key event on the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:RunKey(key, unicode) function newobject:RunKey(key, unicode)
local visible = self.visible local visible = self.visible
local focus = self.focus local focus = self.focus
@ -730,7 +733,7 @@ end
- func: MoveIndicator(num, exact) - func: MoveIndicator(num, exact)
- desc: moves the object's indicator - desc: moves the object's indicator
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:MoveIndicator(num, exact) function newobject:MoveIndicator(num, exact)
local lines = self.lines local lines = self.lines
local line = self.line local line = self.line
@ -761,7 +764,7 @@ end
- desc: updates the object's text insertion position - desc: updates the object's text insertion position
indicator indicator
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:UpdateIndicator() function newobject:UpdateIndicator()
local time = love.timer.getTime() local time = love.timer.getTime()
local indincatortime = self.indincatortime local indincatortime = self.indincatortime
@ -808,7 +811,7 @@ end
- desc: adds text into the object's text a given - desc: adds text into the object's text a given
position position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:AddIntoText(t, p) function newobject:AddIntoText(t, p)
local lines = self.lines local lines = self.lines
local line = self.line local line = self.line
@ -827,7 +830,7 @@ end
- desc: removes text from the object's text a given - desc: removes text from the object's text a given
position position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:RemoveFromeText(p) function newobject:RemoveFromeText(p)
local lines = self.lines local lines = self.lines
local line = self.line local line = self.line
@ -846,7 +849,7 @@ end
- func: GetTextCollisions(x, y) - func: GetTextCollisions(x, y)
- desc: gets text collisions with the mouse - desc: gets text collisions with the mouse
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetTextCollisions(x, y) function newobject:GetTextCollisions(x, y)
local font = self.font local font = self.font
local lines = self.lines local lines = self.lines
@ -957,7 +960,7 @@ end
- func: PositionText() - func: PositionText()
- desc: positions the object's text - desc: positions the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:PositionText() function newobject:PositionText()
local multiline = self.multiline local multiline = self.multiline
local x = self.x local x = self.x
@ -988,7 +991,7 @@ end
- func: SetTextOffsetX(num) - func: SetTextOffsetX(num)
- desc: sets the object's text x offset - desc: sets the object's text x offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetTextOffsetX(num) function newobject:SetTextOffsetX(num)
self.textoffsetx = num self.textoffsetx = num
@ -998,7 +1001,7 @@ end
- func: SetTextOffsetY(num) - func: SetTextOffsetY(num)
- desc: sets the object's text y offset - desc: sets the object's text y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetTextOffsetY(num) function newobject:SetTextOffsetY(num)
self.textoffsety = num self.textoffsety = num
@ -1008,7 +1011,7 @@ end
- func: SetFont(font) - func: SetFont(font)
- desc: sets the object's font - desc: sets the object's font
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetFont(font) function newobject:SetFont(font)
self.font = font self.font = font
@ -1018,7 +1021,7 @@ end
- func: GetFont() - func: GetFont()
- desc: gets the object's font - desc: gets the object's font
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetFont() function newobject:GetFont()
return self.font return self.font
@ -1028,7 +1031,7 @@ end
- func: SetFocus(focus) - func: SetFocus(focus)
- desc: sets the object's focus - desc: sets the object's focus
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetFocus(focus) function newobject:SetFocus(focus)
self.focus = focus self.focus = focus
@ -1038,7 +1041,7 @@ end
- func: GetFocus() - func: GetFocus()
- desc: gets the object's focus - desc: gets the object's focus
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetFocus() function newobject:GetFocus()
return self.focus return self.focus
@ -1048,7 +1051,7 @@ end
- func: GetIndicatorVisibility() - func: GetIndicatorVisibility()
- desc: gets the object's indicator visibility - desc: gets the object's indicator visibility
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetIndicatorVisibility() function newobject:GetIndicatorVisibility()
return self.showindicator return self.showindicator
@ -1058,7 +1061,7 @@ end
- func: SetLimit(limit) - func: SetLimit(limit)
- desc: sets the object's text limit - desc: sets the object's text limit
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetLimit(limit) function newobject:SetLimit(limit)
self.limit = limit self.limit = limit
@ -1069,7 +1072,7 @@ end
- desc: sets what characters can be used for the - desc: sets what characters can be used for the
object's text object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetUsable(usable) function newobject:SetUsable(usable)
self.usable = usable self.usable = usable
@ -1080,7 +1083,7 @@ end
- desc: gets what characters can be used for the - desc: gets what characters can be used for the
object's text object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetUsable() function newobject:GetUsable()
return self.usable return self.usable
@ -1091,7 +1094,7 @@ end
- desc: sets what characters can not be used for the - desc: sets what characters can not be used for the
object's text object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetUnusable(unusable) function newobject:SetUnusable(unusable)
self.unusable = unusable self.unusable = unusable
@ -1102,7 +1105,7 @@ end
- desc: gets what characters can not be used for the - desc: gets what characters can not be used for the
object's text object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetUnusable() function newobject:GetUnusable()
return self.unusable return self.unusable
@ -1112,7 +1115,7 @@ end
- func: Clear() - func: Clear()
- desc: clears the object's text - desc: clears the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:Clear() function newobject:Clear()
self.lines = {""} self.lines = {""}
self.line = 1 self.line = 1
@ -1126,7 +1129,7 @@ end
- func: SetText(text) - func: SetText(text)
- desc: sets the object's text - desc: sets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetText(text) function newobject:SetText(text)
local tabreplacement = self.tabreplacement local tabreplacement = self.tabreplacement
local multiline = self.multiline local multiline = self.multiline
@ -1158,7 +1161,7 @@ end
- func: GetText() - func: GetText()
- desc: gets the object's text - desc: gets the object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetText() function newobject:GetText()
local multiline = self.multiline local multiline = self.multiline
local lines = self.lines local lines = self.lines
@ -1181,7 +1184,7 @@ end
- desc: enables or disables allowing multiple lines for - desc: enables or disables allowing multiple lines for
text entry text entry
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetMultiline(bool) function newobject:SetMultiline(bool)
local text = "" local text = ""
local lines = self.lines local lines = self.lines
@ -1208,7 +1211,7 @@ end
- desc: gets whether or not the object is using multiple - desc: gets whether or not the object is using multiple
lines lines
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetMultiLine() function newobject:GetMultiLine()
return self.multiline return self.multiline
@ -1218,7 +1221,7 @@ end
- func: GetVerticalScrollBody() - func: GetVerticalScrollBody()
- desc: gets the object's vertical scroll body - desc: gets the object's vertical scroll body
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetVerticalScrollBody() function newobject:GetVerticalScrollBody()
local vbar = self.vbar local vbar = self.vbar
local internals = self.internals local internals = self.internals
@ -1240,7 +1243,7 @@ end
- func: GetHorizontalScrollBody() - func: GetHorizontalScrollBody()
- desc: gets the object's horizontal scroll body - desc: gets the object's horizontal scroll body
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetHorizontalScrollBody() function newobject:GetHorizontalScrollBody()
local hbar = self.hbar local hbar = self.hbar
local internals = self.internals local internals = self.internals
@ -1263,7 +1266,7 @@ end
- desc: gets whether or not the object has a vertical - desc: gets whether or not the object has a vertical
scroll bar scroll bar
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:HasVerticalScrollBar() function newobject:HasVerticalScrollBar()
return self.vbar return self.vbar
@ -1274,7 +1277,7 @@ end
- desc: gets whether or not the object has a horizontal - desc: gets whether or not the object has a horizontal
scroll bar scroll bar
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:HasHorizontalScrollBar() function newobject:HasHorizontalScrollBar()
return self.hbar return self.hbar
@ -1284,7 +1287,7 @@ end
- func: GetLineNumbersPanel() - func: GetLineNumbersPanel()
- desc: gets the object's line numbers panel - desc: gets the object's line numbers panel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetLineNumbersPanel() function newobject:GetLineNumbersPanel()
local panel = self.linenumberspanel local panel = self.linenumberspanel
local internals = self.internals local internals = self.internals
@ -1307,7 +1310,7 @@ end
- desc: sets whether or not to show line numbers when - desc: sets whether or not to show line numbers when
using multiple lines using multiple lines
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:ShowLineNumbers(bool) function newobject:ShowLineNumbers(bool)
local multiline = self.multiline local multiline = self.multiline
@ -1321,7 +1324,7 @@ end
- func: GetTextX() - func: GetTextX()
- desc: gets the object's text x - desc: gets the object's text x
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetTextX() function newobject:GetTextX()
return self.textx return self.textx
@ -1331,7 +1334,7 @@ end
- func: GetTextY() - func: GetTextY()
- desc: gets the object's text y - desc: gets the object's text y
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetTextY() function newobject:GetTextY()
return self.texty return self.texty
@ -1342,7 +1345,7 @@ end
- desc: gets whether or not all of the object's text is - desc: gets whether or not all of the object's text is
selected selected
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:IsAllTextSelected() function newobject:IsAllTextSelected()
return self.alltextselected return self.alltextselected
@ -1352,7 +1355,7 @@ end
- func: GetLines() - func: GetLines()
- desc: gets the object's lines - desc: gets the object's lines
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetLines() function newobject:GetLines()
return self.lines return self.lines
@ -1362,7 +1365,7 @@ end
- func: GetOffsetX() - func: GetOffsetX()
- desc: gets the object's x offset - desc: gets the object's x offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetOffsetX() function newobject:GetOffsetX()
return self.offsetx return self.offsetx
@ -1372,7 +1375,7 @@ end
- func: GetOffsetY() - func: GetOffsetY()
- desc: gets the object's y offset - desc: gets the object's y offset
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetOffsetY() function newobject:GetOffsetY()
return self.offsety return self.offsety
@ -1382,7 +1385,7 @@ end
- func: GetIndicatorX() - func: GetIndicatorX()
- desc: gets the object's indicator's xpos - desc: gets the object's indicator's xpos
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetIndicatorX() function newobject:GetIndicatorX()
return self.indicatorx return self.indicatorx
@ -1392,7 +1395,7 @@ end
- func: GetIndicatorY() - func: GetIndicatorY()
- desc: gets the object's indicator's ypos - desc: gets the object's indicator's ypos
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetIndicatorY() function newobject:GetIndicatorY()
return self.indicatory return self.indicatory
@ -1403,7 +1406,7 @@ end
- desc: gets whether line numbers are enabled on the - desc: gets whether line numbers are enabled on the
object or not object or not
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetLineNumbersEnabled() function newobject:GetLineNumbersEnabled()
return self.linenumbers return self.linenumbers
@ -1413,7 +1416,7 @@ end
- func: GetItemWidth() - func: GetItemWidth()
- desc: gets the object's item width - desc: gets the object's item width
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetItemWidth() function newobject:GetItemWidth()
return self.itemwidth return self.itemwidth
@ -1423,7 +1426,7 @@ end
- func: GetItemHeight() - func: GetItemHeight()
- desc: gets the object's item height - desc: gets the object's item height
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetItemHeight() function newobject:GetItemHeight()
return self.itemheight return self.itemheight
@ -1433,7 +1436,7 @@ end
- func: SetTabReplacement(tabreplacement) - func: SetTabReplacement(tabreplacement)
- desc: sets a string to replace tabs with - desc: sets a string to replace tabs with
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetTabReplacement(tabreplacement) function newobject:SetTabReplacement(tabreplacement)
self.tabreplacement = tabreplacement self.tabreplacement = tabreplacement
@ -1443,7 +1446,7 @@ end
- func: GetTabReplacement() - func: GetTabReplacement()
- desc: gets the object's tab replacement - desc: gets the object's tab replacement
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetTabReplacement() function newobject:GetTabReplacement()
return self.tabreplacement return self.tabreplacement
@ -1454,7 +1457,7 @@ end
- desc: sets whether or not the user can edit the - desc: sets whether or not the user can edit the
object's text object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:SetEditable(bool) function newobject:SetEditable(bool)
self.editable = bool self.editable = bool
@ -1465,8 +1468,50 @@ end
- desc: gets whether or not the user can edit the - desc: gets whether or not the user can edit the
object's text object's text
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function textinput:GetEditable() function newobject:GetEditable()
return self.editable return self.editable
end end
--[[---------------------------------------------------------
- func: SetButtonScrollAmount(speed)
- desc: sets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:SetButtonScrollAmount(amount)
self.buttonscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetButtonScrollAmount()
- desc: gets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.buttonscrollamount
end
--[[---------------------------------------------------------
- func: SetMouseWheelScrollAmount(amount)
- desc: sets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:SetMouseWheelScrollAmount(amount)
self.mousewheelscrollamount = amount
end
--[[---------------------------------------------------------
- func: GetMouseWheelScrollAmount()
- desc: gets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.mousewheelscrollamount
end

View File

@ -2,7 +2,7 @@
## Information ## Information
Love Frames is a GUI library for LÖVE. For information on installation and usage, please visit the wiki. A demo of the library can be found at: http://nikolairesokav.com/projects/loveframes/ Love Frames is a GUI library for [LOVE](https://love2d.org/). For information on installation and usage, please visit the wiki. A demo of the library can be found at: http://nikolairesokav.com/projects/loveframes/
## License ## License

View File

@ -20,7 +20,7 @@ skin.controls = {}
-- frame -- frame
skin.controls.frame_border_color = bordercolor skin.controls.frame_border_color = bordercolor
skin.controls.frame_body_color = {255, 255, 255, 150} skin.controls.frame_body_color = {232, 232, 232, 255}
skin.controls.frame_top_color = {102, 194, 255, 255} skin.controls.frame_top_color = {102, 194, 255, 255}
skin.controls.frame_name_color = {255, 255, 255, 255} skin.controls.frame_name_color = {255, 255, 255, 255}
skin.controls.frame_name_font = smallfont skin.controls.frame_name_font = smallfont
@ -399,8 +399,10 @@ function skin.DrawCloseButton(object)
local x = object:GetX() local x = object:GetX()
local y = object:GetY() local y = object:GetY()
local staticx = object:GetStaticX()
local width = object:GetWidth() local width = object:GetWidth()
local height = object:GetHeight() local height = object:GetHeight()
local parentwidth = object.parent:GetWidth()
local index = loveframes.config["ACTIVESKIN"] local index = loveframes.config["ACTIVESKIN"]
local font = skin.controls.button_text_font local font = skin.controls.button_text_font
local twidth = font:getWidth("X") local twidth = font:getWidth("X")
@ -433,6 +435,10 @@ function skin.DrawCloseButton(object)
end end
if staticx ~= (parentwidth - 20) then
object:SetPos(parentwidth - 20, 4)
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------

View File

@ -20,7 +20,7 @@ skin.controls = {}
-- frame -- frame
skin.controls.frame_border_color = bordercolor skin.controls.frame_border_color = bordercolor
skin.controls.frame_body_color = {255, 255, 255, 150} skin.controls.frame_body_color = {232, 232, 232, 255}
skin.controls.frame_top_color = {255, 153, 0, 255} skin.controls.frame_top_color = {255, 153, 0, 255}
skin.controls.frame_name_color = {255, 255, 255, 255} skin.controls.frame_name_color = {255, 255, 255, 255}
skin.controls.frame_name_font = smallfont skin.controls.frame_name_font = smallfont
@ -399,8 +399,10 @@ function skin.DrawCloseButton(object)
local x = object:GetX() local x = object:GetX()
local y = object:GetY() local y = object:GetY()
local staticx = object:GetStaticX()
local width = object:GetWidth() local width = object:GetWidth()
local height = object:GetHeight() local height = object:GetHeight()
local parentwidth = object.parent:GetWidth()
local index = loveframes.config["ACTIVESKIN"] local index = loveframes.config["ACTIVESKIN"]
local font = skin.controls.button_text_font local font = skin.controls.button_text_font
local twidth = font:getWidth("X") local twidth = font:getWidth("X")
@ -433,6 +435,10 @@ function skin.DrawCloseButton(object)
end end
if staticx ~= (parentwidth - 20) then
object:SetPos(parentwidth - 20, 4)
end
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------

View File

@ -86,7 +86,8 @@ function loveframes.templates.Register(template)
local registeredobjects = loveframes.templates.objects local registeredobjects = loveframes.templates.objects
local name = template.name local name = template.name
local properties = template.properties local properties = template.properties
local objects = template.objects local objects = loveframes.objects
local base = objects["base"]
local found = false local found = false
local foundall = false local foundall = false
@ -96,7 +97,7 @@ function loveframes.templates.Register(template)
end end
if name == "Base" then if name == "Base" then
_G["base"]:include(template.properties["*"]) base:include(template.properties["*"])
end end
-- insert the template into the available templates table -- insert the template into the available templates table