3.8 KiB
3.8 KiB
API
JUI methods:
parent(UIBase parent, UIBase child)
unparent(UIBase parent, UIBase child)
JUI enums:
TextXAlign
LEFT
RIGHT
CENTER
TextYAlign
TOP
BOTTOM
CENTER
UIBase class
This class is abstracted and exists only for inheritance.
Constructor(s):
UIBase:new() -- Unless otherwise specified, all UIBase object constructors take no arguments.
Methods:
keypressPass(string key) -- use with love.keypressed function
textinputPass(string t) -- use with love.textinput function
render()
update(number deltatime) -- deltatime should be passed from love.update function
table<UIBase> getChildren()
UIBase getChild(string childName)
UIBase getParent()
string getName() -- name defaults to 16-character random string
setName(string name)
JUIScene class
Inherits UIBase
Methods:
Vector2D getAbsolutePosition() -- Always returns a Vector2D with 0, 0
Vector2D getAbsoluteSize() -- Always returns a Vector2D with the viewport pixel size
UIRect class
Inherits UIBase
This class is abstracted and exists only for inheritance.
Methods:
Color getBackgroundColor()
Color getBorderColor()
number getCornerRounding()
number getBackgroundTransparency()
number getBorderTransparency()
Dimension getPosition()
Dimension getSize()
Vector2D getAbsolutePosition() -- returns the real position of the object, in pixels
Vector2D getAbsoluteSize() -- returns the real size of the object, in pixels
boolean isMouseInside()
setBackgroundColor(Color color)
setBorderColor(Color color)
setCornerRounding(number rounding)
setPosition(Dimension pos)
setSize(Dimension size)
setBackgroundTransparency(number alpha)
setBorderTransparency(number alpha)
Events:
mouseEnter()
mouseExit()
Frame class
Inherits UIRect
Label class
Inherits UIRect
Methods:
string getFontFace()
string getText()
number getTextSize()
string, string getTextAlignment()
setFontFace(string fontFile)
setText(string text)
setTextSize(number size)
setTextAlignment(string xAlignment, string yAlignment)
UIButton class
Inherits UIRect
This class is abstracted and exists only for inheritance.
Events:
mouseClickDown()
mouseClickUp()
pressed()
released()
cancelled()
Button class
Inherits UIButton and Label
Slider class
Inherits UIButton
Methods:
number, number getValueRange()
number getValueIncrement()
number getValue()
setValueRange(number min, number max)
setValueIncrement(number inc)
setValue(number val)
Events:
valueChanged(number newValue)
Event class
Events provide a way for listeners, user-defined functions, to be called when certain things happen with JUI objects. When an event is "connected", the function given will be called whenever this event is fired by JUI.
Methods:
number connect(function newConnection) -- returns a listenerID
disconnect(number listenerID) -- disconnect the listener using the listenerID
Dimension datatype
Constructor:
Dimension:new(number xScale, number yScale, number xPixel = 0, number yPixel = 0)
Methods:
number, number getScaleXY()
number, number getPixelXY()
number, number, number, number getComponents()
Operators:
Dimension + Dimension
Dimension - Dimension
Vector2D datatype
Constructor:
Vector2D:new(number x, number y)
Color datatype
Represents color values.
Constructors:
Color:new() -- will default to fully black
Color:new(number red, number green, number blue, number alpha = 1) -- 0-1 double range
Color:fromRGB(number red, number green, number blue, number alpha = 255) -- 0-255 integer range
Color:fromHex(string HexColor, number alpha = 255) -- takes hexadecimal color codes
Color:fromHSL(number hue, number saturation, number lightness, number alpha = 255) -- HSL color