-
Notifications
You must be signed in to change notification settings - Fork 15
(API) Numberbox
The numberbox
object allows the user to input a number into a textinput. It also comes with two buttons for increasing or decreasing the number.
function love.load()
loveframes = require("loveframes")
local numberbox = loveframes.Create("numberbox")
numberbox:SetPos(5, 5)
numberbox:SetSize(200, 25)
end
function love.update(dt)
loveframes.update(dt)
end
function love.draw()
loveframes.draw()
end
function love.mousepressed(x, y, button)
loveframes.mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
loveframes.mousereleased(x, y, button)
end
Called every time the object's calue changes
Arguments passed: self [object], value [number]
local numberbox = loveframes.Create("numberbox")
numberbox.OnValueChanged = function(object, value)
print("The object's new value is " ..value)
end
Sets the object's value
object:SetValue(value[number])
Gets the object's value
Returns 1 value: value [number]
local value = object:GetValue()
Sets the object's increase amount
object:SetIncreaseAmount(amount[number])
Gets the object's increase amount
Returns 1 value: increaseamount [number]
local increaseamount = object:GetIncreaseAmount()
Sets the object's decrease amount
object:SetDecreaseAmount(amount[number])
Gets the object's decrease amount
Returns 1 value: decreaseamount [number]
local decreaseamount = object:GetDecreaseAmount()
Sets the object's maximum value
object:SetMax(max[number])
Gets the object's maximum value
Returns 1 value: max [number]
local max = object:GetMax()
Sets the object's minimum value
object:SetMin(min[number])
Gets the object's minimum value
Returns 1 value: min [number]
local min = object:GetMin()
Sets the object's minimum and maximum values
object:SetMinMax(min[number], max[number])
Gets the object's minimum and maximum values
Returns 2 values: minimum [number], maximum [number]
local min, max = object:GetMinMax(min[number], max[number])
Modifies the object's value
Note: This method is used by the object internally. You should not use it unless you know what you are doing.
object:ModifyValue(type[string])