Module pop
The Pop.Box GUI itself.
Info:
- Copyright: Paul Liverman III (2015-2016)
- Release: 0.0.0
- License: The MIT License (MIT)
Functions
load () | Loads elements, skins, extensions, and initializes pop.screen . |
create (element, parent, ...) | Creates an element. |
update (dt, element) | Event handler for love.update() . |
draw (element) | Event handler for love.draw() . |
mousemoved (x, y, dx, dy) | Event handler for love.mousemoved() . |
mousepressed (x, y, button, element) | Event handler for love.mousepressed() . |
mousereleased (x, y, button, element) | Event handler for love.mousereleased() . |
keypressed (key) | Event handler for love.keypressed() . |
keyreleased (key) | Event handler for love.keyreleased() . |
textinput (text) | Event handler for love.textinput() . |
skin (element, skin, depth) | Applies skins to elements. |
debugDraw (element) | Draws simple rectangle outlines to debug placement of elements. |
printElementTree (element) | Prints a basic structure of GUI elements with minimal info. |
Tables
pop |
Functions
- load ()
-
Loads elements, skins, extensions, and initializes
pop.screen
.IMPORTANT: Intended to only be called once, and is automatically called when you require Pop.Box.
See also:
- create (element, parent, ...)
-
Creates an element.
Parameters:
- element A string naming the element class to use.
- parent
[opt] The parent element. If
false
, an element is created with no parent. Ifnil
, defaults topop.screen
. - ...
[opt] Any number of parameters can be passed to the constructor for the element.
(Note: An element with no parent will not be handled by Pop.Box's event handlers unless you handle it explicitly.)
See also:
- update (dt, element)
-
Event handler for
love.update()
.Parameters:
- dt The amount of time passed since the last call to update, in seconds.
- element
[opt] The element to update (will update all its children as well). Defaults to
pop.screen
.
- draw (element)
-
Event handler for
love.draw()
.Parameters:
- element
[opt] The element to draw (will draw all its children as well). Defaults to
pop.screen
.
- element
[opt] The element to draw (will draw all its children as well). Defaults to
- mousemoved (x, y, dx, dy)
-
Event handler for
love.mousemoved()
. (*LÖVE >= 0.10.0*)Parameters:
- x The x coordinate of the mouse.
- y The y coordinate of the mouse.
- dx The distance on the x axis the mouse was moved.
- dy The distance on the y axis the mouse was moved.
Returns:
true
/false
: Was the event handled? - mousepressed (x, y, button, element)
-
Event handler for
love.mousepressed()
.Parameters:
- x The x coordinate of the mouse press.
- y The y coordinate of the mouse press.
- button The mouse button pressed.
- element
[opt] The element to check for event handling (will check its children as well). Defaults to
pop.screen
.
Returns:
true
/false
: Was the event handled? - mousereleased (x, y, button, element)
-
Event handler for
love.mousereleased()
.Parameters:
- x The x coordinate of the mouse release.
- y The y coordinate of the mouse release.
- button The mouse button released.
- element
[opt] The element to check for event handling (will check its children as well). Defaults to
pop.screen
.
Returns:
-
true
/false
: Was a click handled? -
true
/false
: Was a mouse release handled?
- keypressed (key)
-
Event handler for
love.keypressed()
.Parameters:
- key The key that was pressed.
Returns:
true
/false
: Was the event handled? - keyreleased (key)
-
Event handler for
love.keyreleased()
.Parameters:
- key The key that was released.
Returns:
true
/false
: Was the event handled? - textinput (text)
-
Event handler for
love.textinput()
.Parameters:
- text The text that was typed.
Returns:
true
/false
: Was the text input handled? - skin (element, skin, depth)
-
Applies skins to elements. (NOTE: This function will be rewritten and change at some point...)
Parameters:
- element
The element to skin (will also be applied to children). Defaults to
pop.screen
. - skin The skin to use, can be a string or an actual skin object, defaults to the default skin included with Pop.Box.
- depth
[opt] An integer for how many child levels to skin, OR, if
true
, will skin all children.
- element
The element to skin (will also be applied to children). Defaults to
- debugDraw (element)
-
Draws simple rectangle outlines to debug placement of elements.
Parameters:
- element
The element to draw (will draw its children as well). Defaults to
pop.screen
.
- element
The element to draw (will draw its children as well). Defaults to
- printElementTree (element)
-
Prints a basic structure of GUI elements with minimal info.
Parameters:
- element
The element to start at. Defaults to
pop.screen
.
- element
The element to start at. Defaults to
Tables
- pop
-
Fields:
- elements All GUI classes are stored here.
- skins All skins are stored here.
- extensions All extensions are loaded here.
- screen
The top level GUI element. Represents the game screen. Initialized in
pop.load()
- focused
The currently focused GUI element (or
false
if none is focused).
See also: