mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Version 0.9.4.4 - Alpha (see changelog.txt)
This commit is contained in:
parent
b4d8dd786f
commit
53731d9a01
@ -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)
|
||||
================================================
|
||||
|
122
debug.lua
122
debug.lua
@ -6,7 +6,8 @@
|
||||
-- debug library
|
||||
loveframes.debug = {}
|
||||
|
||||
local font = love.graphics.newFont(10)
|
||||
local font = loveframes.basicfontsmall
|
||||
local centerarea = {210, 5, 585, 590}
|
||||
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.
|
||||
|
||||
@ -52,72 +53,73 @@ function loveframes.debug.draw()
|
||||
end
|
||||
end
|
||||
|
||||
-- font for debug text
|
||||
-- main font
|
||||
love.graphics.setFont(font)
|
||||
|
||||
love.graphics.setColor(0, 0, 0, 150)
|
||||
love.graphics.rectangle("fill", 5, 5, 200, 250)
|
||||
-- main box
|
||||
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.print("Library Information", 15, 15)
|
||||
love.graphics.print("Library Information", 10, 35)
|
||||
|
||||
love.graphics.setColor(255, 255, 255, 255)
|
||||
love.graphics.print("Author: " ..author, 15, 30)
|
||||
love.graphics.print("Version: " ..version, 15, 40)
|
||||
love.graphics.print("Stage: " ..stage, 15, 50)
|
||||
love.graphics.print("Base Directory: " ..basedir, 15, 60)
|
||||
love.graphics.print("Author: " ..author, 15, 50)
|
||||
love.graphics.print("Version: " ..version, 15, 60)
|
||||
love.graphics.print("Stage: " ..stage, 15, 70)
|
||||
love.graphics.print("Base Directory: " ..basedir, 15, 80)
|
||||
|
||||
-- object information box
|
||||
love.graphics.setColor(0, 0, 0, 50)
|
||||
love.graphics.rectangle("fill", 10, 80, 190, 20)
|
||||
-------------------------------------------------------
|
||||
-- object information section
|
||||
-------------------------------------------------------
|
||||
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)
|
||||
|
||||
if #cols > 0 then
|
||||
love.graphics.print("Type: " ..topcol.type, 15, 100)
|
||||
love.graphics.print("Type: " ..topcol.type, 15, 110)
|
||||
else
|
||||
love.graphics.print("Type: none", 10, 100)
|
||||
love.graphics.print("Type: none", 10, 120)
|
||||
end
|
||||
|
||||
if topcol.children then
|
||||
love.graphics.print("# of children: " .. #topcol.children, 15, 110)
|
||||
love.graphics.print("# of children: " .. #topcol.children, 15, 120)
|
||||
else
|
||||
love.graphics.print("# of children: 0", 15, 110)
|
||||
love.graphics.print("# of children: 0", 15, 120)
|
||||
end
|
||||
|
||||
if topcol.internals then
|
||||
love.graphics.print("# of internals: " .. #topcol.internals, 15, 120)
|
||||
love.graphics.print("# of internals: " .. #topcol.internals, 15, 130)
|
||||
else
|
||||
love.graphics.print("# of internals: 0", 15, 120)
|
||||
love.graphics.print("# of internals: 0", 15, 130)
|
||||
end
|
||||
|
||||
love.graphics.print("X: " ..topcol.x, 15, 130)
|
||||
love.graphics.print("Y: " ..topcol.y, 15, 140)
|
||||
love.graphics.print("Width: " ..topcol.width, 15, 150)
|
||||
love.graphics.print("Height: " ..topcol.height, 15, 160)
|
||||
love.graphics.print("X: " ..topcol.x, 15, 140)
|
||||
love.graphics.print("Y: " ..topcol.y, 15, 150)
|
||||
love.graphics.print("Width: " ..topcol.width, 15, 160)
|
||||
love.graphics.print("Height: " ..topcol.height, 15, 170)
|
||||
|
||||
-- Miscellaneous box
|
||||
love.graphics.setColor(0, 0, 0, 50)
|
||||
love.graphics.rectangle("fill", 10, 190, 190, 20)
|
||||
-------------------------------------------------------
|
||||
-- miscellaneous section
|
||||
-------------------------------------------------------
|
||||
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.print("LOVE Version: " ..loveversion, 15, 210)
|
||||
love.graphics.print("FPS: " ..fps, 15, 220)
|
||||
love.graphics.print("Delta Time: " ..deltatime, 15, 230)
|
||||
love.graphics.print("Total Objects: " ..#objects, 15, 240)
|
||||
love.graphics.print("LOVE Version: " ..loveversion, 15, 200)
|
||||
love.graphics.print("FPS: " ..fps, 15, 210)
|
||||
love.graphics.print("Delta Time: " ..deltatime, 15, 220)
|
||||
love.graphics.print("Total Objects: " ..#objects, 15, 230)
|
||||
|
||||
-- outline the object that the mouse is hovering over
|
||||
love.graphics.setColor(255, 204, 51, 255)
|
||||
love.graphics.setLine(2, "smooth")
|
||||
love.graphics.rectangle("line", topcol.x - 1, topcol.y - 1, topcol.width + 2, topcol.height + 2)
|
||||
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
@ -132,8 +134,8 @@ function loveframes.debug.ExamplesMenu()
|
||||
------------------------------------
|
||||
local examplesframe = loveframes.Create("frame")
|
||||
examplesframe:SetName("Examples List")
|
||||
examplesframe:SetSize(200, love.graphics.getHeight() - 330)
|
||||
examplesframe:SetPos(5, 325)
|
||||
examplesframe:SetSize(200, love.graphics.getHeight() - 325)
|
||||
examplesframe:SetPos(5, 320)
|
||||
|
||||
------------------------------------
|
||||
-- examples list
|
||||
@ -154,7 +156,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Button")
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local button1 = loveframes.Create("button", frame1)
|
||||
button1:SetWidth(200)
|
||||
@ -182,7 +184,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Checkbox")
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
frame1:SetHeight(85)
|
||||
|
||||
local checkbox1 = loveframes.Create("checkbox", frame1)
|
||||
@ -210,7 +212,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Collapsible Category")
|
||||
frame1:SetSize(500, 300)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local panel1 = loveframes.Create("panel")
|
||||
panel1:SetHeight(230)
|
||||
@ -234,7 +236,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Column List")
|
||||
frame1:SetSize(500, 300)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local list1 = loveframes.Create("columnlist", frame1)
|
||||
list1:SetPos(5, 30)
|
||||
@ -260,7 +262,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Frame")
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local text1 = loveframes.Create("text", frame1)
|
||||
text1:SetText("This is an example frame.")
|
||||
@ -302,7 +304,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Image")
|
||||
frame1:SetSize(138, 315)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local image1 = loveframes.Create("image", frame1)
|
||||
image1:SetImage("resources/images/carlsagan.png")
|
||||
@ -394,7 +396,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Image Button")
|
||||
frame1:SetSize(138, 163)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local imagebutton1 = loveframes.Create("imagebutton", frame1)
|
||||
imagebutton1:SetImage("resources/images/carlsagan.png")
|
||||
@ -414,7 +416,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("List")
|
||||
frame1:SetSize(500, 455)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local list1 = loveframes.Create("list", frame1)
|
||||
list1:SetPos(5, 30)
|
||||
@ -499,7 +501,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Multichoice")
|
||||
frame1:SetSize(210, 60)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local multichoice1 = loveframes.Create("multichoice", frame1)
|
||||
multichoice1:SetPos(5, 30)
|
||||
@ -521,7 +523,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Panel")
|
||||
frame1:SetSize(210, 85)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local panel1 = loveframes.Create("panel", frame1)
|
||||
panel1:SetPos(5, 30)
|
||||
@ -539,7 +541,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Progress Bar")
|
||||
frame1:SetSize(500, 160)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local progressbar1 = loveframes.Create("progressbar", frame1)
|
||||
progressbar1:SetPos(5, 30)
|
||||
@ -570,7 +572,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
slider1:SetPos(5, 135)
|
||||
slider1:SetWidth(490)
|
||||
slider1:SetText("Progressbar lerp rate")
|
||||
slider1:SetMinMax(1, 50)
|
||||
slider1:SetMinMax(0, 50)
|
||||
slider1:SetDecimals(0)
|
||||
slider1.OnValueChanged = function(object2, value)
|
||||
progressbar1:SetLerpRate(value)
|
||||
@ -601,7 +603,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Slider")
|
||||
frame1:SetSize(300, 275)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local slider1 = loveframes.Create("slider", frame1)
|
||||
slider1:SetPos(5, 30)
|
||||
@ -631,7 +633,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Tabs")
|
||||
frame1:SetSize(500, 300)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local tabs1 = loveframes.Create("tabs", frame1)
|
||||
tabs1:SetPos(5, 30)
|
||||
@ -668,7 +670,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Text")
|
||||
frame1:SetSize(500, 300)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local list1 = loveframes.Create("list", frame1)
|
||||
list1:SetPos(5, 30)
|
||||
@ -676,11 +678,9 @@ function loveframes.debug.ExamplesMenu()
|
||||
list1:SetPadding(5)
|
||||
list1:SetSpacing(5)
|
||||
|
||||
--for i=1, 5 do
|
||||
local text1 = loveframes.Create("text")
|
||||
text1:SetText(loremipsum)
|
||||
list1:AddItem(text1)
|
||||
--end
|
||||
local text1 = loveframes.Create("text")
|
||||
text1:SetText(loremipsum)
|
||||
list1:AddItem(text1)
|
||||
|
||||
end
|
||||
exampleslist:AddItem(textexample)
|
||||
@ -695,7 +695,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local frame1 = loveframes.Create("frame")
|
||||
frame1:SetName("Text Input")
|
||||
frame1:SetSize(500, 90)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
|
||||
local textinput1 = loveframes.Create("textinput", frame1)
|
||||
textinput1:SetPos(5, 30)
|
||||
@ -714,14 +714,14 @@ function loveframes.debug.ExamplesMenu()
|
||||
togglebutton.OnClick = function(object)
|
||||
if textinput1.multiline then
|
||||
frame1:SetHeight(90)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
togglebutton:SetPos(5, 60)
|
||||
textinput1:SetMultiline(false)
|
||||
textinput1:SetHeight(25)
|
||||
textinput1:SetText("")
|
||||
else
|
||||
frame1:SetHeight(365)
|
||||
frame1:Center()
|
||||
frame1:CenterWithinArea(unpack(centerarea))
|
||||
togglebutton:SetPos(5, 335)
|
||||
textinput1:SetMultiline(true)
|
||||
textinput1:SetHeight(300)
|
||||
@ -745,7 +745,7 @@ function loveframes.debug.SkinSelector()
|
||||
local frame = loveframes.Create("frame")
|
||||
frame:SetName("Skin Selector")
|
||||
frame:SetSize(200, 60)
|
||||
frame:SetPos(5, 260)
|
||||
frame:SetPos(5, 255)
|
||||
|
||||
local skinslist = loveframes.Create("multichoice", frame)
|
||||
skinslist:SetPos(5, 30)
|
||||
|
59
init.lua
59
init.lua
@ -9,7 +9,7 @@ loveframes = {}
|
||||
-- library info
|
||||
loveframes.info = {}
|
||||
loveframes.info.author = "Kenny Shields"
|
||||
loveframes.info.version = "0.9.4.3"
|
||||
loveframes.info.version = "0.9.4.4"
|
||||
loveframes.info.stage = "Alpha"
|
||||
|
||||
-- library configurations
|
||||
@ -26,6 +26,7 @@ loveframes.hoverobject = false
|
||||
loveframes.modalobject = false
|
||||
loveframes.basicfont = love.graphics.newFont(12)
|
||||
loveframes.basicfontsmall = love.graphics.newFont(10)
|
||||
loveframes.objects = {}
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: load()
|
||||
@ -70,7 +71,7 @@ function loveframes.load()
|
||||
end
|
||||
|
||||
-- create the base gui object
|
||||
loveframes.base = base:new()
|
||||
loveframes.base = loveframes.objects["base"]:new()
|
||||
|
||||
end
|
||||
|
||||
@ -80,9 +81,9 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
function loveframes.update(dt)
|
||||
|
||||
local object = loveframes.base
|
||||
local base = loveframes.base
|
||||
|
||||
object:update(dt)
|
||||
base:update(dt)
|
||||
|
||||
end
|
||||
|
||||
@ -92,13 +93,13 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
function loveframes.draw()
|
||||
|
||||
local object = loveframes.base
|
||||
local base = loveframes.base
|
||||
|
||||
-- set the drawcount to zero
|
||||
loveframes.drawcount = 0
|
||||
|
||||
-- draw the base object
|
||||
object:draw()
|
||||
base:draw()
|
||||
|
||||
-- draw the debug library
|
||||
loveframes.debug.draw()
|
||||
@ -111,9 +112,9 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
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
|
||||
|
||||
@ -123,9 +124,9 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
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
|
||||
if button == "l" then
|
||||
@ -141,9 +142,9 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
function loveframes.keypressed(key, unicode)
|
||||
|
||||
local object = loveframes.base
|
||||
local base = loveframes.base
|
||||
|
||||
object:keypressed(key, unicode)
|
||||
base:keypressed(key, unicode)
|
||||
|
||||
end
|
||||
|
||||
@ -153,9 +154,9 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
function loveframes.keyreleased(key)
|
||||
|
||||
local object = loveframes.base
|
||||
local base = loveframes.base
|
||||
|
||||
object:keyreleased(key)
|
||||
base:keyreleased(key)
|
||||
|
||||
end
|
||||
|
||||
@ -169,13 +170,15 @@ function loveframes.Create(data, parent)
|
||||
|
||||
if type(data) == "string" then
|
||||
|
||||
-- make sure the object specified is valid
|
||||
if not _G[data] then
|
||||
local objects = loveframes.objects
|
||||
local object = objects[data]
|
||||
|
||||
if not object then
|
||||
loveframes.util.Error("Error creating object: Invalid object '" ..data.. "'.")
|
||||
end
|
||||
|
||||
-- create the object
|
||||
local object = _G[data]:new()
|
||||
object = object:new()
|
||||
|
||||
-- apply template properties to the object
|
||||
loveframes.templates.ApplyToObject(object)
|
||||
@ -269,5 +272,27 @@ function loveframes.Create(data, parent)
|
||||
|
||||
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
|
||||
loveframes.load()
|
130
objects/base.lua
130
objects/base.lua
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- base object
|
||||
base = class("base")
|
||||
local newobject = loveframes.NewObject("base", "loveframes_object_base")
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: intializes the element
|
||||
--]]---------------------------------------------------------
|
||||
function base:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
-- width and height of the window
|
||||
local w = love.graphics.getWidth()
|
||||
@ -29,7 +29,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function base:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local children = self.children
|
||||
|
||||
@ -47,7 +47,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function base:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local children = self.children
|
||||
|
||||
@ -68,7 +68,7 @@ end
|
||||
- func: mousepressed(x, y, 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 children = self.children
|
||||
@ -96,7 +96,7 @@ end
|
||||
- func: mousereleased(x, y, 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 children = self.children
|
||||
@ -124,7 +124,7 @@ end
|
||||
- func: keypressed(key)
|
||||
- desc: called when the player presses a key
|
||||
--]]---------------------------------------------------------
|
||||
function base:keypressed(key, unicode)
|
||||
function newobject:keypressed(key, unicode)
|
||||
|
||||
local visible = self.visible
|
||||
local children = self.children
|
||||
@ -152,7 +152,7 @@ end
|
||||
- func: keyreleased(key)
|
||||
- desc: called when the player releases a key
|
||||
--]]---------------------------------------------------------
|
||||
function base:keyreleased(key)
|
||||
function newobject:keyreleased(key)
|
||||
|
||||
local visible = self.visible
|
||||
local children = self.children
|
||||
@ -182,7 +182,7 @@ end
|
||||
- func: SetPos(x, y)
|
||||
- desc: sets the object's position
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetPos(x, y)
|
||||
function newobject:SetPos(x, y)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
@ -201,7 +201,7 @@ end
|
||||
- func: SetX(x)
|
||||
- desc: sets the object's x position
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetX(x)
|
||||
function newobject:SetX(x)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
@ -218,7 +218,7 @@ end
|
||||
- func: SetY(y)
|
||||
- desc: sets the object's y position
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetY(y)
|
||||
function newobject:SetY(y)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
@ -235,7 +235,7 @@ end
|
||||
- func: GetPos()
|
||||
- desc: gets the object's position
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetPos()
|
||||
function newobject:GetPos()
|
||||
|
||||
return self.x, self.y
|
||||
|
||||
@ -245,7 +245,7 @@ end
|
||||
- func: GetX()
|
||||
- desc: gets the object's x position
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetX()
|
||||
function newobject:GetX()
|
||||
|
||||
return self.x
|
||||
|
||||
@ -255,7 +255,7 @@ end
|
||||
- func: GetY()
|
||||
- desc: gets the object's y position
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetY()
|
||||
function newobject:GetY()
|
||||
|
||||
return self.y
|
||||
|
||||
@ -265,7 +265,7 @@ end
|
||||
- func: GetStaticPos()
|
||||
- desc: gets the object's static position
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetStaticPos()
|
||||
function newobject:GetStaticPos()
|
||||
|
||||
return self.staticx, self.staticy
|
||||
|
||||
@ -275,7 +275,7 @@ end
|
||||
- func: GetStaticX()
|
||||
- desc: gets the object's static x position
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetStaticX()
|
||||
function newobject:GetStaticX()
|
||||
|
||||
return self.staticx
|
||||
|
||||
@ -285,7 +285,7 @@ end
|
||||
- func: GetStaticY()
|
||||
- desc: gets the object's static y position
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetStaticY()
|
||||
function newobject:GetStaticY()
|
||||
|
||||
return self.staticy
|
||||
|
||||
@ -296,7 +296,7 @@ end
|
||||
- desc: centers the object in the game window or in
|
||||
it's parent if it has one
|
||||
--]]---------------------------------------------------------
|
||||
function base:Center()
|
||||
function newobject:Center(area)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
@ -321,7 +321,7 @@ end
|
||||
- func: CenterX()
|
||||
- desc: centers the object by it's x value
|
||||
--]]---------------------------------------------------------
|
||||
function base:CenterX()
|
||||
function newobject:CenterX()
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
@ -340,7 +340,7 @@ end
|
||||
- func: CenterY()
|
||||
- desc: centers the object by it's y value
|
||||
--]]---------------------------------------------------------
|
||||
function base:CenterY()
|
||||
function newobject:CenterY()
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
@ -355,11 +355,25 @@ function base:CenterY()
|
||||
|
||||
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)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetSize(width, height)
|
||||
function newobject:SetSize(width, height)
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
@ -370,7 +384,7 @@ end
|
||||
- func: SetWidth(width)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetWidth(width)
|
||||
function newobject:SetWidth(width)
|
||||
|
||||
self.width = width
|
||||
|
||||
@ -380,7 +394,7 @@ end
|
||||
- func: SetHeight(height)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetHeight(height)
|
||||
function newobject:SetHeight(height)
|
||||
|
||||
self.height = height
|
||||
|
||||
@ -390,7 +404,7 @@ end
|
||||
- func: GetSize()
|
||||
- desc: gets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetSize()
|
||||
function newobject:GetSize()
|
||||
|
||||
return self.width, self.height
|
||||
|
||||
@ -400,7 +414,7 @@ end
|
||||
- func: GetWidth()
|
||||
- desc: gets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetWidth()
|
||||
function newobject:GetWidth()
|
||||
|
||||
return self.width
|
||||
|
||||
@ -410,7 +424,7 @@ end
|
||||
- func: GetHeight()
|
||||
- desc: gets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetHeight()
|
||||
function newobject:GetHeight()
|
||||
|
||||
return self.height
|
||||
|
||||
@ -420,7 +434,7 @@ end
|
||||
- func: SetVisible(bool)
|
||||
- desc: sets the object's visibility
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetVisible(bool)
|
||||
function newobject:SetVisible(bool)
|
||||
|
||||
local children = self.children
|
||||
local internals = self.internals
|
||||
@ -445,7 +459,7 @@ end
|
||||
- func: GetVisible()
|
||||
- desc: gets the object's visibility
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetVisible()
|
||||
function newobject:GetVisible()
|
||||
|
||||
return self.visible
|
||||
|
||||
@ -455,7 +469,7 @@ end
|
||||
- func: SetParent(parent)
|
||||
- desc: sets the object's parent
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetParent(parent)
|
||||
function newobject:SetParent(parent)
|
||||
|
||||
local tparent = parent
|
||||
local cparent = self.parent
|
||||
@ -477,7 +491,7 @@ end
|
||||
- func: GetParent()
|
||||
- desc: gets the object's parent
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetParent()
|
||||
function newobject:GetParent()
|
||||
|
||||
local parent = self.parent
|
||||
return parent
|
||||
@ -488,7 +502,7 @@ end
|
||||
- func: Remove()
|
||||
- desc: removes the object
|
||||
--]]---------------------------------------------------------
|
||||
function base:Remove()
|
||||
function newobject:Remove()
|
||||
|
||||
local pinternals = self.parent.internals
|
||||
local pchildren = self.parent.children
|
||||
@ -518,7 +532,7 @@ end
|
||||
- desc: sets a boundary box for the object's collision
|
||||
detection
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetClickBounds(x, y, width, height)
|
||||
function newobject:SetClickBounds(x, y, width, height)
|
||||
|
||||
local internals = self.internals
|
||||
local children = self.children
|
||||
@ -544,7 +558,7 @@ end
|
||||
- desc: gets the boundary box for the object's collision
|
||||
detection
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetClickBounds()
|
||||
function newobject:GetClickBounds()
|
||||
|
||||
return self.clickbounds
|
||||
|
||||
@ -555,7 +569,7 @@ end
|
||||
- desc: removes the collision detection boundary for the
|
||||
object
|
||||
--]]---------------------------------------------------------
|
||||
function base:RemoveClickBounds()
|
||||
function newobject:RemoveClickBounds()
|
||||
|
||||
local internals = self.internals
|
||||
local children = self.children
|
||||
@ -581,7 +595,7 @@ end
|
||||
- desc: checks if the mouse is inside the object's
|
||||
collision detection boundaries
|
||||
--]]---------------------------------------------------------
|
||||
function base:InClickBounds()
|
||||
function newobject:InClickBounds()
|
||||
|
||||
local x, y = love.mouse.getPosition()
|
||||
local bounds = self.clickbounds
|
||||
@ -600,7 +614,7 @@ end
|
||||
- desc: checks if the object the top most object in a
|
||||
collision table
|
||||
--]]---------------------------------------------------------
|
||||
function base:IsTopCollision()
|
||||
function newobject:IsTopCollision()
|
||||
|
||||
local cols = loveframes.util.GetCollisions()
|
||||
local draworder = self.draworder
|
||||
@ -621,7 +635,7 @@ end
|
||||
- func: GetBaseParent(object, t)
|
||||
- desc: finds the object's base parent
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetBaseParent(t)
|
||||
function newobject:GetBaseParent(t)
|
||||
|
||||
local t = t or {}
|
||||
local base = loveframes.base
|
||||
@ -641,7 +655,7 @@ end
|
||||
- desc: checks to see if the object should be in a
|
||||
hover state
|
||||
--]]---------------------------------------------------------
|
||||
function base:CheckHover()
|
||||
function newobject:CheckHover()
|
||||
|
||||
local x, y = love.mouse.getPosition()
|
||||
local selfcol = loveframes.util.BoundingBox(x, self.x, y, self.y, 1, self.width, 1, self.height)
|
||||
@ -735,7 +749,7 @@ end
|
||||
- func: GetHover()
|
||||
- desc: return if the object is in a hover state or not
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetHover()
|
||||
function newobject:GetHover()
|
||||
|
||||
return self.hover
|
||||
|
||||
@ -745,7 +759,7 @@ end
|
||||
- func: GetChildren()
|
||||
- desc: returns the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetChildren()
|
||||
function newobject:GetChildren()
|
||||
|
||||
local children = self.children
|
||||
|
||||
@ -760,7 +774,7 @@ end
|
||||
- desc: returns true if the object is the top most list
|
||||
object or false if not
|
||||
--]]---------------------------------------------------------
|
||||
function base:IsTopList()
|
||||
function newobject:IsTopList()
|
||||
|
||||
local cols = loveframes.util.GetCollisions()
|
||||
local children = self:GetChildren()
|
||||
@ -808,7 +822,7 @@ end
|
||||
- desc: returns true if the object is the top most child
|
||||
in it's parent's children table or false if not
|
||||
--]]---------------------------------------------------------
|
||||
function base:IsTopChild()
|
||||
function newobject:IsTopChild()
|
||||
|
||||
local children = self.parent.children
|
||||
local num = #children
|
||||
@ -826,7 +840,7 @@ end
|
||||
- desc: moves the object to the top of it's parent's
|
||||
children table
|
||||
--]]---------------------------------------------------------
|
||||
function base:MoveToTop()
|
||||
function newobject:MoveToTop()
|
||||
|
||||
local pchildren = self.parent.children
|
||||
local pinternals = self.parent.internals
|
||||
@ -853,7 +867,7 @@ end
|
||||
- func: SetSkin(name)
|
||||
- desc: sets the object's skin
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetSkin(name)
|
||||
function newobject:SetSkin(name)
|
||||
|
||||
local children = self.children
|
||||
local internals = self.internals
|
||||
@ -878,7 +892,7 @@ end
|
||||
- func: GetSkin(name)
|
||||
- desc: gets the object's skin
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetSkin(name)
|
||||
function newobject:GetSkin(name)
|
||||
|
||||
return self.skin
|
||||
|
||||
@ -888,7 +902,7 @@ end
|
||||
- func: SetAlwaysUpdate(bool)
|
||||
- desc: sets the object's skin
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetAlwaysUpdate(bool)
|
||||
function newobject:SetAlwaysUpdate(bool)
|
||||
|
||||
self.alwaysupdate = bool
|
||||
|
||||
@ -898,7 +912,7 @@ end
|
||||
- func: GetAlwaysUpdate()
|
||||
- desc: gets whether or not the object will always update
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetAlwaysUpdate()
|
||||
function newobject:GetAlwaysUpdate()
|
||||
|
||||
return self.alwaysupdate
|
||||
|
||||
@ -909,7 +923,7 @@ end
|
||||
- desc: sets whether or not the object should retain it's
|
||||
size when another object tries to resize it
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetRetainSize(bool)
|
||||
function newobject:SetRetainSize(bool)
|
||||
|
||||
self.retainsize = bool
|
||||
|
||||
@ -920,7 +934,7 @@ end
|
||||
- desc: gets whether or not the object should retain it's
|
||||
size when another object tries to resize it
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetRetainSize()
|
||||
function newobject:GetRetainSize()
|
||||
|
||||
return self.retainsize
|
||||
|
||||
@ -931,7 +945,7 @@ end
|
||||
- desc: gets whether or not the object is active within
|
||||
it's parent's child table
|
||||
--]]---------------------------------------------------------
|
||||
function base:IsActive()
|
||||
function newobject:IsActive()
|
||||
|
||||
local parent = self.parent
|
||||
local pchildren = parent.children
|
||||
@ -952,7 +966,7 @@ end
|
||||
- desc: returns a table of the object's parents and it's
|
||||
sub-parents
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetParents()
|
||||
function newobject:GetParents()
|
||||
|
||||
local function GetParents(object, t)
|
||||
|
||||
@ -981,7 +995,7 @@ end
|
||||
internal in it's parent's internals table or
|
||||
false if not
|
||||
--]]---------------------------------------------------------
|
||||
function base:IsTopInternal()
|
||||
function newobject:IsTopInternal()
|
||||
|
||||
local internals = self.parent.internals
|
||||
|
||||
@ -998,7 +1012,7 @@ end
|
||||
- desc: returns true if the object is internal or
|
||||
false if not
|
||||
--]]---------------------------------------------------------
|
||||
function base:IsInternal()
|
||||
function newobject:IsInternal()
|
||||
|
||||
return self.internal
|
||||
|
||||
@ -1008,7 +1022,7 @@ end
|
||||
- func: GetType()
|
||||
- desc: gets the type of the object
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetType()
|
||||
function newobject:GetType()
|
||||
|
||||
return self.type
|
||||
|
||||
@ -1018,7 +1032,7 @@ end
|
||||
- func: SetDrawOrder()
|
||||
- desc: sets the object's draw order
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetDrawOrder()
|
||||
function newobject:SetDrawOrder()
|
||||
|
||||
loveframes.drawcount = loveframes.drawcount + 1
|
||||
self.draworder = loveframes.drawcount
|
||||
@ -1029,7 +1043,7 @@ end
|
||||
- func: GetDrawOrder()
|
||||
- desc: sets the object's draw order
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetDrawOrder()
|
||||
function newobject:GetDrawOrder()
|
||||
|
||||
return self.draworder
|
||||
|
||||
@ -1039,7 +1053,7 @@ end
|
||||
- func: SetProperty(name, value)
|
||||
- desc: sets a property on the object
|
||||
--]]---------------------------------------------------------
|
||||
function base:SetProperty(name, value)
|
||||
function newobject:SetProperty(name, value)
|
||||
|
||||
self[name] = value
|
||||
|
||||
@ -1049,7 +1063,7 @@ end
|
||||
- func: GetProperty(name)
|
||||
- desc: gets the value of an object's property
|
||||
--]]---------------------------------------------------------
|
||||
function base:GetProperty(name)
|
||||
function newobject:GetProperty(name)
|
||||
|
||||
return self[name]
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- button class
|
||||
button = class("button", base)
|
||||
local newobject = loveframes.NewObject("button", "loveframes_object_button", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function button:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "button"
|
||||
self.text = "Button"
|
||||
@ -28,9 +28,9 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function button:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
|
||||
if not visible then
|
||||
@ -50,16 +50,15 @@ function button:update(dt)
|
||||
|
||||
if not hover then
|
||||
self.down = false
|
||||
if hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
else
|
||||
if hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if not down and hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if parent ~= base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -76,7 +75,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function button:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -108,7 +107,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -137,7 +136,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -167,7 +166,7 @@ end
|
||||
- func: keypressed(key)
|
||||
- desc: called when the player presses a key
|
||||
--]]---------------------------------------------------------
|
||||
function button:keypressed(key, unicode)
|
||||
function newobject:keypressed(key, unicode)
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -188,7 +187,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function button:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -198,7 +197,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function button:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
@ -208,7 +207,7 @@ end
|
||||
- func: SetClickable(bool)
|
||||
- desc: sets whether the object can be clicked or not
|
||||
--]]---------------------------------------------------------
|
||||
function button:SetClickable(bool)
|
||||
function newobject:SetClickable(bool)
|
||||
|
||||
self.clickable = bool
|
||||
|
||||
@ -218,7 +217,7 @@ end
|
||||
- func: GetClickable(bool)
|
||||
- desc: gets whether the object can be clicked or not
|
||||
--]]---------------------------------------------------------
|
||||
function button:GetClickable()
|
||||
function newobject:GetClickable()
|
||||
|
||||
return self.clickable
|
||||
|
||||
@ -228,7 +227,7 @@ end
|
||||
- func: SetClickable(bool)
|
||||
- desc: sets whether the object is enabled or not
|
||||
--]]---------------------------------------------------------
|
||||
function button:SetEnabled(bool)
|
||||
function newobject:SetEnabled(bool)
|
||||
|
||||
self.enabled = bool
|
||||
|
||||
@ -238,7 +237,7 @@ end
|
||||
- func: GetEnabled()
|
||||
- desc: gets whether the object is enabled or not
|
||||
--]]---------------------------------------------------------
|
||||
function button:GetEnabled()
|
||||
function newobject:GetEnabled()
|
||||
|
||||
return self.enabled
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- checkbox class
|
||||
checkbox = class("checkbox", base)
|
||||
local newobject = loveframes.NewObject("checkbox", "loveframes_object_checkbox", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "checkbox"
|
||||
self.width = 0
|
||||
@ -31,7 +31,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -105,7 +105,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -142,7 +142,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -171,7 +171,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -203,7 +203,7 @@ end
|
||||
- func: keypressed(key)
|
||||
- desc: called when the player presses a key
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:keypressed(key, unicode)
|
||||
function newobject:keypressed(key, unicode)
|
||||
|
||||
local checked = self.checked
|
||||
local onchanged = self.OnChanged
|
||||
@ -227,7 +227,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
local boxwidth = self.boxwidth
|
||||
local boxheight = self.boxheight
|
||||
@ -266,7 +266,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
local internals = self.internals
|
||||
local text = internals[1]
|
||||
@ -283,7 +283,7 @@ end
|
||||
- func: SetSize(width, height)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:SetSize(width, height)
|
||||
function newobject:SetSize(width, height)
|
||||
|
||||
self.boxwidth = width
|
||||
self.boxheight = height
|
||||
@ -294,7 +294,7 @@ end
|
||||
- func: SetWidth(width)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:SetWidth(width)
|
||||
function newobject:SetWidth(width)
|
||||
|
||||
self.boxwidth = width
|
||||
|
||||
@ -304,7 +304,7 @@ end
|
||||
- func: SetHeight(height)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:SetHeight(height)
|
||||
function newobject:SetHeight(height)
|
||||
|
||||
self.boxheight = height
|
||||
|
||||
@ -314,7 +314,7 @@ end
|
||||
- func: SetChecked(bool)
|
||||
- desc: sets whether the object is checked or not
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:SetChecked(bool)
|
||||
function newobject:SetChecked(bool)
|
||||
|
||||
local onchanged = self.OnChanged
|
||||
|
||||
@ -330,7 +330,7 @@ end
|
||||
- func: GetChecked()
|
||||
- desc: gets whether the object is checked or not
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:GetChecked()
|
||||
function newobject:GetChecked()
|
||||
|
||||
return self.checked
|
||||
|
||||
@ -340,7 +340,7 @@ end
|
||||
- func: SetFont(font)
|
||||
- desc: sets the font of the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:SetFont(font)
|
||||
function newobject:SetFont(font)
|
||||
|
||||
local internals = self.internals
|
||||
local text = internals[1]
|
||||
@ -354,40 +354,40 @@ function checkbox:SetFont(font)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: checkbox:GetFont()
|
||||
- func: newobject:GetFont()
|
||||
- desc: gets the font of the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:GetFont()
|
||||
function newobject:GetFont()
|
||||
|
||||
return self.font
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: checkbox:GetBoxHeight()
|
||||
- func: newobject:GetBoxHeight()
|
||||
- desc: gets the object's box size
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:GetBoxSize()
|
||||
function newobject:GetBoxSize()
|
||||
|
||||
return self.boxwidth, self.boxheight
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: checkbox:GetBoxWidth()
|
||||
- func: newobject:GetBoxWidth()
|
||||
- desc: gets the object's box width
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:GetBoxWidth()
|
||||
function newobject:GetBoxWidth()
|
||||
|
||||
return self.boxwidth
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: checkbox:GetBoxHeight()
|
||||
- func: newobject:GetBoxHeight()
|
||||
- desc: gets the object's box height
|
||||
--]]---------------------------------------------------------
|
||||
function checkbox:GetBoxHeight()
|
||||
function newobject:GetBoxHeight()
|
||||
|
||||
return self.boxheight
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- collapsiblecategory class
|
||||
collapsiblecategory = class("collapsiblecategory", base)
|
||||
local newobject = loveframes.NewObject("collapsiblecategory", "loveframes_object_collapsiblecategory", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "collapsiblecategory"
|
||||
self.text = "Category"
|
||||
@ -30,7 +30,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -56,7 +56,7 @@ function collapsiblecategory:update(dt)
|
||||
self.y = self.parent.y + self.staticy
|
||||
end
|
||||
|
||||
if open == true then
|
||||
if open and curobject then
|
||||
curobject:SetWidth(self.width - self.padding * 2)
|
||||
curobject:update(dt)
|
||||
end
|
||||
@ -71,7 +71,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -100,7 +100,7 @@ function collapsiblecategory:draw()
|
||||
drawfunc(self)
|
||||
end
|
||||
|
||||
if open then
|
||||
if open and curobject then
|
||||
curobject:draw()
|
||||
end
|
||||
|
||||
@ -110,7 +110,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -142,7 +142,7 @@ function collapsiblecategory:mousepressed(x, y, button)
|
||||
|
||||
end
|
||||
|
||||
if open then
|
||||
if open and curobject then
|
||||
curobject:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
@ -152,7 +152,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -181,7 +181,7 @@ function collapsiblecategory:mousereleased(x, y, button)
|
||||
|
||||
end
|
||||
|
||||
if open then
|
||||
if open and curobject then
|
||||
curobject:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
@ -191,7 +191,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -201,7 +201,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
@ -211,7 +211,7 @@ end
|
||||
- func: SetObject(object)
|
||||
- desc: sets the category's object
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:SetObject(object)
|
||||
function newobject:SetObject(object)
|
||||
|
||||
local children = self.children
|
||||
local curobject = children[1]
|
||||
@ -234,7 +234,7 @@ end
|
||||
- func: SetObject(object)
|
||||
- desc: sets the category's object
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:GetObject()
|
||||
function newobject:GetObject()
|
||||
|
||||
local children = self.children
|
||||
local curobject = children[1]
|
||||
@ -251,7 +251,7 @@ end
|
||||
- func: SetSize(width, height)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:SetSize(width, height)
|
||||
function newobject:SetSize(width, height)
|
||||
|
||||
self.width = width
|
||||
|
||||
@ -261,7 +261,7 @@ end
|
||||
- func: SetHeight(height)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:SetHeight(height)
|
||||
function newobject:SetHeight(height)
|
||||
|
||||
return
|
||||
|
||||
@ -271,7 +271,7 @@ end
|
||||
- func: SetClosedHeight(height)
|
||||
- desc: sets the object's closed height
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:SetClosedHeight(height)
|
||||
function newobject:SetClosedHeight(height)
|
||||
|
||||
self.closedheight = height
|
||||
|
||||
@ -281,7 +281,7 @@ end
|
||||
- func: GetClosedHeight()
|
||||
- desc: gets the object's closed height
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:GetClosedHeight()
|
||||
function newobject:GetClosedHeight()
|
||||
|
||||
return self.closedheight
|
||||
|
||||
@ -291,13 +291,12 @@ end
|
||||
- func: SetOpen(bool)
|
||||
- desc: sets whether the object is opened or closed
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:SetOpen(bool)
|
||||
function newobject:SetOpen(bool)
|
||||
|
||||
local children = self.children
|
||||
local curobject = children[1]
|
||||
local closedheight = self.closedheight
|
||||
local padding = self.padding
|
||||
local curobjectheight = curobject.height
|
||||
local onopenedclosed = self.OnOpenedClosed
|
||||
|
||||
self.open = bool
|
||||
@ -305,11 +304,13 @@ function collapsiblecategory:SetOpen(bool)
|
||||
if not bool then
|
||||
self.height = closedheight
|
||||
if curobject then
|
||||
local curobjectheight = curobject.height
|
||||
curobject:SetVisible(false)
|
||||
end
|
||||
else
|
||||
self.height = closedheight + padding * 2 + curobjectheight
|
||||
if curobject then
|
||||
local curobjectheight = curobject.height
|
||||
self.height = closedheight + padding * 2 + curobjectheight
|
||||
curobject:SetVisible(true)
|
||||
end
|
||||
end
|
||||
@ -325,7 +326,7 @@ end
|
||||
- func: GetOpen()
|
||||
- desc: gets whether the object is opened or closed
|
||||
--]]---------------------------------------------------------
|
||||
function collapsiblecategory:GetOpen()
|
||||
function newobject:GetOpen()
|
||||
|
||||
return self.opened
|
||||
|
||||
|
@ -4,25 +4,27 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- columnlist class
|
||||
columnlist = class("columnlist", base)
|
||||
local newobject = loveframes.NewObject("columnlist", "loveframes_object_columnlist", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: intializes the element
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "columnlist"
|
||||
self.width = 300
|
||||
self.height = 100
|
||||
self.autoscroll = false
|
||||
self.internal = false
|
||||
self.children = {}
|
||||
self.internals = {}
|
||||
self.OnRowClicked = nil
|
||||
self.OnScroll = nil
|
||||
self.type = "columnlist"
|
||||
self.width = 300
|
||||
self.height = 100
|
||||
self.buttonscrollamount = 0.10
|
||||
self.mousewheelscrollamount = 5
|
||||
self.autoscroll = false
|
||||
self.internal = false
|
||||
self.children = {}
|
||||
self.internals = {}
|
||||
self.OnRowClicked = nil
|
||||
self.OnScroll = nil
|
||||
|
||||
local list = columnlistarea:new(self)
|
||||
local list = loveframes.objects["columnlistarea"]:new(self)
|
||||
table.insert(self.internals, list)
|
||||
|
||||
end
|
||||
@ -31,7 +33,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -74,7 +76,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -116,7 +118,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -152,7 +154,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -177,7 +179,7 @@ end
|
||||
- func: Adjustchildren()
|
||||
- desc: adjusts the width of the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:AdjustColumns()
|
||||
function newobject:AdjustColumns()
|
||||
|
||||
local width = self.width
|
||||
local bar = self.internals[1].bar
|
||||
@ -208,13 +210,13 @@ end
|
||||
- desc: gives the object a new column with the specified
|
||||
name
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:AddColumn(name)
|
||||
function newobject:AddColumn(name)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
local height = self.height
|
||||
|
||||
columnlistheader:new(name, self)
|
||||
loveframes.objects["columnlistheader"]:new(name, self)
|
||||
self:AdjustColumns()
|
||||
|
||||
list:SetSize(self.width, height)
|
||||
@ -226,7 +228,7 @@ end
|
||||
- func: AddRow(...)
|
||||
- desc: adds a row of data to the object's list
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:AddRow(...)
|
||||
function newobject:AddRow(...)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -239,7 +241,7 @@ end
|
||||
- func: Getchildrenize()
|
||||
- desc: gets the size of the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:GetColumnSize()
|
||||
function newobject:GetColumnSize()
|
||||
|
||||
local children = self.children
|
||||
local numchildren = #self.children
|
||||
@ -259,7 +261,7 @@ end
|
||||
- func: SetSize(width, height)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:SetSize(width, height)
|
||||
function newobject:SetSize(width, height)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -276,7 +278,7 @@ end
|
||||
- func: SetWidth(width)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:SetWidth(width)
|
||||
function newobject:SetWidth(width)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -292,7 +294,7 @@ end
|
||||
- func: SetHeight(height)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:SetHeight(height)
|
||||
function newobject:SetHeight(height)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -309,7 +311,7 @@ end
|
||||
- desc: sets the object's max color index for
|
||||
alternating row colors
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:SetMaxColorIndex(num)
|
||||
function newobject:SetMaxColorIndex(num)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -322,7 +324,7 @@ end
|
||||
- func: Clear()
|
||||
- desc: removes all items from the object's list
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:Clear()
|
||||
function newobject:Clear()
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -337,7 +339,7 @@ end
|
||||
auto scroll to the bottom when a new object is
|
||||
added to the list
|
||||
--]]---------------------------------------------------------
|
||||
function columnlist:SetAutoScroll(bool)
|
||||
function newobject:SetAutoScroll(bool)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
@ -351,4 +353,48 @@ function columnlist:SetAutoScroll(bool)
|
||||
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
|
@ -4,14 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- frame class
|
||||
frame = class("frame", base)
|
||||
|
||||
local newobject = loveframes.NewObject("frame", "loveframes_object_frame", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function frame:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "frame"
|
||||
self.name = "Frame"
|
||||
@ -22,6 +21,7 @@ function frame:initialize()
|
||||
self.internal = false
|
||||
self.draggable = true
|
||||
self.screenlocked = false
|
||||
self.parentlocked = false
|
||||
self.dragging = false
|
||||
self.modal = false
|
||||
self.modalbackground = false
|
||||
@ -31,7 +31,7 @@ function frame:initialize()
|
||||
self.OnClose = nil
|
||||
|
||||
-- create the close button for the frame
|
||||
local close = closebutton:new()
|
||||
local close = loveframes.objects["closebutton"]:new()
|
||||
close.parent = self
|
||||
close:SetSize(16, 16)
|
||||
close.OnClick = function()
|
||||
@ -50,7 +50,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the element
|
||||
--]]---------------------------------------------------------
|
||||
function frame:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -66,6 +66,7 @@ function frame:update(dt)
|
||||
local close = self.internals[1]
|
||||
local dragging = self.dragging
|
||||
local screenlocked = self.screenlocked
|
||||
local parentlocked = self.parentlocked
|
||||
local modal = self.modal
|
||||
local base = loveframes.base
|
||||
local basechildren = base.children
|
||||
@ -76,7 +77,6 @@ function frame:update(dt)
|
||||
local parent = self.parent
|
||||
local update = self.Update
|
||||
|
||||
close:SetPos(self.width - 20, 4)
|
||||
self:CheckHover()
|
||||
|
||||
-- dragging check
|
||||
@ -84,11 +84,14 @@ function frame:update(dt)
|
||||
if parent == base then
|
||||
self.x = x - self.clickx
|
||||
self.y = y - self.clicky
|
||||
else
|
||||
self.staticx = x - self.clickx
|
||||
self.staticy = y - self.clicky
|
||||
end
|
||||
end
|
||||
|
||||
-- if screenlocked then keep within screen
|
||||
if screenlocked == true then
|
||||
if screenlocked then
|
||||
|
||||
local width = love.graphics.getWidth()
|
||||
local height = love.graphics.getHeight()
|
||||
@ -110,6 +113,28 @@ function frame:update(dt)
|
||||
|
||||
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
|
||||
|
||||
local tip = false
|
||||
@ -158,7 +183,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function frame:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -201,7 +226,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -215,6 +240,8 @@ function frame:mousepressed(x, y, button)
|
||||
local internals = self.internals
|
||||
local children = self.children
|
||||
local dragging = self.dragging
|
||||
local parent = self.parent
|
||||
local base = loveframes.base
|
||||
|
||||
if selfcol then
|
||||
|
||||
@ -223,8 +250,13 @@ function frame:mousepressed(x, y, button)
|
||||
-- initiate dragging if not currently dragging
|
||||
if not dragging and top and button == "l" then
|
||||
if y < self.y + 25 and self.draggable then
|
||||
self.clickx = x - self.x
|
||||
self.clicky = y - self.y
|
||||
if parent == base then
|
||||
self.clickx = x - self.x
|
||||
self.clicky = y - self.y
|
||||
else
|
||||
self.clickx = x - self.staticx
|
||||
self.clicky = y - self.staticy
|
||||
end
|
||||
self.dragging = true
|
||||
end
|
||||
end
|
||||
@ -249,7 +281,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -280,7 +312,7 @@ end
|
||||
- func: SetName(name)
|
||||
- desc: sets the frame's name
|
||||
--]]---------------------------------------------------------
|
||||
function frame:SetName(name)
|
||||
function newobject:SetName(name)
|
||||
|
||||
self.name = name
|
||||
|
||||
@ -290,7 +322,7 @@ end
|
||||
- func: GetName()
|
||||
- desc: gets the frame's name
|
||||
--]]---------------------------------------------------------
|
||||
function frame:GetName()
|
||||
function newobject:GetName()
|
||||
|
||||
return self.name
|
||||
|
||||
@ -300,7 +332,7 @@ end
|
||||
- func: SetDraggable(true/false)
|
||||
- desc: sets whether the frame can be dragged or not
|
||||
--]]---------------------------------------------------------
|
||||
function frame:SetDraggable(bool)
|
||||
function newobject:SetDraggable(bool)
|
||||
|
||||
self.draggable = bool
|
||||
|
||||
@ -310,7 +342,7 @@ end
|
||||
- func: GetDraggable()
|
||||
- desc: gets whether the frame can be dragged ot not
|
||||
--]]---------------------------------------------------------
|
||||
function frame:GetDraggable()
|
||||
function newobject:GetDraggable()
|
||||
|
||||
return self.draggable
|
||||
|
||||
@ -322,7 +354,7 @@ end
|
||||
- desc: sets whether the frame can be moved passed the
|
||||
boundaries of the window or not
|
||||
--]]---------------------------------------------------------
|
||||
function frame:SetScreenLocked(bool)
|
||||
function newobject:SetScreenLocked(bool)
|
||||
|
||||
self.screenlocked = bool
|
||||
|
||||
@ -333,7 +365,7 @@ end
|
||||
- desc: gets whether the frame can be moved passed the
|
||||
boundaries of window or not
|
||||
--]]---------------------------------------------------------
|
||||
function frame:GetScreenLocked()
|
||||
function newobject:GetScreenLocked()
|
||||
|
||||
return self.screenlocked
|
||||
|
||||
@ -343,7 +375,7 @@ end
|
||||
- func: ShowCloseButton(bool)
|
||||
- desc: sets whether the close button should be drawn
|
||||
--]]---------------------------------------------------------
|
||||
function frame:ShowCloseButton(bool)
|
||||
function newobject:ShowCloseButton(bool)
|
||||
|
||||
local close = self.internals[1]
|
||||
|
||||
@ -357,7 +389,7 @@ end
|
||||
- desc: makes the object the top object in the drawing
|
||||
order
|
||||
--]]---------------------------------------------------------
|
||||
function frame:MakeTop()
|
||||
function newobject:MakeTop()
|
||||
|
||||
local x, y = love.mouse.getPosition()
|
||||
local key = 0
|
||||
@ -402,7 +434,7 @@ end
|
||||
- desc: makes the object the top object in the drawing
|
||||
order
|
||||
--]]---------------------------------------------------------
|
||||
function frame:SetModal(bool)
|
||||
function newobject:SetModal(bool)
|
||||
|
||||
local modalobject = loveframes.modalobject
|
||||
local mbackground = self.modalbackground
|
||||
@ -424,7 +456,7 @@ function frame:SetModal(bool)
|
||||
loveframes.modalobject = self
|
||||
|
||||
if not mbackground then
|
||||
self.modalbackground = modalbackground:new(self)
|
||||
self.modalbackground = loveframes.objects["modalbackground"]:new(self)
|
||||
self.modal = true
|
||||
end
|
||||
|
||||
@ -451,7 +483,7 @@ end
|
||||
- desc: gets whether or not the object is in a modal
|
||||
state
|
||||
--]]---------------------------------------------------------
|
||||
function frame:GetModal()
|
||||
function newobject:GetModal()
|
||||
|
||||
return self.modal
|
||||
|
||||
@ -461,7 +493,7 @@ end
|
||||
- func: SetVisible(bool)
|
||||
- desc: set's whether the object is visible or not
|
||||
--]]---------------------------------------------------------
|
||||
function frame:SetVisible(bool)
|
||||
function newobject:SetVisible(bool)
|
||||
|
||||
local children = self.children
|
||||
local internals = self.internals
|
||||
@ -477,4 +509,26 @@ function frame:SetVisible(bool)
|
||||
closebutton.visible = bool
|
||||
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
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- progressbar class
|
||||
image = class("image", base)
|
||||
local newobject = loveframes.NewObject("image", "loveframes_object_image", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function image:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "image"
|
||||
self.width = 0
|
||||
@ -32,7 +32,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function image:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -63,7 +63,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function image:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -95,7 +95,7 @@ end
|
||||
- func: SetImage(image)
|
||||
- desc: sets the object's image
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetImage(image)
|
||||
function newobject:SetImage(image)
|
||||
|
||||
if type(image) == "string" then
|
||||
self.image = love.graphics.newImage(image)
|
||||
@ -105,14 +105,14 @@ function image:SetImage(image)
|
||||
|
||||
self.width = self.image:getWidth()
|
||||
self.height = self.image:getHeight()
|
||||
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetImage()
|
||||
- desc: gets the object's image
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetImage()
|
||||
function newobject:GetImage()
|
||||
|
||||
return self.image
|
||||
|
||||
@ -122,7 +122,7 @@ end
|
||||
- func: SetColor(table)
|
||||
- desc: sets the object's color
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetColor(data)
|
||||
function newobject:SetColor(data)
|
||||
|
||||
self.imagecolor = data
|
||||
|
||||
@ -132,7 +132,7 @@ end
|
||||
- func: GetColor()
|
||||
- desc: gets the object's color
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetColor()
|
||||
function newobject:GetColor()
|
||||
|
||||
return self.imagecolor
|
||||
|
||||
@ -142,7 +142,7 @@ end
|
||||
- func: SetOrientation(orientation)
|
||||
- desc: sets the object's orientation
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetOrientation(orientation)
|
||||
function newobject:SetOrientation(orientation)
|
||||
|
||||
self.orientation = orientation
|
||||
|
||||
@ -152,7 +152,7 @@ end
|
||||
- func: GetOrientation()
|
||||
- desc: gets the object's orientation
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetOrientation()
|
||||
function newobject:GetOrientation()
|
||||
|
||||
return self.orientation
|
||||
|
||||
@ -162,7 +162,7 @@ end
|
||||
- func: SetScaleX(scalex)
|
||||
- desc: sets the object's x scale
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetScaleX(scalex)
|
||||
function newobject:SetScaleX(scalex)
|
||||
|
||||
self.scalex = scalex
|
||||
|
||||
@ -172,7 +172,7 @@ end
|
||||
- func: GetScaleX()
|
||||
- desc: gets the object's x scale
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetScaleX()
|
||||
function newobject:GetScaleX()
|
||||
|
||||
return self.scalex
|
||||
|
||||
@ -182,7 +182,7 @@ end
|
||||
- func: SetScaleY(scaley)
|
||||
- desc: sets the object's y scale
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetScaleY(scaley)
|
||||
function newobject:SetScaleY(scaley)
|
||||
|
||||
self.scaley = scaley
|
||||
|
||||
@ -192,7 +192,7 @@ end
|
||||
- func: GetScaleY()
|
||||
- desc: gets the object's y scale
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetScaleY()
|
||||
function newobject:GetScaleY()
|
||||
|
||||
return self.scaley
|
||||
|
||||
@ -202,7 +202,7 @@ end
|
||||
- func: SetScale(scalex, scaley)
|
||||
- desc: sets the object's x and y scale
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetScale(scalex, scaley)
|
||||
function newobject:SetScale(scalex, scaley)
|
||||
|
||||
self.scalex = scalex
|
||||
self.scaley = scaley
|
||||
@ -213,7 +213,7 @@ end
|
||||
- func: GetScale()
|
||||
- desc: gets the object's x and y scale
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetScale()
|
||||
function newobject:GetScale()
|
||||
|
||||
return self.scalex, self.scaley
|
||||
|
||||
@ -223,7 +223,7 @@ end
|
||||
- func: SetOffsetX(x)
|
||||
- desc: sets the object's x offset
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetOffsetX(x)
|
||||
function newobject:SetOffsetX(x)
|
||||
|
||||
self.offsetx = x
|
||||
|
||||
@ -233,7 +233,7 @@ end
|
||||
- func: GetOffsetX()
|
||||
- desc: gets the object's x offset
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetOffsetX()
|
||||
function newobject:GetOffsetX()
|
||||
|
||||
return self.offsetx
|
||||
|
||||
@ -243,7 +243,7 @@ end
|
||||
- func: SetOffsetY(y)
|
||||
- desc: sets the object's y offset
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetOffsetY(y)
|
||||
function newobject:SetOffsetY(y)
|
||||
|
||||
self.offsety = y
|
||||
|
||||
@ -253,7 +253,7 @@ end
|
||||
- func: GetOffsetY()
|
||||
- desc: gets the object's y offset
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetOffsetY()
|
||||
function newobject:GetOffsetY()
|
||||
|
||||
return self.offsety
|
||||
|
||||
@ -263,7 +263,7 @@ end
|
||||
- func: SetOffset(x, y)
|
||||
- desc: sets the object's x and y offset
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetOffset(x, y)
|
||||
function newobject:SetOffset(x, y)
|
||||
|
||||
self.offsetx = x
|
||||
self.offsety = y
|
||||
@ -274,7 +274,7 @@ end
|
||||
- func: GetOffset()
|
||||
- desc: gets the object's x and y offset
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetOffset()
|
||||
function newobject:GetOffset()
|
||||
|
||||
return self.offsetx, self.offsety
|
||||
|
||||
@ -284,7 +284,7 @@ end
|
||||
- func: SetShearX(shearx)
|
||||
- desc: sets the object's x shear
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetShearX(shearx)
|
||||
function newobject:SetShearX(shearx)
|
||||
|
||||
self.shearx = shearx
|
||||
|
||||
@ -294,7 +294,7 @@ end
|
||||
- func: GetShearX()
|
||||
- desc: gets the object's x shear
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetShearX()
|
||||
function newobject:GetShearX()
|
||||
|
||||
return self.shearx
|
||||
|
||||
@ -304,7 +304,7 @@ end
|
||||
- func: SetShearY(sheary)
|
||||
- desc: sets the object's y shear
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetShearY(sheary)
|
||||
function newobject:SetShearY(sheary)
|
||||
|
||||
self.sheary = sheary
|
||||
|
||||
@ -314,7 +314,7 @@ end
|
||||
- func: GetShearY()
|
||||
- desc: gets the object's y shear
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetShearY()
|
||||
function newobject:GetShearY()
|
||||
|
||||
return self.sheary
|
||||
|
||||
@ -324,7 +324,7 @@ end
|
||||
- func: SetShear(shearx, sheary)
|
||||
- desc: sets the object's x and y shear
|
||||
--]]---------------------------------------------------------
|
||||
function image:SetShear(shearx, sheary)
|
||||
function newobject:SetShear(shearx, sheary)
|
||||
|
||||
self.shearx = shearx
|
||||
self.sheary = sheary
|
||||
@ -335,7 +335,7 @@ end
|
||||
- func: GetShear()
|
||||
- desc: gets the object's x and y shear
|
||||
--]]---------------------------------------------------------
|
||||
function image:GetShear()
|
||||
function newobject:GetShear()
|
||||
|
||||
return self.shearx, self.sheary
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- imagebutton class
|
||||
imagebutton = class("imagebutton", base)
|
||||
local newobject = loveframes.NewObject("imagebutton", "loveframes_object_imagebutton", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "imagebutton"
|
||||
self.text = "Image Button"
|
||||
@ -29,7 +29,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -77,7 +77,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -109,7 +109,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -138,7 +138,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -168,7 +168,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -178,7 +178,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
@ -188,7 +188,7 @@ end
|
||||
- func: SetClickable(bool)
|
||||
- desc: sets whether the object can be clicked or not
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:SetClickable(bool)
|
||||
function newobject:SetClickable(bool)
|
||||
|
||||
self.clickable = bool
|
||||
|
||||
@ -198,7 +198,7 @@ end
|
||||
- func: GetClickable(bool)
|
||||
- desc: gets whether the object can be clicked or not
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:GetClickable()
|
||||
function newobject:GetClickable()
|
||||
|
||||
return self.clickable
|
||||
|
||||
@ -208,7 +208,7 @@ end
|
||||
- func: SetClickable(bool)
|
||||
- desc: sets whether the object is enabled or not
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:SetEnabled(bool)
|
||||
function newobject:SetEnabled(bool)
|
||||
|
||||
self.enabled = bool
|
||||
|
||||
@ -218,7 +218,7 @@ end
|
||||
- func: GetEnabled()
|
||||
- desc: gets whether the object is enabled or not
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:GetEnabled()
|
||||
function newobject:GetEnabled()
|
||||
|
||||
return self.enabled
|
||||
|
||||
@ -228,7 +228,7 @@ end
|
||||
- func: SetImage(image)
|
||||
- desc: sets the object's image
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:SetImage(image)
|
||||
function newobject:SetImage(image)
|
||||
|
||||
if type(image) == "string" then
|
||||
self.image = love.graphics.newImage(image)
|
||||
@ -242,7 +242,7 @@ end
|
||||
- func: GetImage()
|
||||
- desc: gets whether the object is enabled or not
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:GetImage()
|
||||
function newobject:GetImage()
|
||||
|
||||
return self.image
|
||||
|
||||
@ -252,7 +252,7 @@ end
|
||||
- func: SizeToImage()
|
||||
- desc: makes the object the same size as it's image
|
||||
--]]---------------------------------------------------------
|
||||
function imagebutton:SizeToImage()
|
||||
function newobject:SizeToImage()
|
||||
|
||||
local image = self.image
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- closebutton class
|
||||
closebutton = class("closebutton", base)
|
||||
local newobject = loveframes.NewObject("closebutton", "loveframes_object_closebutton", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function closebutton:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "closebutton"
|
||||
self.width = 80
|
||||
@ -29,7 +29,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function closebutton:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -77,7 +77,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function closebutton:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -108,7 +108,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -137,7 +137,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
|
@ -4,31 +4,33 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- columnlistarea class
|
||||
columnlistarea = class("columnlistarea", base)
|
||||
local newobject = loveframes.NewObject("columnlistarea", "loveframes_object_columnlistarea", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: intializes the element
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:initialize(parent)
|
||||
function newobject:initialize(parent)
|
||||
|
||||
self.type = "columnlistarea"
|
||||
self.display = "vertical"
|
||||
self.parent = parent
|
||||
self.width = 80
|
||||
self.height = 25
|
||||
self.clickx = 0
|
||||
self.clicky = 0
|
||||
self.offsety = 0
|
||||
self.offsetx = 0
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.rowcolorindex = 1
|
||||
self.rowcolorindexmax = 2
|
||||
self.bar = false
|
||||
self.internal = true
|
||||
self.internals = {}
|
||||
self.children = {}
|
||||
self.type = "columnlistarea"
|
||||
self.display = "vertical"
|
||||
self.parent = parent
|
||||
self.width = 80
|
||||
self.height = 25
|
||||
self.clickx = 0
|
||||
self.clicky = 0
|
||||
self.offsety = 0
|
||||
self.offsetx = 0
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.rowcolorindex = 1
|
||||
self.rowcolorindexmax = 2
|
||||
self.buttonscrollamount = parent.buttonscrollamount
|
||||
self.mousewheelscrollamount = parent.mousewheelscrollamount
|
||||
self.bar = false
|
||||
self.internal = true
|
||||
self.internals = {}
|
||||
self.children = {}
|
||||
|
||||
-- apply template properties to the object
|
||||
loveframes.templates.ApplyToObject(self)
|
||||
@ -39,7 +41,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -86,7 +88,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -142,11 +144,12 @@ end
|
||||
- func: mousepressed(x, y, 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 internals = self.internals
|
||||
local children = self.children
|
||||
local toplist = self:IsTopList()
|
||||
local scrollamount = self.mousewheelscrollamount
|
||||
local internals = self.internals
|
||||
local children = self.children
|
||||
|
||||
if self.hover and button == "l" then
|
||||
|
||||
@ -163,9 +166,9 @@ function columnlistarea:mousepressed(x, y, button)
|
||||
local bar = self:GetScrollBar()
|
||||
|
||||
if button == "wu" then
|
||||
bar:Scroll(-5)
|
||||
bar:Scroll(-scrollamount)
|
||||
elseif button == "wd" then
|
||||
bar:Scroll(5)
|
||||
bar:Scroll(scrollamount)
|
||||
end
|
||||
|
||||
end
|
||||
@ -184,7 +187,7 @@ end
|
||||
- func: mousereleased(x, y, 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 children = self.children
|
||||
@ -203,7 +206,7 @@ end
|
||||
- func: CalculateSize()
|
||||
- desc: calculates the size of the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:CalculateSize()
|
||||
function newobject:CalculateSize()
|
||||
|
||||
local iw, ih = self.parent:GetColumnSize()
|
||||
local numitems = #self.children
|
||||
@ -225,7 +228,7 @@ function columnlistarea:CalculateSize()
|
||||
self.extraheight = self.itemheight - height
|
||||
|
||||
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:GetScrollBar().autoscroll = self.parent.autoscroll
|
||||
end
|
||||
@ -246,7 +249,7 @@ end
|
||||
- func: RedoLayout()
|
||||
- desc: used to redo the layour of the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:RedoLayout()
|
||||
function newobject:RedoLayout()
|
||||
|
||||
local children = self.children
|
||||
local starty = 0
|
||||
@ -285,9 +288,9 @@ end
|
||||
- func: AddRow(data)
|
||||
- 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 colorindexmax = self.rowcolorindexmax
|
||||
@ -309,7 +312,7 @@ end
|
||||
- func: GetScrollBar()
|
||||
- desc: gets the object's scroll bar
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:GetScrollBar()
|
||||
function newobject:GetScrollBar()
|
||||
|
||||
local internals = self.internals
|
||||
|
||||
@ -328,7 +331,7 @@ end
|
||||
- func: Sort()
|
||||
- desc: sorts the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:Sort(column, desc)
|
||||
function newobject:Sort(column, desc)
|
||||
|
||||
self.rowcolorindex = 1
|
||||
|
||||
@ -366,7 +369,7 @@ end
|
||||
- func: Clear()
|
||||
- desc: removes all items from the object's list
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistarea:Clear()
|
||||
function newobject:Clear()
|
||||
|
||||
self.children = {}
|
||||
self:CalculateSize()
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- columnlistrow class
|
||||
columnlistrow = class("columnlistrow", base)
|
||||
local newobject = loveframes.NewObject("columnlistrow", "loveframes_object_columnlistrow", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: intializes the element
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:initialize(parent, data)
|
||||
function newobject:initialize(parent, data)
|
||||
|
||||
self.type = "columnlistrow"
|
||||
self.parent = parent
|
||||
@ -32,7 +32,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -65,7 +65,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -97,7 +97,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
return
|
||||
@ -119,7 +119,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
return
|
||||
@ -143,7 +143,7 @@ end
|
||||
- func: SetTextPos(x, y)
|
||||
- desc: sets the positions of the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:SetTextPos(x, y)
|
||||
function newobject:SetTextPos(x, y)
|
||||
|
||||
self.textx = x
|
||||
self.texty = y
|
||||
@ -154,7 +154,7 @@ end
|
||||
- func: GetTextX()
|
||||
- desc: gets the object's text x position
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:GetTextX()
|
||||
function newobject:GetTextX()
|
||||
|
||||
return self.textx
|
||||
|
||||
@ -164,7 +164,7 @@ end
|
||||
- func: GetTextY()
|
||||
- desc: gets the object's text y position
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:GetTextY()
|
||||
function newobject:GetTextY()
|
||||
|
||||
return self.texty
|
||||
|
||||
@ -174,7 +174,7 @@ end
|
||||
- func: SetFont(font)
|
||||
- desc: sets the object's font
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:SetFont(font)
|
||||
function newobject:SetFont(font)
|
||||
|
||||
self.font = font
|
||||
|
||||
@ -184,7 +184,7 @@ end
|
||||
- func: GetFont()
|
||||
- desc: gets the object's font
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:GetFont()
|
||||
function newobject:GetFont()
|
||||
|
||||
return self.font
|
||||
|
||||
@ -194,7 +194,7 @@ end
|
||||
- func: GetColorIndex()
|
||||
- desc: gets the object's color index
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:GetColorIndex()
|
||||
function newobject:GetColorIndex()
|
||||
|
||||
return self.colorindex
|
||||
|
||||
@ -204,7 +204,7 @@ end
|
||||
- func: GetColumnData()
|
||||
- desc: gets the object's column data
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistrow:GetColumnData()
|
||||
function newobject:GetColumnData()
|
||||
|
||||
return self.columndata
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- columnlistheader class
|
||||
columnlistheader = class("columnlistheader", base)
|
||||
local newobject = loveframes.NewObject("columnlistheader", "loveframes_object_columnlistheader", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: intializes the element
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistheader:initialize(name, parent)
|
||||
function newobject:initialize(name, parent)
|
||||
|
||||
self.type = "columnlistheader"
|
||||
self.parent = parent
|
||||
@ -52,7 +52,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistheader:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -97,7 +97,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistheader:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -129,7 +129,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -150,7 +150,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
return
|
||||
@ -176,7 +176,7 @@ end
|
||||
- func: GetName()
|
||||
- desc: gets the object's name
|
||||
--]]---------------------------------------------------------
|
||||
function columnlistheader:GetName()
|
||||
function newobject:GetName()
|
||||
|
||||
return self.name
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- linenumberspanel class
|
||||
linenumberspanel = class("linenumberspanel", base)
|
||||
local newobject = loveframes.NewObject("linenumberspanel", "loveframes_object_linenumberspanel", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function linenumberspanel:initialize(parent)
|
||||
function newobject:initialize(parent)
|
||||
|
||||
self.parent = parent
|
||||
self.type = "linenumberspanel"
|
||||
@ -30,7 +30,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the element
|
||||
--]]---------------------------------------------------------
|
||||
function linenumberspanel:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -74,7 +74,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function linenumberspanel:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -116,7 +116,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -142,7 +142,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -156,7 +156,7 @@ end
|
||||
- func: GetOffsetY()
|
||||
- desc: gets the object's y offset
|
||||
--]]---------------------------------------------------------
|
||||
function linenumberspanel:GetOffsetY()
|
||||
function newobject:GetOffsetY()
|
||||
|
||||
return self.offsety
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- modalbackground class
|
||||
modalbackground = class("modalbackground", base)
|
||||
local newobject = loveframes.NewObject("modalbackground", "loveframes_object_modalbackground", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function modalbackground:initialize(object)
|
||||
function newobject:initialize(object)
|
||||
|
||||
self.type = "modalbackground"
|
||||
self.width = love.graphics.getWidth()
|
||||
@ -36,7 +36,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the element
|
||||
--]]---------------------------------------------------------
|
||||
function modalbackground:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -74,7 +74,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function modalbackground:draw()
|
||||
function newobject:draw()
|
||||
|
||||
if not self.visible then
|
||||
return
|
||||
|
@ -4,37 +4,39 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- multichoicelist class
|
||||
multichoicelist = class("multichoicelist", base)
|
||||
local newobject = loveframes.NewObject("multichoicelist", "loveframes_object_multichoicelist", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:initialize(object)
|
||||
function newobject:initialize(object)
|
||||
|
||||
self.type = "multichoice-list"
|
||||
self.parent = loveframes.base
|
||||
self.list = object
|
||||
self.x = object.x
|
||||
self.y = object.y + self.list.height
|
||||
self.width = self.list.width
|
||||
self.height = 0
|
||||
self.clickx = 0
|
||||
self.clicky = 0
|
||||
self.padding = self.list.listpadding
|
||||
self.spacing = self.list.listspacing
|
||||
self.offsety = 0
|
||||
self.offsetx = 0
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.canremove = false
|
||||
self.internal = true
|
||||
self.vbar = false
|
||||
self.children = {}
|
||||
self.internals = {}
|
||||
self.type = "multichoice-list"
|
||||
self.parent = loveframes.base
|
||||
self.list = object
|
||||
self.x = object.x
|
||||
self.y = object.y + self.list.height
|
||||
self.width = self.list.width
|
||||
self.height = 0
|
||||
self.clickx = 0
|
||||
self.clicky = 0
|
||||
self.padding = self.list.listpadding
|
||||
self.spacing = self.list.listspacing
|
||||
self.buttonscrollamount = object.buttonscrollamount
|
||||
self.mousewheelscrollamount = object.mousewheelscrollamount
|
||||
self.offsety = 0
|
||||
self.offsetx = 0
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.canremove = false
|
||||
self.internal = true
|
||||
self.vbar = false
|
||||
self.children = {}
|
||||
self.internals = {}
|
||||
|
||||
for k, v in ipairs(object.choices) do
|
||||
local row = multichoicerow:new()
|
||||
local row = loveframes.objects["multichoicerow"]:new()
|
||||
row:SetText(v)
|
||||
self:AddItem(row)
|
||||
end
|
||||
@ -50,7 +52,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -114,7 +116,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -170,7 +172,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -182,6 +184,7 @@ function multichoicelist:mousepressed(x, y, button)
|
||||
local toplist = self:IsTopList()
|
||||
local internals = self.internals
|
||||
local children = self.children
|
||||
local scrollamount = self.mousewheelscrollamount
|
||||
|
||||
if not selfcol and self.canremove and button == "l" then
|
||||
self:Close()
|
||||
@ -190,9 +193,9 @@ function multichoicelist:mousepressed(x, y, button)
|
||||
if self.vbar and toplist 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
|
||||
internals[1].internals[1].internals[1]:Scroll(5)
|
||||
internals[1].internals[1].internals[1]:Scroll(scrollamount)
|
||||
end
|
||||
|
||||
end
|
||||
@ -211,7 +214,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -238,7 +241,7 @@ end
|
||||
- func: AddItem(object)
|
||||
- desc: adds an item to the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:AddItem(object)
|
||||
function newobject:AddItem(object)
|
||||
|
||||
if object.type ~= "multichoice-row" then
|
||||
return
|
||||
@ -257,7 +260,7 @@ end
|
||||
- func: RemoveItem(object)
|
||||
- desc: removes an item from the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:RemoveItem(object)
|
||||
function newobject:RemoveItem(object)
|
||||
|
||||
local children = self.children
|
||||
|
||||
@ -278,7 +281,7 @@ end
|
||||
- func: CalculateSize()
|
||||
- desc: calculates the size of the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:CalculateSize()
|
||||
function newobject:CalculateSize()
|
||||
|
||||
self.height = self.padding
|
||||
|
||||
@ -313,7 +316,7 @@ function multichoicelist:CalculateSize()
|
||||
self.extraheight = self.itemheight - height
|
||||
|
||||
if not vbar then
|
||||
local scroll = scrollbody:new(self, "vertical")
|
||||
local scroll = loveframes.objects["scrollbody"]:new(self, "vertical")
|
||||
table.insert(self.internals, scroll)
|
||||
self.vbar = true
|
||||
end
|
||||
@ -334,7 +337,7 @@ end
|
||||
- func: RedoLayout()
|
||||
- desc: used to redo the layour of the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:RedoLayout()
|
||||
function newobject:RedoLayout()
|
||||
|
||||
local children = self.children
|
||||
local padding = self.padding
|
||||
@ -370,7 +373,7 @@ end
|
||||
- func: SetPadding(amount)
|
||||
- desc: sets the object's padding
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:SetPadding(amount)
|
||||
function newobject:SetPadding(amount)
|
||||
|
||||
self.padding = amount
|
||||
|
||||
@ -380,13 +383,13 @@ end
|
||||
- func: SetSpacing(amount)
|
||||
- desc: sets the object's spacing
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicelist:SetSpacing(amount)
|
||||
function newobject:SetSpacing(amount)
|
||||
|
||||
self.spacing = amount
|
||||
|
||||
end
|
||||
|
||||
function multichoicelist:Close()
|
||||
function newobject:Close()
|
||||
|
||||
self:Remove()
|
||||
self.list.haslist = false
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- multichoicerow class
|
||||
multichoicerow = class("multichoicerow", base)
|
||||
local newobject = loveframes.NewObject("multichoicerow", "loveframes_object_multichoicerow", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "multichoice-row"
|
||||
self.text = ""
|
||||
@ -30,7 +30,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -75,7 +75,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -106,7 +106,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -129,7 +129,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -152,7 +152,7 @@ end
|
||||
- func: keypressed(key)
|
||||
- desc: called when the player presses a key
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:keypressed(key, unicode)
|
||||
function newobject:keypressed(key, unicode)
|
||||
|
||||
local text = self.text
|
||||
local selectedobject = loveframes.selectedobject
|
||||
@ -167,7 +167,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -177,7 +177,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- scrollarea class
|
||||
scrollarea = class("scrollarea", base)
|
||||
local newobject = loveframes.NewObject("scrollarea", "loveframes_object_scrollarea", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollarea:initialize(parent, bartype)
|
||||
function newobject:initialize(parent, bartype)
|
||||
|
||||
self.type = "scroll-area"
|
||||
self.bartype = bartype
|
||||
@ -23,7 +23,7 @@ function scrollarea:initialize(parent, bartype)
|
||||
self.internal = true
|
||||
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
|
||||
loveframes.templates.ApplyToObject(self)
|
||||
@ -34,7 +34,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollarea:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -123,7 +123,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollarea:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -160,7 +160,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -213,7 +213,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -237,7 +237,7 @@ end
|
||||
- func: GetBarType()
|
||||
- desc: gets the object's bar type
|
||||
--]]---------------------------------------------------------
|
||||
function scrollarea:GetBarType()
|
||||
function newobject:GetBarType()
|
||||
|
||||
return self.bartype
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- scrollbar class
|
||||
scrollbar = class("scrollbar", base)
|
||||
local newobject = loveframes.NewObject("scrollbar", "loveframes_object_scrollbar", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:initialize(parent, bartype)
|
||||
function newobject:initialize(parent, bartype)
|
||||
|
||||
self.type = "scrollbar"
|
||||
self.bartype = bartype
|
||||
@ -51,7 +51,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -193,7 +193,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -225,7 +225,7 @@ end
|
||||
- func: mousepressed(x, y, 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 hover = self.hover
|
||||
@ -267,7 +267,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -285,7 +285,7 @@ end
|
||||
- func: SetMaxX(x)
|
||||
- desc: sets the object's max x position
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:SetMaxX(x)
|
||||
function newobject:SetMaxX(x)
|
||||
|
||||
self.maxx = x
|
||||
|
||||
@ -295,7 +295,7 @@ end
|
||||
- func: SetMaxY(y)
|
||||
- desc: sets the object's max y position
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:SetMaxY(y)
|
||||
function newobject:SetMaxY(y)
|
||||
|
||||
self.maxy = y
|
||||
|
||||
@ -305,7 +305,7 @@ end
|
||||
- func: Scroll(amount)
|
||||
- desc: scrolls the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:Scroll(amount)
|
||||
function newobject:Scroll(amount)
|
||||
|
||||
local bartype = self.bartype
|
||||
local listo = self.parent.parent.parent
|
||||
@ -343,7 +343,7 @@ end
|
||||
- func: IsDragging()
|
||||
- desc: gets whether the object is being dragged or not
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:IsDragging()
|
||||
function newobject:IsDragging()
|
||||
|
||||
return self.dragging
|
||||
|
||||
@ -353,7 +353,7 @@ end
|
||||
- func: GetBarType()
|
||||
- desc: gets the object's bartype
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbar:GetBarType()
|
||||
function newobject:GetBarType()
|
||||
|
||||
return self.bartype
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- scrollbar class
|
||||
scrollbody = class("scrollbody", base)
|
||||
local newobject = loveframes.NewObject("scrollbody", "loveframes_object_scrollbody", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbody:initialize(parent, bartype)
|
||||
function newobject:initialize(parent, bartype)
|
||||
|
||||
self.type = "scrollbody"
|
||||
self.bartype = bartype
|
||||
@ -32,13 +32,13 @@ function scrollbody:initialize(parent, bartype)
|
||||
self.staticy = self.parent.height - self.height
|
||||
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]
|
||||
|
||||
if self.bartype == "vertical" then
|
||||
|
||||
local upbutton = scrollbutton:new("up")
|
||||
local upbutton = loveframes.objects["scrollbutton"]:new("up")
|
||||
upbutton.parent = self
|
||||
upbutton.Update = function(object, dt)
|
||||
upbutton.staticx = 0 + self.width - upbutton.width
|
||||
@ -48,7 +48,7 @@ function scrollbody:initialize(parent, bartype)
|
||||
end
|
||||
end
|
||||
|
||||
local downbutton = scrollbutton:new("down")
|
||||
local downbutton = loveframes.objects["scrollbutton"]:new("down")
|
||||
downbutton.parent = self
|
||||
downbutton.Update = function(object, dt)
|
||||
downbutton.staticx = 0 + self.width - downbutton.width
|
||||
@ -63,7 +63,7 @@ function scrollbody:initialize(parent, bartype)
|
||||
|
||||
elseif self.bartype == "horizontal" then
|
||||
|
||||
local leftbutton = scrollbutton:new("left")
|
||||
local leftbutton = loveframes.objects["scrollbutton"]:new("left")
|
||||
leftbutton.parent = self
|
||||
leftbutton.Update = function(object, dt)
|
||||
leftbutton.staticx = 0
|
||||
@ -73,7 +73,7 @@ function scrollbody:initialize(parent, bartype)
|
||||
end
|
||||
end
|
||||
|
||||
local rightbutton = scrollbutton:new("right")
|
||||
local rightbutton = loveframes.objects["scrollbutton"]:new("right")
|
||||
rightbutton.parent = self
|
||||
rightbutton.Update = function(object, dt)
|
||||
rightbutton.staticx = 0 + self.width - rightbutton.width
|
||||
@ -97,7 +97,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbody:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -135,7 +135,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbody:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- scrollbutton clas
|
||||
scrollbutton = class("scrollbutton", base)
|
||||
local newobject = loveframes.NewObject("scrollbutton", "loveframes_object_scrollbutton", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbutton:initialize(scrolltype)
|
||||
function newobject:initialize(scrolltype)
|
||||
|
||||
self.type = "scrollbutton"
|
||||
self.scrolltype = scrolltype
|
||||
@ -29,7 +29,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbutton:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -75,7 +75,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbutton:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -107,7 +107,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -136,7 +136,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -164,7 +164,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbutton:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
return
|
||||
|
||||
@ -175,7 +175,7 @@ end
|
||||
- func: GetScrollType()
|
||||
- desc: gets the object's scroll type
|
||||
--]]---------------------------------------------------------
|
||||
function scrollbutton:GetScrollType()
|
||||
function newobject:GetScrollType()
|
||||
|
||||
return self.scrolltype
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- sliderbutton class
|
||||
sliderbutton = class("sliderbutton", base)
|
||||
local newobject = loveframes.NewObject("sliderbutton", "loveframes_object_sliderbutton", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function sliderbutton:initialize(parent)
|
||||
function newobject:initialize(parent)
|
||||
|
||||
self.type = "sliderbutton"
|
||||
self.width = 10
|
||||
@ -36,7 +36,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function sliderbutton:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -108,7 +108,6 @@ function sliderbutton:update(dt)
|
||||
|
||||
end
|
||||
|
||||
--
|
||||
if nvalue > self.parent.max then
|
||||
nvalue = self.parent.max
|
||||
end
|
||||
@ -119,6 +118,10 @@ function sliderbutton:update(dt)
|
||||
|
||||
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 self.parent.OnValueChanged then
|
||||
self.parent.OnValueChanged(self.parent, self.parent.value)
|
||||
@ -157,7 +160,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function sliderbutton:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -189,7 +192,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -223,7 +226,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -240,7 +243,7 @@ end
|
||||
- func: MoveToX(x)
|
||||
- desc: moves the object to the specified x position
|
||||
--]]---------------------------------------------------------
|
||||
function sliderbutton:MoveToX(x)
|
||||
function newobject:MoveToX(x)
|
||||
|
||||
self.staticx = x
|
||||
|
||||
@ -250,7 +253,7 @@ end
|
||||
- func: MoveToY(y)
|
||||
- desc: moves the object to the specified y position
|
||||
--]]---------------------------------------------------------
|
||||
function sliderbutton:MoveToY(y)
|
||||
function newobject:MoveToY(y)
|
||||
|
||||
self.staticy = y
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- tabbutton class
|
||||
tabbutton = class("tabbutton", base)
|
||||
local newobject = loveframes.NewObject("tabbutton", "loveframes_object_tabbutton", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:initialize(parent, text, tabnumber, tip, image)
|
||||
function newobject:initialize(parent, text, tabnumber, tip, image)
|
||||
|
||||
self.type = "tabbutton"
|
||||
self.font = loveframes.smallfont
|
||||
@ -26,7 +26,7 @@ function tabbutton:initialize(parent, text, tabnumber, tip, image)
|
||||
self.image = nil
|
||||
|
||||
if tip then
|
||||
self.tooltip = tooltip:new(self, tip)
|
||||
self.tooltip = loveframes.objects["tooltip"]:new(self, tip)
|
||||
self.tooltip:SetFollowCursor(false)
|
||||
self.tooltip:SetOffsets(0, -5)
|
||||
end
|
||||
@ -44,7 +44,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -78,7 +78,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:draw()
|
||||
function newobject:draw()
|
||||
|
||||
if not self.visible then
|
||||
return
|
||||
@ -109,7 +109,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -138,7 +138,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -166,7 +166,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -176,7 +176,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
@ -186,7 +186,7 @@ end
|
||||
- func: SetImage(image)
|
||||
- desc: adds an image to the object
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:SetImage(image)
|
||||
function newobject:SetImage(image)
|
||||
|
||||
if type(image) == "string" then
|
||||
self.image = love.graphics.newImage(image)
|
||||
@ -200,7 +200,7 @@ end
|
||||
- func: GetImage()
|
||||
- desc: gets the object's image
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:GetImage()
|
||||
function newobject:GetImage()
|
||||
|
||||
return self.image
|
||||
|
||||
@ -210,7 +210,7 @@ end
|
||||
- func: GetTabNumber()
|
||||
- desc: gets the object's tab number
|
||||
--]]---------------------------------------------------------
|
||||
function tabbutton:GetTabNumber()
|
||||
function newobject:GetTabNumber()
|
||||
|
||||
return self.tabnumber
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- tooltip clas
|
||||
tooltip = class("tooltip", base)
|
||||
local newobject = loveframes.NewObject("tooltip", "loveframes_object_tooltip", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:initialize(object, text, width)
|
||||
function newobject:initialize(object, text, width)
|
||||
|
||||
local width = width or 0
|
||||
|
||||
@ -45,7 +45,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -122,7 +122,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -163,7 +163,7 @@ end
|
||||
- desc: sets whether or not the tooltip should follow the
|
||||
cursor
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetFollowCursor(bool)
|
||||
function newobject:SetFollowCursor(bool)
|
||||
|
||||
self.followcursor = bool
|
||||
|
||||
@ -173,7 +173,7 @@ end
|
||||
- func: SetObject(object)
|
||||
- desc: sets the tooltip's object
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetObject(object)
|
||||
function newobject:SetObject(object)
|
||||
|
||||
self.object = object
|
||||
|
||||
@ -183,7 +183,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the tooltip's text
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text:SetText(text)
|
||||
self.text2 = text
|
||||
@ -194,7 +194,7 @@ end
|
||||
- func: SetTextMaxWidth(text)
|
||||
- desc: sets the tooltip's text max width
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetTextMaxWidth(width)
|
||||
function newobject:SetTextMaxWidth(width)
|
||||
|
||||
self.text:SetMaxWidth(width)
|
||||
|
||||
@ -204,7 +204,7 @@ end
|
||||
- func: SetOffsets(xoffset, yoffset)
|
||||
- desc: sets the tooltip's x and y offset
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetOffsets(xoffset, yoffset)
|
||||
function newobject:SetOffsets(xoffset, yoffset)
|
||||
|
||||
self.xoffset = xoffset
|
||||
self.yoffset = yoffset
|
||||
@ -215,7 +215,7 @@ end
|
||||
- func: SetPadding(padding)
|
||||
- desc: sets the tooltip's padding
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetPadding(padding)
|
||||
function newobject:SetPadding(padding)
|
||||
|
||||
self.padding = padding
|
||||
|
||||
@ -225,7 +225,7 @@ end
|
||||
- func: SetFont(font)
|
||||
- desc: sets the tooltip's font
|
||||
--]]---------------------------------------------------------
|
||||
function tooltip:SetFont(font)
|
||||
function newobject:SetFont(font)
|
||||
|
||||
self.text:SetFont(font)
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- list class
|
||||
list = class("list", base)
|
||||
local newobject = loveframes.NewObject("list", "loveframes_object_list", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function list:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "list"
|
||||
self.display = "vertical"
|
||||
@ -40,7 +40,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function list:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -95,7 +95,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function list:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -151,7 +151,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -207,7 +207,7 @@ end
|
||||
- func: AddItem(object)
|
||||
- desc: adds an item to the object
|
||||
--]]---------------------------------------------------------
|
||||
function list:AddItem(object)
|
||||
function newobject:AddItem(object)
|
||||
|
||||
if object.type == "frame" then
|
||||
return
|
||||
@ -232,7 +232,7 @@ end
|
||||
- func: RemoveItem(object)
|
||||
- desc: removes an item from the object
|
||||
--]]---------------------------------------------------------
|
||||
function list:RemoveItem(object)
|
||||
function newobject:RemoveItem(object)
|
||||
|
||||
object:Remove()
|
||||
self:CalculateSize()
|
||||
@ -244,7 +244,7 @@ end
|
||||
- func: CalculateSize()
|
||||
- desc: calculates the size of the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function list:CalculateSize()
|
||||
function newobject:CalculateSize()
|
||||
|
||||
local numitems = #self.children
|
||||
local height = self.height
|
||||
@ -274,7 +274,7 @@ function list:CalculateSize()
|
||||
self.extraheight = itemheight - height
|
||||
|
||||
if not vbar then
|
||||
local scrollbar = scrollbody:new(self, display)
|
||||
local scrollbar = loveframes.objects["scrollbody"]:new(self, display)
|
||||
table.insert(internals, scrollbar)
|
||||
self.vbar = true
|
||||
self:GetScrollBar().autoscroll = self.autoscroll
|
||||
@ -306,7 +306,7 @@ function list:CalculateSize()
|
||||
self.extrawidth = itemwidth - width
|
||||
|
||||
if not hbar then
|
||||
local scrollbar = scrollbody:new(self, display)
|
||||
local scrollbar = loveframes.objects["scrollbody"]:new(self, display)
|
||||
table.insert(internals, scrollbar)
|
||||
self.hbar = true
|
||||
self:GetScrollBar().autoscroll = self.autoscroll
|
||||
@ -331,7 +331,7 @@ end
|
||||
- func: RedoLayout()
|
||||
- desc: used to redo the layour of the object
|
||||
--]]---------------------------------------------------------
|
||||
function list:RedoLayout()
|
||||
function newobject:RedoLayout()
|
||||
|
||||
local children = self.children
|
||||
local padding = self.padding
|
||||
@ -407,7 +407,7 @@ end
|
||||
- func: SetDisplayType(type)
|
||||
- desc: sets the object's display type
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetDisplayType(type)
|
||||
function newobject:SetDisplayType(type)
|
||||
|
||||
local children = self.children
|
||||
local numchildren = #children
|
||||
@ -430,7 +430,7 @@ end
|
||||
- func: GetDisplayType()
|
||||
- desc: gets the object's display type
|
||||
--]]---------------------------------------------------------
|
||||
function list:GetDisplayType()
|
||||
function newobject:GetDisplayType()
|
||||
|
||||
return self.display
|
||||
|
||||
@ -440,7 +440,7 @@ end
|
||||
- func: SetPadding(amount)
|
||||
- desc: sets the object's padding
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetPadding(amount)
|
||||
function newobject:SetPadding(amount)
|
||||
|
||||
local children = self.children
|
||||
local numchildren = #children
|
||||
@ -458,7 +458,7 @@ end
|
||||
- func: SetSpacing(amount)
|
||||
- desc: sets the object's spacing
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetSpacing(amount)
|
||||
function newobject:SetSpacing(amount)
|
||||
|
||||
local children = self.children
|
||||
local numchildren = #children
|
||||
@ -476,7 +476,7 @@ end
|
||||
- func: Clear()
|
||||
- desc: removes all of the object's children
|
||||
--]]---------------------------------------------------------
|
||||
function list:Clear()
|
||||
function newobject:Clear()
|
||||
|
||||
self.children = {}
|
||||
self:CalculateSize()
|
||||
@ -488,7 +488,7 @@ end
|
||||
- func: SetWidth(width)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetWidth(width)
|
||||
function newobject:SetWidth(width)
|
||||
|
||||
self.width = width
|
||||
self:CalculateSize()
|
||||
@ -500,7 +500,7 @@ end
|
||||
- func: SetHeight(height)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetHeight(height)
|
||||
function newobject:SetHeight(height)
|
||||
|
||||
self.height = height
|
||||
self:CalculateSize()
|
||||
@ -512,7 +512,7 @@ end
|
||||
- func: GetSize()
|
||||
- desc: gets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetSize(width, height)
|
||||
function newobject:SetSize(width, height)
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
@ -525,7 +525,7 @@ end
|
||||
- func: GetScrollBar()
|
||||
- desc: gets the object's scroll bar
|
||||
--]]---------------------------------------------------------
|
||||
function list:GetScrollBar()
|
||||
function newobject:GetScrollBar()
|
||||
|
||||
local vbar = self.vbar
|
||||
local hbar = self.hbar
|
||||
@ -548,7 +548,7 @@ end
|
||||
auto scroll to the bottom when a new object is
|
||||
added to the list
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetAutoScroll(bool)
|
||||
function newobject:SetAutoScroll(bool)
|
||||
|
||||
local scrollbar = self:GetScrollBar()
|
||||
|
||||
@ -565,7 +565,7 @@ end
|
||||
- desc: sets the scroll amount of the object's scrollbar
|
||||
buttons
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetButtonScrollAmount(amount)
|
||||
function newobject:SetButtonScrollAmount(amount)
|
||||
|
||||
self.buttonscrollamount = amount
|
||||
|
||||
@ -576,7 +576,7 @@ end
|
||||
- desc: gets the scroll amount of the object's scrollbar
|
||||
buttons
|
||||
--]]---------------------------------------------------------
|
||||
function list:GetButtonScrollAmount()
|
||||
function newobject:GetButtonScrollAmount()
|
||||
|
||||
return self.buttonscrollamount
|
||||
|
||||
@ -586,7 +586,7 @@ end
|
||||
- func: SetMouseWheelScrollAmount(amount)
|
||||
- desc: sets the scroll amount of the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function list:SetMouseWheelScrollAmount(amount)
|
||||
function newobject:SetMouseWheelScrollAmount(amount)
|
||||
|
||||
self.mousewheelscrollamount = amount
|
||||
|
||||
@ -596,7 +596,7 @@ end
|
||||
- func: GetMouseWheelScrollAmount()
|
||||
- desc: gets the scroll amount of the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function list:GetButtonScrollAmount()
|
||||
function newobject:GetButtonScrollAmount()
|
||||
|
||||
return self.mousewheelscrollamount
|
||||
|
||||
|
@ -4,25 +4,27 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- multichoice class
|
||||
multichoice = class("multichoice", base)
|
||||
local newobject = loveframes.NewObject("multichoice", "loveframes_object_multichoice", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "multichoice"
|
||||
self.choice = ""
|
||||
self.text = "Select an option"
|
||||
self.width = 200
|
||||
self.height = 25
|
||||
self.listpadding = 0
|
||||
self.listspacing = 0
|
||||
self.haslist = false
|
||||
self.internal = false
|
||||
self.choices = {}
|
||||
self.listheight = nil
|
||||
self.type = "multichoice"
|
||||
self.choice = ""
|
||||
self.text = "Select an option"
|
||||
self.width = 200
|
||||
self.height = 25
|
||||
self.listpadding = 0
|
||||
self.listspacing = 0
|
||||
self.buttonscrollamount = 0.10
|
||||
self.mousewheelscrollamount = 5
|
||||
self.haslist = false
|
||||
self.internal = false
|
||||
self.choices = {}
|
||||
self.listheight = nil
|
||||
|
||||
end
|
||||
|
||||
@ -30,7 +32,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -63,7 +65,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -95,7 +97,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -115,7 +117,7 @@ function multichoice:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
self.haslist = true
|
||||
self.list = multichoicelist:new(self)
|
||||
self.list = loveframes.objects["multichoicelist"]:new(self)
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
@ -126,7 +128,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -140,7 +142,7 @@ end
|
||||
- func: AddChoice(choice)
|
||||
- desc: adds a choice to the current list of choices
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:AddChoice(choice)
|
||||
function newobject:AddChoice(choice)
|
||||
|
||||
local choices = self.choices
|
||||
table.insert(choices, choice)
|
||||
@ -151,7 +153,7 @@ end
|
||||
- func: SetChoice(choice)
|
||||
- desc: sets the current choice
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:SetChoice(choice)
|
||||
function newobject:SetChoice(choice)
|
||||
|
||||
self.choice = choice
|
||||
|
||||
@ -161,7 +163,7 @@ end
|
||||
- func: SelectChoice(choice)
|
||||
- desc: selects a choice
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:SelectChoice(choice)
|
||||
function newobject:SelectChoice(choice)
|
||||
|
||||
local onchoiceselected = self.OnChoiceSelected
|
||||
|
||||
@ -178,7 +180,7 @@ end
|
||||
- func: SetListHeight(height)
|
||||
- desc: sets the height of the list of choices
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:SetListHeight(height)
|
||||
function newobject:SetListHeight(height)
|
||||
|
||||
self.listheight = height
|
||||
|
||||
@ -188,7 +190,7 @@ end
|
||||
- func: SetPadding(padding)
|
||||
- desc: sets the padding of the list of choices
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:SetPadding(padding)
|
||||
function newobject:SetPadding(padding)
|
||||
|
||||
self.listpadding = padding
|
||||
|
||||
@ -198,7 +200,7 @@ end
|
||||
- func: SetSpacing(spacing)
|
||||
- desc: sets the spacing of the list of choices
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:SetSpacing(spacing)
|
||||
function newobject:SetSpacing(spacing)
|
||||
|
||||
self.listspacing = spacing
|
||||
|
||||
@ -208,7 +210,7 @@ end
|
||||
- func: GetValue()
|
||||
- desc: gets the value (choice) of the object
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:GetValue()
|
||||
function newobject:GetValue()
|
||||
|
||||
return self.choice
|
||||
|
||||
@ -218,7 +220,7 @@ end
|
||||
- func: GetChoice()
|
||||
- desc: gets the current choice (same as get value)
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:GetChoice()
|
||||
function newobject:GetChoice()
|
||||
|
||||
return self.choice
|
||||
|
||||
@ -228,7 +230,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -238,8 +240,50 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function multichoice:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
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
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- panel class
|
||||
panel = class("panel", base)
|
||||
local newobject = loveframes.NewObject("panel", "loveframes_object_panel", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function panel:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "panel"
|
||||
self.width = 200
|
||||
@ -24,7 +24,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the element
|
||||
--]]---------------------------------------------------------
|
||||
function panel:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -62,7 +62,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function panel:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -100,7 +100,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -131,7 +131,7 @@ end
|
||||
- func: mousereleased(x, y, 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 children = self.children
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- progressbar class
|
||||
progressbar = class("progressbar", base)
|
||||
local newobject = loveframes.NewObject("progressbar", "loveframes_object_progressbar", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "progressbar"
|
||||
self.width = 100
|
||||
@ -34,7 +34,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -125,7 +125,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -157,7 +157,7 @@ end
|
||||
- func: SetMax(max)
|
||||
- desc: sets the object's maximum value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:SetMax(max)
|
||||
function newobject:SetMax(max)
|
||||
|
||||
self.max = max
|
||||
|
||||
@ -167,7 +167,7 @@ end
|
||||
- func: GetMax()
|
||||
- desc: gets the object's maximum value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetMax()
|
||||
function newobject:GetMax()
|
||||
|
||||
return self.max
|
||||
|
||||
@ -177,7 +177,7 @@ end
|
||||
- func: SetMin(min)
|
||||
- desc: sets the object's minimum value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:SetMin(min)
|
||||
function newobject:SetMin(min)
|
||||
|
||||
self.min = min
|
||||
|
||||
@ -187,7 +187,7 @@ end
|
||||
- func: GetMin()
|
||||
- desc: gets the object's minimum value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetMin()
|
||||
function newobject:GetMin()
|
||||
|
||||
return self.min
|
||||
|
||||
@ -197,7 +197,7 @@ end
|
||||
- func: SetMinMax()
|
||||
- desc: sets the object's minimum and maximum values
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:SetMinMax(min, max)
|
||||
function newobject:SetMinMax(min, max)
|
||||
|
||||
self.min = min
|
||||
self.max = max
|
||||
@ -208,7 +208,7 @@ end
|
||||
- func: GetMinMax()
|
||||
- desc: gets the object's minimum and maximum values
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetMinMax()
|
||||
function newobject:GetMinMax()
|
||||
|
||||
return self.min, self.max
|
||||
|
||||
@ -218,7 +218,7 @@ end
|
||||
- func: SetValue(value)
|
||||
- desc: sets the object's value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:SetValue(value)
|
||||
function newobject:SetValue(value)
|
||||
|
||||
local lerp = self.lerp
|
||||
|
||||
@ -237,7 +237,7 @@ end
|
||||
- func: GetValue()
|
||||
- desc: gets the object's value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetValue()
|
||||
function newobject:GetValue()
|
||||
|
||||
return self.value
|
||||
|
||||
@ -248,7 +248,7 @@ end
|
||||
- desc: sets whether or not the object should lerp
|
||||
when changing between values
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:SetLerp(bool)
|
||||
function newobject:SetLerp(bool)
|
||||
|
||||
self.lerp = bool
|
||||
self.lerpto = self:GetValue()
|
||||
@ -261,7 +261,7 @@ end
|
||||
- desc: gets whether or not the object should lerp
|
||||
when changing between values
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetLerp()
|
||||
function newobject:GetLerp()
|
||||
|
||||
return self.lerp
|
||||
|
||||
@ -271,7 +271,7 @@ end
|
||||
- func: SetLerpRate(rate)
|
||||
- desc: sets the object's lerp rate
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:SetLerpRate(rate)
|
||||
function newobject:SetLerpRate(rate)
|
||||
|
||||
self.lerprate = rate
|
||||
|
||||
@ -281,7 +281,7 @@ end
|
||||
- func: GetLerpRate()
|
||||
- desc: gets the object's lerp rate
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetLerpRate()
|
||||
function newobject:GetLerpRate()
|
||||
|
||||
return self.lerprate
|
||||
|
||||
@ -292,7 +292,7 @@ end
|
||||
- desc: gets whether or not the object has reached it's
|
||||
maximum value
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetCompleted()
|
||||
function newobject:GetCompleted()
|
||||
|
||||
return self.completed
|
||||
|
||||
@ -302,7 +302,7 @@ end
|
||||
- func: GetBarWidth()
|
||||
- desc: gets the object's bar width
|
||||
--]]---------------------------------------------------------
|
||||
function progressbar:GetBarWidth()
|
||||
function newobject:GetBarWidth()
|
||||
|
||||
return self.barwidth
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- slider class
|
||||
slider = class("slider", base)
|
||||
local newobject = loveframes.NewObject("slider", "loveframes_object_slider", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function slider:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "slider"
|
||||
self.text = "Slider"
|
||||
@ -26,7 +26,7 @@ function slider:initialize()
|
||||
self.OnValueChanged = nil
|
||||
|
||||
-- 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
|
||||
self:SetValue(self.min)
|
||||
@ -37,7 +37,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function slider:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -85,7 +85,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function slider:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -123,7 +123,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -182,7 +182,7 @@ end
|
||||
- func: SetValue(value)
|
||||
- desc: sets the object's value
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetValue(value)
|
||||
function newobject:SetValue(value)
|
||||
|
||||
if value > self.max then
|
||||
return
|
||||
@ -228,7 +228,7 @@ end
|
||||
- func: GetValue()
|
||||
- desc: gets the object's value
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetValue()
|
||||
function newobject:GetValue()
|
||||
|
||||
return self.value
|
||||
|
||||
@ -238,7 +238,7 @@ end
|
||||
- func: SetMax(max)
|
||||
- desc: sets the object's maximum value
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetMax(max)
|
||||
function newobject:SetMax(max)
|
||||
|
||||
self.max = max
|
||||
|
||||
@ -252,7 +252,7 @@ end
|
||||
- func: GetMax()
|
||||
- desc: gets the object's maximum value
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetMax()
|
||||
function newobject:GetMax()
|
||||
|
||||
return self.max
|
||||
|
||||
@ -262,7 +262,7 @@ end
|
||||
- func: SetMin(min)
|
||||
- desc: sets the object's minimum value
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetMin(min)
|
||||
function newobject:SetMin(min)
|
||||
|
||||
self.min = min
|
||||
|
||||
@ -276,7 +276,7 @@ end
|
||||
- func: GetMin()
|
||||
- desc: gets the object's minimum value
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetMin()
|
||||
function newobject:GetMin()
|
||||
|
||||
return self.min
|
||||
|
||||
@ -286,7 +286,7 @@ end
|
||||
- func: SetMinMax()
|
||||
- desc: sets the object's minimum and maximum values
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetMinMax(min, max)
|
||||
function newobject:SetMinMax(min, max)
|
||||
|
||||
self.min = min
|
||||
self.max = max
|
||||
@ -305,7 +305,7 @@ end
|
||||
- func: GetMinMax()
|
||||
- desc: gets the object's minimum and maximum values
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetMinMax()
|
||||
function newobject:GetMinMax()
|
||||
|
||||
return self.min, self.max
|
||||
|
||||
@ -315,7 +315,7 @@ end
|
||||
- func: SetText(name)
|
||||
- desc: sets the objects's text
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
||||
@ -325,7 +325,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the objects's text
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
@ -335,7 +335,7 @@ end
|
||||
- func: SetDecimals(decimals)
|
||||
- desc: sets the objects's decimals
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetDecimals(decimals)
|
||||
function newobject:SetDecimals(decimals)
|
||||
|
||||
self.decimals = decimals
|
||||
|
||||
@ -345,7 +345,7 @@ end
|
||||
- func: SetButtonSize(width, height)
|
||||
- desc: sets the objects's button size
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetButtonSize(width, height)
|
||||
function newobject:SetButtonSize(width, height)
|
||||
|
||||
local internals = self.internals
|
||||
local sliderbutton = internals[1]
|
||||
@ -361,7 +361,7 @@ end
|
||||
- func: GetButtonSize()
|
||||
- desc: gets the objects's button size
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetButtonSize()
|
||||
function newobject:GetButtonSize()
|
||||
|
||||
local internals = self.internals
|
||||
local sliderbutton = internals[1]
|
||||
@ -378,7 +378,7 @@ end
|
||||
- func: SetSlideType(slidetype)
|
||||
- desc: sets the objects's slide type
|
||||
--]]---------------------------------------------------------
|
||||
function slider:SetSlideType(slidetype)
|
||||
function newobject:SetSlideType(slidetype)
|
||||
|
||||
self.slidetype = slidetype
|
||||
|
||||
@ -392,7 +392,7 @@ end
|
||||
- func: GetSlideType()
|
||||
- desc: gets the objects's slide type
|
||||
--]]---------------------------------------------------------
|
||||
function slider:GetSlideType()
|
||||
function newobject:GetSlideType()
|
||||
|
||||
return self.slidetype
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- tabs class
|
||||
tabs = class("tabpanel", base)
|
||||
local newobject = loveframes.NewObject("tabs", "loveframes_object_tabs", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "tabs"
|
||||
self.width = 100
|
||||
@ -36,7 +36,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the element
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -100,7 +100,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -149,7 +149,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -224,7 +224,7 @@ end
|
||||
- func: mousereleased(x, y, 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 children = self.children
|
||||
@ -250,7 +250,7 @@ end
|
||||
- func: AddTab(name, object, tip, image)
|
||||
- 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 autosize = self.autosize
|
||||
@ -264,7 +264,7 @@ function tabs:AddTab(name, object, tip, image)
|
||||
object.staticy = 0
|
||||
|
||||
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
|
||||
|
||||
for k, v in ipairs(internals) do
|
||||
@ -285,7 +285,7 @@ end
|
||||
- desc: creates scroll buttons fot the tab panel
|
||||
- note: for internal use only
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:AddScrollButtons()
|
||||
function newobject:AddScrollButtons()
|
||||
|
||||
local internals = self.internals
|
||||
|
||||
@ -295,7 +295,7 @@ function tabs:AddScrollButtons()
|
||||
end
|
||||
end
|
||||
|
||||
local leftbutton = scrollbutton:new("left")
|
||||
local leftbutton = loveframes.objects["scrollbutton"]:new("left")
|
||||
leftbutton.parent = self
|
||||
leftbutton:SetPos(0, 0)
|
||||
leftbutton:SetSize(15, 25)
|
||||
@ -316,7 +316,7 @@ function tabs:AddScrollButtons()
|
||||
end
|
||||
end
|
||||
|
||||
local rightbutton = scrollbutton:new("right")
|
||||
local rightbutton = loveframes.objects["scrollbutton"]:new("right")
|
||||
rightbutton.parent = self
|
||||
rightbutton:SetPos(self.width - 15, 0)
|
||||
rightbutton:SetSize(15, 25)
|
||||
@ -347,7 +347,7 @@ end
|
||||
- func: GetWidthOfButtons()
|
||||
- desc: gets the total width of all of the tab buttons
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:GetWidthOfButtons()
|
||||
function newobject:GetWidthOfButtons()
|
||||
|
||||
local width = 0
|
||||
local internals = self.internals
|
||||
@ -366,7 +366,7 @@ end
|
||||
- func: GetHeightOfButtons()
|
||||
- desc: gets the height of one tab button
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:GetHeightOfButtons()
|
||||
function newobject:GetHeightOfButtons()
|
||||
|
||||
return self.tabheight
|
||||
|
||||
@ -376,7 +376,7 @@ end
|
||||
- func: SwitchToTab(tabnumber)
|
||||
- desc: makes the specified tab the active tab
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:SwitchToTab(tabnumber)
|
||||
function newobject:SwitchToTab(tabnumber)
|
||||
|
||||
local children = self.children
|
||||
|
||||
@ -393,7 +393,7 @@ end
|
||||
- func: SetScrollButtonSize(width, height)
|
||||
- desc: sets the size of the scroll buttons
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:SetScrollButtonSize(width, height)
|
||||
function newobject:SetScrollButtonSize(width, height)
|
||||
|
||||
local internals = self.internals
|
||||
|
||||
@ -409,7 +409,7 @@ end
|
||||
- func: SetPadding(paddint)
|
||||
- desc: sets the padding for the tab panel
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:SetPadding(padding)
|
||||
function newobject:SetPadding(padding)
|
||||
|
||||
self.padding = padding
|
||||
|
||||
@ -419,7 +419,7 @@ end
|
||||
- func: SetPadding(paddint)
|
||||
- desc: gets the padding of the tab panel
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:GetPadding()
|
||||
function newobject:GetPadding()
|
||||
|
||||
return self.padding
|
||||
|
||||
@ -429,7 +429,7 @@ end
|
||||
- func: SetTabHeight(height)
|
||||
- desc: sets the height of the tab buttons
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:SetTabHeight(height)
|
||||
function newobject:SetTabHeight(height)
|
||||
|
||||
local autosize = self.autosize
|
||||
local padding = self.padding
|
||||
@ -463,7 +463,7 @@ end
|
||||
- func: SetToolTipFont(font)
|
||||
- desc: sets the height of the tab buttons
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:SetToolTipFont(font)
|
||||
function newobject:SetToolTipFont(font)
|
||||
|
||||
local internals = self.internals
|
||||
|
||||
@ -479,7 +479,7 @@ end
|
||||
- func: GetTabNumber()
|
||||
- desc: gets the object's tab number
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:GetTabNumber()
|
||||
function newobject:GetTabNumber()
|
||||
|
||||
return self.tab
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- text class
|
||||
text = class("text", base)
|
||||
local newobject = loveframes.NewObject("text", "loveframes_object_text", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function text:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "text"
|
||||
self.text = ""
|
||||
@ -35,7 +35,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function text:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
if not self.visible then
|
||||
if not self.alwaysupdate then
|
||||
@ -65,7 +65,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function text:draw()
|
||||
function newobject:draw()
|
||||
|
||||
if not self.visible then
|
||||
return
|
||||
@ -97,7 +97,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -123,7 +123,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetText(t)
|
||||
function newobject:SetText(t)
|
||||
|
||||
local dtype = type(t)
|
||||
local maxw = self.maxw
|
||||
@ -311,7 +311,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function text:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
return self.text
|
||||
|
||||
@ -321,7 +321,7 @@ end
|
||||
- func: GetFormattedText()
|
||||
- desc: gets the object's formatted text
|
||||
--]]---------------------------------------------------------
|
||||
function text:GetFormattedText()
|
||||
function newobject:GetFormattedText()
|
||||
|
||||
return self.formattedtext
|
||||
|
||||
@ -331,7 +331,7 @@ end
|
||||
- func: Format()
|
||||
- desc: formats the text
|
||||
--]]---------------------------------------------------------
|
||||
function text:DrawText()
|
||||
function newobject:DrawText()
|
||||
|
||||
local textdata = self.formattedtext
|
||||
local font = self.font
|
||||
@ -363,7 +363,7 @@ end
|
||||
- func: SetMaxWidth(width)
|
||||
- desc: sets the object's maximum width
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetMaxWidth(width)
|
||||
function newobject:SetMaxWidth(width)
|
||||
|
||||
self.maxw = width
|
||||
self:SetText(self.original)
|
||||
@ -374,7 +374,7 @@ end
|
||||
- func: GetMaxWidth()
|
||||
- desc: gets the object's maximum width
|
||||
--]]---------------------------------------------------------
|
||||
function text:GetMaxWidth()
|
||||
function newobject:GetMaxWidth()
|
||||
|
||||
return self.maxw
|
||||
|
||||
@ -384,7 +384,7 @@ end
|
||||
- func: SetWidth(width)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetWidth(width)
|
||||
function newobject:SetWidth(width)
|
||||
|
||||
self:SetMaxWidth(width)
|
||||
|
||||
@ -394,7 +394,7 @@ end
|
||||
- func: SetHeight()
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetHeight(height)
|
||||
function newobject:SetHeight(height)
|
||||
|
||||
return
|
||||
|
||||
@ -404,7 +404,7 @@ end
|
||||
- func: SetSize()
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetSize(width, height)
|
||||
function newobject:SetSize(width, height)
|
||||
|
||||
self:SetMaxWidth(width)
|
||||
|
||||
@ -415,7 +415,7 @@ end
|
||||
- desc: sets the object's font
|
||||
- note: font argument must be a font object
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetFont(font)
|
||||
function newobject:SetFont(font)
|
||||
|
||||
local original = self.original
|
||||
|
||||
@ -431,7 +431,7 @@ end
|
||||
- func: GetFont()
|
||||
- desc: gets the object's font
|
||||
--]]---------------------------------------------------------
|
||||
function text:GetFont()
|
||||
function newobject:GetFont()
|
||||
|
||||
return self.font
|
||||
|
||||
@ -441,7 +441,7 @@ end
|
||||
- func: GetLines()
|
||||
- desc: gets the number of lines the object's text uses
|
||||
--]]---------------------------------------------------------
|
||||
function text:GetLines()
|
||||
function newobject:GetLines()
|
||||
|
||||
return self.lines
|
||||
|
||||
@ -451,7 +451,7 @@ end
|
||||
- func: SetIgnoreNewlines(bool)
|
||||
- desc: sets whether the object should ignore \n or not
|
||||
--]]---------------------------------------------------------
|
||||
function text:SetIgnoreNewlines(bool)
|
||||
function newobject:SetIgnoreNewlines(bool)
|
||||
|
||||
self.ignorenewlines = bool
|
||||
|
||||
@ -461,7 +461,7 @@ end
|
||||
- func: GetIgnoreNewlines()
|
||||
- desc: gets whether the object should ignore \n or not
|
||||
--]]---------------------------------------------------------
|
||||
function text:GetIgnoreNewlines()
|
||||
function newobject:GetIgnoreNewlines()
|
||||
|
||||
return self.ignorenewlines
|
||||
|
||||
|
@ -4,59 +4,61 @@
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- textinput class
|
||||
textinput = class("textinput", base)
|
||||
local newobject = loveframes.NewObject("textinput", "loveframes_object_textinput", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
|
||||
function textinput:initialize()
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "textinput"
|
||||
self.keydown = "none"
|
||||
self.tabreplacement = " "
|
||||
self.font = loveframes.basicfont
|
||||
self.width = 200
|
||||
self.height = 25
|
||||
self.delay = 0
|
||||
self.offsetx = 0
|
||||
self.offsety = 0
|
||||
self.indincatortime = 0
|
||||
self.indicatornum = 0
|
||||
self.indicatorx = 0
|
||||
self.indicatory = 0
|
||||
self.textx = 0
|
||||
self.texty = 0
|
||||
self.textoffsetx = 5
|
||||
self.textoffsety = 5
|
||||
self.unicode = 0
|
||||
self.limit = 0
|
||||
self.line = 1
|
||||
self.itemwidth = 0
|
||||
self.itemheight = 0
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.rightpadding = 0
|
||||
self.bottompadding = 0
|
||||
self.lastclicktime = 0
|
||||
self.maxx = 0
|
||||
self.usable = {}
|
||||
self.unusable = {}
|
||||
self.lines = {""}
|
||||
self.internals = {}
|
||||
self.showindicator = true
|
||||
self.focus = false
|
||||
self.multiline = false
|
||||
self.vbar = false
|
||||
self.hbar = false
|
||||
self.alltextselected = false
|
||||
self.linenumbers = true
|
||||
self.linenumberspanel = false
|
||||
self.editable = true
|
||||
self.internal = false
|
||||
self.OnEnter = nil
|
||||
self.OnTextChanged = nil
|
||||
self.type = "textinput"
|
||||
self.keydown = "none"
|
||||
self.tabreplacement = " "
|
||||
self.font = loveframes.basicfont
|
||||
self.width = 200
|
||||
self.height = 25
|
||||
self.delay = 0
|
||||
self.offsetx = 0
|
||||
self.offsety = 0
|
||||
self.indincatortime = 0
|
||||
self.indicatornum = 0
|
||||
self.indicatorx = 0
|
||||
self.indicatory = 0
|
||||
self.textx = 0
|
||||
self.texty = 0
|
||||
self.textoffsetx = 5
|
||||
self.textoffsety = 5
|
||||
self.unicode = 0
|
||||
self.limit = 0
|
||||
self.line = 1
|
||||
self.itemwidth = 0
|
||||
self.itemheight = 0
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.rightpadding = 0
|
||||
self.bottompadding = 0
|
||||
self.lastclicktime = 0
|
||||
self.maxx = 0
|
||||
self.buttonscrollamount = 0.10
|
||||
self.mousewheelscrollamount = 5
|
||||
self.usable = {}
|
||||
self.unusable = {}
|
||||
self.lines = {""}
|
||||
self.internals = {}
|
||||
self.showindicator = true
|
||||
self.focus = false
|
||||
self.multiline = false
|
||||
self.vbar = false
|
||||
self.hbar = false
|
||||
self.alltextselected = false
|
||||
self.linenumbers = true
|
||||
self.linenumberspanel = false
|
||||
self.editable = true
|
||||
self.internal = false
|
||||
self.OnEnter = nil
|
||||
self.OnTextChanged = nil
|
||||
|
||||
end
|
||||
|
||||
@ -64,7 +66,7 @@ end
|
||||
- func: update(deltatime)
|
||||
- desc: updates the object
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:update(dt)
|
||||
function newobject:update(dt)
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
@ -156,7 +158,7 @@ function textinput:update(dt)
|
||||
|
||||
if itemheight > height 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
|
||||
table.insert(self.internals, scrollbody)
|
||||
self.vbar = true
|
||||
@ -181,7 +183,7 @@ function textinput:update(dt)
|
||||
|
||||
if itemwidth > width 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
|
||||
table.insert(self.internals, scrollbody)
|
||||
self.hbar = true
|
||||
@ -208,7 +210,7 @@ function textinput:update(dt)
|
||||
|
||||
if self.linenumbers then
|
||||
if not self.linenumberspanel then
|
||||
local linenumberspanel = linenumberspanel:new(self)
|
||||
local linenumberspanel = loveframes.objects["linenumberspanel"]:new(self)
|
||||
table.insert(self.internals, linenumberspanel)
|
||||
self.linenumberspanel = true
|
||||
end
|
||||
@ -235,7 +237,7 @@ end
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:draw()
|
||||
function newobject:draw()
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -289,7 +291,7 @@ end
|
||||
- func: mousepressed(x, y, 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
|
||||
|
||||
@ -302,6 +304,7 @@ function textinput:mousepressed(x, y, button)
|
||||
local internals = self.internals
|
||||
local vbar = self.vbar
|
||||
local hbar = self.hbar
|
||||
local scrollamount = self.mousewheelscrollamount
|
||||
|
||||
if hover and button == "l" then
|
||||
|
||||
@ -336,24 +339,24 @@ function textinput:mousepressed(x, y, button)
|
||||
if button == "wu" then
|
||||
if vbar and not hbar then
|
||||
local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
|
||||
vbar:Scroll(-5)
|
||||
vbar:Scroll(-scrollamount)
|
||||
elseif vbar and hbar then
|
||||
local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
|
||||
vbar:Scroll(-5)
|
||||
vbar:Scroll(-scrollamount)
|
||||
elseif not vbar and hbar then
|
||||
local hbar = self:GetHorizontalScrollBody().internals[1].internals[1]
|
||||
hbar:Scroll(-5)
|
||||
hbar:Scroll(-scrollamount)
|
||||
end
|
||||
elseif button == "wd" then
|
||||
if vbar and not hbar then
|
||||
local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
|
||||
vbar:Scroll(5)
|
||||
vbar:Scroll(scrollamount)
|
||||
elseif vbar and hbar then
|
||||
local vbar = self:GetVerticalScrollBody().internals[1].internals[1]
|
||||
vbar:Scroll(5)
|
||||
vbar:Scroll(scrollamount)
|
||||
elseif not vbar and hbar then
|
||||
local hbar = self:GetHorizontalScrollBody().internals[1].internals[1]
|
||||
hbar:Scroll(5)
|
||||
hbar:Scroll(scrollamount)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -368,7 +371,7 @@ end
|
||||
- func: mousereleased(x, y, 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
|
||||
|
||||
@ -388,7 +391,7 @@ end
|
||||
- func: keypressed(key)
|
||||
- desc: called when the player presses a key
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:keypressed(key, unicode)
|
||||
function newobject:keypressed(key, unicode)
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -418,7 +421,7 @@ end
|
||||
- func: keyreleased(key)
|
||||
- desc: called when the player releases a key
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:keyreleased(key)
|
||||
function newobject:keyreleased(key)
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
@ -434,7 +437,7 @@ end
|
||||
- func: RunKey(key, unicode)
|
||||
- desc: runs a key event on the object
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:RunKey(key, unicode)
|
||||
function newobject:RunKey(key, unicode)
|
||||
|
||||
local visible = self.visible
|
||||
local focus = self.focus
|
||||
@ -730,7 +733,7 @@ end
|
||||
- func: MoveIndicator(num, exact)
|
||||
- desc: moves the object's indicator
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:MoveIndicator(num, exact)
|
||||
function newobject:MoveIndicator(num, exact)
|
||||
|
||||
local lines = self.lines
|
||||
local line = self.line
|
||||
@ -761,7 +764,7 @@ end
|
||||
- desc: updates the object's text insertion position
|
||||
indicator
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:UpdateIndicator()
|
||||
function newobject:UpdateIndicator()
|
||||
|
||||
local time = love.timer.getTime()
|
||||
local indincatortime = self.indincatortime
|
||||
@ -808,7 +811,7 @@ end
|
||||
- desc: adds text into the object's text a given
|
||||
position
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:AddIntoText(t, p)
|
||||
function newobject:AddIntoText(t, p)
|
||||
|
||||
local lines = self.lines
|
||||
local line = self.line
|
||||
@ -827,7 +830,7 @@ end
|
||||
- desc: removes text from the object's text a given
|
||||
position
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:RemoveFromeText(p)
|
||||
function newobject:RemoveFromeText(p)
|
||||
|
||||
local lines = self.lines
|
||||
local line = self.line
|
||||
@ -846,7 +849,7 @@ end
|
||||
- func: GetTextCollisions(x, y)
|
||||
- desc: gets text collisions with the mouse
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetTextCollisions(x, y)
|
||||
function newobject:GetTextCollisions(x, y)
|
||||
|
||||
local font = self.font
|
||||
local lines = self.lines
|
||||
@ -957,7 +960,7 @@ end
|
||||
- func: PositionText()
|
||||
- desc: positions the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:PositionText()
|
||||
function newobject:PositionText()
|
||||
|
||||
local multiline = self.multiline
|
||||
local x = self.x
|
||||
@ -988,7 +991,7 @@ end
|
||||
- func: SetTextOffsetX(num)
|
||||
- desc: sets the object's text x offset
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetTextOffsetX(num)
|
||||
function newobject:SetTextOffsetX(num)
|
||||
|
||||
self.textoffsetx = num
|
||||
|
||||
@ -998,7 +1001,7 @@ end
|
||||
- func: SetTextOffsetY(num)
|
||||
- desc: sets the object's text y offset
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetTextOffsetY(num)
|
||||
function newobject:SetTextOffsetY(num)
|
||||
|
||||
self.textoffsety = num
|
||||
|
||||
@ -1008,7 +1011,7 @@ end
|
||||
- func: SetFont(font)
|
||||
- desc: sets the object's font
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetFont(font)
|
||||
function newobject:SetFont(font)
|
||||
|
||||
self.font = font
|
||||
|
||||
@ -1018,7 +1021,7 @@ end
|
||||
- func: GetFont()
|
||||
- desc: gets the object's font
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetFont()
|
||||
function newobject:GetFont()
|
||||
|
||||
return self.font
|
||||
|
||||
@ -1028,7 +1031,7 @@ end
|
||||
- func: SetFocus(focus)
|
||||
- desc: sets the object's focus
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetFocus(focus)
|
||||
function newobject:SetFocus(focus)
|
||||
|
||||
self.focus = focus
|
||||
|
||||
@ -1038,7 +1041,7 @@ end
|
||||
- func: GetFocus()
|
||||
- desc: gets the object's focus
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetFocus()
|
||||
function newobject:GetFocus()
|
||||
|
||||
return self.focus
|
||||
|
||||
@ -1048,7 +1051,7 @@ end
|
||||
- func: GetIndicatorVisibility()
|
||||
- desc: gets the object's indicator visibility
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetIndicatorVisibility()
|
||||
function newobject:GetIndicatorVisibility()
|
||||
|
||||
return self.showindicator
|
||||
|
||||
@ -1058,7 +1061,7 @@ end
|
||||
- func: SetLimit(limit)
|
||||
- desc: sets the object's text limit
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetLimit(limit)
|
||||
function newobject:SetLimit(limit)
|
||||
|
||||
self.limit = limit
|
||||
|
||||
@ -1069,7 +1072,7 @@ end
|
||||
- desc: sets what characters can be used for the
|
||||
object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetUsable(usable)
|
||||
function newobject:SetUsable(usable)
|
||||
|
||||
self.usable = usable
|
||||
|
||||
@ -1080,7 +1083,7 @@ end
|
||||
- desc: gets what characters can be used for the
|
||||
object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetUsable()
|
||||
function newobject:GetUsable()
|
||||
|
||||
return self.usable
|
||||
|
||||
@ -1091,7 +1094,7 @@ end
|
||||
- desc: sets what characters can not be used for the
|
||||
object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetUnusable(unusable)
|
||||
function newobject:SetUnusable(unusable)
|
||||
|
||||
self.unusable = unusable
|
||||
|
||||
@ -1102,7 +1105,7 @@ end
|
||||
- desc: gets what characters can not be used for the
|
||||
object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetUnusable()
|
||||
function newobject:GetUnusable()
|
||||
|
||||
return self.unusable
|
||||
|
||||
@ -1112,7 +1115,7 @@ end
|
||||
- func: Clear()
|
||||
- desc: clears the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:Clear()
|
||||
function newobject:Clear()
|
||||
|
||||
self.lines = {""}
|
||||
self.line = 1
|
||||
@ -1126,7 +1129,7 @@ end
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetText(text)
|
||||
function newobject:SetText(text)
|
||||
|
||||
local tabreplacement = self.tabreplacement
|
||||
local multiline = self.multiline
|
||||
@ -1158,7 +1161,7 @@ end
|
||||
- func: GetText()
|
||||
- desc: gets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetText()
|
||||
function newobject:GetText()
|
||||
|
||||
local multiline = self.multiline
|
||||
local lines = self.lines
|
||||
@ -1181,7 +1184,7 @@ end
|
||||
- desc: enables or disables allowing multiple lines for
|
||||
text entry
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetMultiline(bool)
|
||||
function newobject:SetMultiline(bool)
|
||||
|
||||
local text = ""
|
||||
local lines = self.lines
|
||||
@ -1208,7 +1211,7 @@ end
|
||||
- desc: gets whether or not the object is using multiple
|
||||
lines
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetMultiLine()
|
||||
function newobject:GetMultiLine()
|
||||
|
||||
return self.multiline
|
||||
|
||||
@ -1218,7 +1221,7 @@ end
|
||||
- func: GetVerticalScrollBody()
|
||||
- desc: gets the object's vertical scroll body
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetVerticalScrollBody()
|
||||
function newobject:GetVerticalScrollBody()
|
||||
|
||||
local vbar = self.vbar
|
||||
local internals = self.internals
|
||||
@ -1240,7 +1243,7 @@ end
|
||||
- func: GetHorizontalScrollBody()
|
||||
- desc: gets the object's horizontal scroll body
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetHorizontalScrollBody()
|
||||
function newobject:GetHorizontalScrollBody()
|
||||
|
||||
local hbar = self.hbar
|
||||
local internals = self.internals
|
||||
@ -1263,7 +1266,7 @@ end
|
||||
- desc: gets whether or not the object has a vertical
|
||||
scroll bar
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:HasVerticalScrollBar()
|
||||
function newobject:HasVerticalScrollBar()
|
||||
|
||||
return self.vbar
|
||||
|
||||
@ -1274,7 +1277,7 @@ end
|
||||
- desc: gets whether or not the object has a horizontal
|
||||
scroll bar
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:HasHorizontalScrollBar()
|
||||
function newobject:HasHorizontalScrollBar()
|
||||
|
||||
return self.hbar
|
||||
|
||||
@ -1284,7 +1287,7 @@ end
|
||||
- func: GetLineNumbersPanel()
|
||||
- desc: gets the object's line numbers panel
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetLineNumbersPanel()
|
||||
function newobject:GetLineNumbersPanel()
|
||||
|
||||
local panel = self.linenumberspanel
|
||||
local internals = self.internals
|
||||
@ -1307,7 +1310,7 @@ end
|
||||
- desc: sets whether or not to show line numbers when
|
||||
using multiple lines
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:ShowLineNumbers(bool)
|
||||
function newobject:ShowLineNumbers(bool)
|
||||
|
||||
local multiline = self.multiline
|
||||
|
||||
@ -1321,7 +1324,7 @@ end
|
||||
- func: GetTextX()
|
||||
- desc: gets the object's text x
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetTextX()
|
||||
function newobject:GetTextX()
|
||||
|
||||
return self.textx
|
||||
|
||||
@ -1331,7 +1334,7 @@ end
|
||||
- func: GetTextY()
|
||||
- desc: gets the object's text y
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetTextY()
|
||||
function newobject:GetTextY()
|
||||
|
||||
return self.texty
|
||||
|
||||
@ -1342,7 +1345,7 @@ end
|
||||
- desc: gets whether or not all of the object's text is
|
||||
selected
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:IsAllTextSelected()
|
||||
function newobject:IsAllTextSelected()
|
||||
|
||||
return self.alltextselected
|
||||
|
||||
@ -1352,7 +1355,7 @@ end
|
||||
- func: GetLines()
|
||||
- desc: gets the object's lines
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetLines()
|
||||
function newobject:GetLines()
|
||||
|
||||
return self.lines
|
||||
|
||||
@ -1362,7 +1365,7 @@ end
|
||||
- func: GetOffsetX()
|
||||
- desc: gets the object's x offset
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetOffsetX()
|
||||
function newobject:GetOffsetX()
|
||||
|
||||
return self.offsetx
|
||||
|
||||
@ -1372,7 +1375,7 @@ end
|
||||
- func: GetOffsetY()
|
||||
- desc: gets the object's y offset
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetOffsetY()
|
||||
function newobject:GetOffsetY()
|
||||
|
||||
return self.offsety
|
||||
|
||||
@ -1382,7 +1385,7 @@ end
|
||||
- func: GetIndicatorX()
|
||||
- desc: gets the object's indicator's xpos
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetIndicatorX()
|
||||
function newobject:GetIndicatorX()
|
||||
|
||||
return self.indicatorx
|
||||
|
||||
@ -1392,7 +1395,7 @@ end
|
||||
- func: GetIndicatorY()
|
||||
- desc: gets the object's indicator's ypos
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetIndicatorY()
|
||||
function newobject:GetIndicatorY()
|
||||
|
||||
return self.indicatory
|
||||
|
||||
@ -1403,7 +1406,7 @@ end
|
||||
- desc: gets whether line numbers are enabled on the
|
||||
object or not
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetLineNumbersEnabled()
|
||||
function newobject:GetLineNumbersEnabled()
|
||||
|
||||
return self.linenumbers
|
||||
|
||||
@ -1413,7 +1416,7 @@ end
|
||||
- func: GetItemWidth()
|
||||
- desc: gets the object's item width
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetItemWidth()
|
||||
function newobject:GetItemWidth()
|
||||
|
||||
return self.itemwidth
|
||||
|
||||
@ -1423,7 +1426,7 @@ end
|
||||
- func: GetItemHeight()
|
||||
- desc: gets the object's item height
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetItemHeight()
|
||||
function newobject:GetItemHeight()
|
||||
|
||||
return self.itemheight
|
||||
|
||||
@ -1433,7 +1436,7 @@ end
|
||||
- func: SetTabReplacement(tabreplacement)
|
||||
- desc: sets a string to replace tabs with
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetTabReplacement(tabreplacement)
|
||||
function newobject:SetTabReplacement(tabreplacement)
|
||||
|
||||
self.tabreplacement = tabreplacement
|
||||
|
||||
@ -1443,7 +1446,7 @@ end
|
||||
- func: GetTabReplacement()
|
||||
- desc: gets the object's tab replacement
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetTabReplacement()
|
||||
function newobject:GetTabReplacement()
|
||||
|
||||
return self.tabreplacement
|
||||
|
||||
@ -1454,7 +1457,7 @@ end
|
||||
- desc: sets whether or not the user can edit the
|
||||
object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:SetEditable(bool)
|
||||
function newobject:SetEditable(bool)
|
||||
|
||||
self.editable = bool
|
||||
|
||||
@ -1465,8 +1468,50 @@ end
|
||||
- desc: gets whether or not the user can edit the
|
||||
object's text
|
||||
--]]---------------------------------------------------------
|
||||
function textinput:GetEditable()
|
||||
function newobject:GetEditable()
|
||||
|
||||
return self.editable
|
||||
|
||||
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
|
@ -2,7 +2,7 @@
|
||||
|
||||
## 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
|
||||
|
||||
|
@ -20,7 +20,7 @@ skin.controls = {}
|
||||
|
||||
-- frame
|
||||
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_name_color = {255, 255, 255, 255}
|
||||
skin.controls.frame_name_font = smallfont
|
||||
@ -399,8 +399,10 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local staticx = object:GetStaticX()
|
||||
local width = object:GetWidth()
|
||||
local height = object:GetHeight()
|
||||
local parentwidth = object.parent:GetWidth()
|
||||
local index = loveframes.config["ACTIVESKIN"]
|
||||
local font = skin.controls.button_text_font
|
||||
local twidth = font:getWidth("X")
|
||||
@ -433,6 +435,10 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
end
|
||||
|
||||
if staticx ~= (parentwidth - 20) then
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -20,7 +20,7 @@ skin.controls = {}
|
||||
|
||||
-- frame
|
||||
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_name_color = {255, 255, 255, 255}
|
||||
skin.controls.frame_name_font = smallfont
|
||||
@ -399,8 +399,10 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local staticx = object:GetStaticX()
|
||||
local width = object:GetWidth()
|
||||
local height = object:GetHeight()
|
||||
local parentwidth = object.parent:GetWidth()
|
||||
local index = loveframes.config["ACTIVESKIN"]
|
||||
local font = skin.controls.button_text_font
|
||||
local twidth = font:getWidth("X")
|
||||
@ -433,6 +435,10 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
end
|
||||
|
||||
if staticx ~= (parentwidth - 20) then
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -86,7 +86,8 @@ function loveframes.templates.Register(template)
|
||||
local registeredobjects = loveframes.templates.objects
|
||||
local name = template.name
|
||||
local properties = template.properties
|
||||
local objects = template.objects
|
||||
local objects = loveframes.objects
|
||||
local base = objects["base"]
|
||||
local found = false
|
||||
local foundall = false
|
||||
|
||||
@ -96,7 +97,7 @@ function loveframes.templates.Register(template)
|
||||
end
|
||||
|
||||
if name == "Base" then
|
||||
_G["base"]:include(template.properties["*"])
|
||||
base:include(template.properties["*"])
|
||||
end
|
||||
|
||||
-- insert the template into the available templates table
|
||||
|
Loading…
Reference in New Issue
Block a user