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() . |
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 |
Issues
update-todo1 | Define Elements and @ see that documentation from here. Generic documentation, not specifically element! data.update boolean controls an element and its children being updated |
mousemoved-todo2 | Implement a way for an element to attach itself to love.mousemoved() events? |
mousereleased-todo3 | Figure out how to bring a focused element to the front of view (aka the first element in its parent's children). (If I do it right here, the for loop above may break! I need to test/figure this out.) NOTE this might cause an error in the above for loop! basically, move focused element to front of its parent's child element.parent\focusChild element table.insert element.parent, element.parent\removeChild(element), |
printElementTree-todo4 | Correct this once elements are reimplemented if it needs correction. |
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 string The element class to use.
- parent
Element, false or nil
[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 number The amount of time passed since the last call to update, in seconds.
- element
Element
[opt] The element to update (will update all its
children as well). Defaults to
pop.screen
.
See also:
- draw (element)
-
Event handler for
love.draw()
.Parameters:
- element
Element
[opt] The element to draw (will draw all its children
as well). Defaults to
pop.screen
.
See also:
- element
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 integer The x coordinate of the mouse.
- y integer The y coordinate of the mouse.
- dx number The distance on the x axis the mouse was moved.
- dy number The distance on the y axis the mouse was moved.
Returns:
-
boolean
Was the event handled?
- mousepressed (x, y, button, element)
-
Event handler for
love.mousepressed()
.Parameters:
- x integer The x coordinate of the mouse press.
- y integer The y coordinate of the mouse press.
- button string or integer The mouse button pressed. (Type varies by LÖVE version.)
- element
Element
[opt] The element to check for event handling (will
check its children as well). Defaults to
pop.screen
.
Returns:
-
boolean
Was the event handled?
See also:
- mousereleased (x, y, button, element)
-
Event handler for
love.mousereleased()
.Parameters:
- x integer The x coordinate of the mouse release.
- y integer The y coordinate of the mouse release.
- button string or integer The mouse button released. (Type varies by LÖVE version.)
- element
Element
[opt] The element to check for event handling (will
check its children as well). Defaults to
pop.screen
.
Returns:
- boolean Was a click handled?
- boolean Was a mouse release handled?
See also:
- keypressed (key)
-
Event handler for
love.keypressed()
.Parameters:
- key string The key that was pressed.
Returns:
-
boolean
Was the event handled?
- keyreleased (key)
-
Event handler for
love.keyreleased()
.Parameters:
- key string The key that was released.
Returns:
-
boolean
Was the event handled?
- textinput (text)
-
Event handler for
love.textinput()
.Parameters:
- text string The text that was typed.
Returns:
-
boolean
Was the text input handled?
- debugDraw (element)
-
Draws simple rectangle outlines to debug placement of elements.
Parameters:
- element
Element
[opt] The element to draw (will draw its children as
well). Defaults to
pop.screen
.
See also:
- element
Element
[opt] 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
Element
[opt] The element to start at. Defaults to
pop.screen
.
See also:
- element
Element
[opt] The element to start at. Defaults to
Tables
- pop
-
Fields:
- elements table All GUI classes are stored here.
- skins table All skins are stored here.
- extensions table All extensions are loaded here.
- screen
Element
The top level GUI element. Represents the game
screen. Initialized in
pop.load()
- focused
Element or false
The currently focused GUI element (or
false
if none is focused).
See also:
Issues
- update-todo1
- Define Elements and @ see that documentation from here. Generic documentation, not specifically element! data.update boolean controls an element and its children being updated
- mousemoved-todo2
-
Implement a way for an element to attach itself to
love.mousemoved()
events? - mousereleased-todo3
- Figure out how to bring a focused element to the front of view (aka the first element in its parent's children). (If I do it right here, the for loop above may break! I need to test/figure this out.) NOTE this might cause an error in the above for loop! basically, move focused element to front of its parent's child element.parent\focusChild element table.insert element.parent, element.parent\removeChild(element),
- printElementTree-todo4
- Correct this once elements are reimplemented if it needs correction.