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 (The) | Loads elements, skins, extensions from a specified path. |
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() . |
wheelmoved (x, y) | Event handler for love.wheelmoved() |
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?
checking element against pop.screen so that this only gets called once |
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), |
textinput-todo4 | document pop.import |
textinput-todo4-todo5 | document pop.export |
printElementTree-todo6 | Write debugInfo things for elements. |
Functions
- load (The)
-
Loads elements, skins, extensions from a specified path. Initializes
pop.screen
on first call.Automatically called when you require Pop.Box for its internals. Subsequent calls can be used to add more elements/skins/extensions.
Parameters:
- The string[opt] path to load from. Within this path should be elements, skins, and extensions directories, containing whatever items you want to load.
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:
- wheelmoved (x, y)
-
Event handler for
love.wheelmoved()
Parameters:
- x number The distance the wheel moved on the x-axis.
- y number The distance the wheel moved on the y-axis.
Returns:
-
boolean
Was the event handled?
- 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:
- For constants now, just stores values to be used with mouse clicks for compatibility with differing LOVE versions.
- 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). - hovered
Element or false
The GUI element the mouse is hovering over
(or
false
if none is hovered over).
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? checking element against pop.screen so that this only gets called once - 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),
- textinput-todo4
- document pop.import
- textinput-todo4-todo5
- document pop.export
- printElementTree-todo6
- Write debugInfo things for elements.