more wip documenting

This commit is contained in:
Paul Liverman III 2016-06-21 00:58:08 -07:00
parent 165ec05baf
commit 3586d2d11c

View File

@ -136,7 +136,7 @@ pop.create = (element, parent=pop.screen, ...) ->
--- Event handler for `love.update()` events. --- Event handler for `love.update()`.
--- @function update --- @function update
--- @param dt The amount of time passed since the last call to update, in seconds. --- @param dt The amount of time passed since the last call to update, in seconds.
--- @param element *Optional* The element to update. Defaults to `pop.screen` (and loops through all its children). --- @param element *Optional* The element to update. Defaults to `pop.screen` (and loops through all its children).
@ -152,7 +152,7 @@ pop.update = (dt, element=pop.screen) ->
--- Event handler for `love.draw()` events. --- Event handler for `love.draw()`.
--- @function draw --- @function draw
--- @param element *Optional* The element to draw. Defaults to `pop.screen` (and loops through all its children). --- @param element *Optional* The element to draw. Defaults to `pop.screen` (and loops through all its children).
--- @todo @see Elements --- @todo @see Elements
@ -167,7 +167,7 @@ pop.draw = (element=pop.screen) ->
--- Event handler for `love.mousemoved()` events. (*LÖVE >= 0.10.0*) --- Event handler for `love.mousemoved()`. (*LÖVE >= 0.10.0*)
--- @function mousemoved --- @function mousemoved
--- @param x The x coordinate of the mouse. --- @param x The x coordinate of the mouse.
--- @param y The y coordinate of the mouse. --- @param y The y coordinate of the mouse.
@ -184,7 +184,7 @@ pop.mousemoved = (x, y, dx, dy) ->
--- Event handler for `love.mousepressed()` events. --- Event handler for `love.mousepressed()`.
--- @function mousepressed --- @function mousepressed
--- @param x The x coordinate of the mouse press. --- @param x The x coordinate of the mouse press.
--- @param y The y coordinate of the mouse press. --- @param y The y coordinate of the mouse press.
@ -220,7 +220,7 @@ pop.mousepressed = (x, y, button, element) ->
--- Event handler for `love.mousereleased()` events. --- Event handler for `love.mousereleased()`.
--- @function mousereleased --- @function mousereleased
--- @param x The x coordinate of the mouse release. --- @param x The x coordinate of the mouse release.
--- @param y The y coordinate of the mouse release. --- @param y The y coordinate of the mouse release.
@ -268,16 +268,30 @@ pop.mousereleased = (x, y, button, element) ->
return clickedHandled, mousereleasedHandled return clickedHandled, mousereleasedHandled
--- Event handler for `love.keypressed()`.
--- @function keypressed
--- @param key The key that was pressed.
--- @return `true` / `false`: Was the event handled?
pop.keypressed = (key) -> pop.keypressed = (key) ->
print "keypressed", key print "keypressed", key
-- keypressed events must be on visible elements -- keypressed events must be on visible elements
element = pop.focused element = pop.focused
if element and element.keypressed and (not element.excludeDraw) if element and element.keypressed and element.data.draw
return element.keypressed key return element.keypressed key
return false return false
--- Event handler for `love.keyreleased()`.
--- @function keyreleased
--- @param key The key that was released.
--- @return `true` / `false`: Was the event handled?
pop.keyreleased = (key) -> pop.keyreleased = (key) ->
print "keyreleased", key print "keyreleased", key
@ -288,16 +302,31 @@ pop.keyreleased = (key) ->
return false return false
--- Event handler for `love.textinput()`.
--- @function textinput
--- @param text The text that was typed.
--- @return `true` / `false`: Was the text input handled?
pop.textinput = (text) -> pop.textinput = (text) ->
print "textinput", text print "textinput", text
-- textinput events must be on visible elements -- textinput events must be on visible elements
element = pop.focused element = pop.focused
if element and element.textinput and (not element.excludeDraw) if element and element.textinput and element.data.draw
return element.textinput text return element.textinput text
return false return false
--- Applies skins to elements. (**NOTE^*: This function will be rewritten and change at some point...)
--- @function skin
--- @param element The element to skin. Defaults to `pop.screen` (and loops through all its children).
--- @param skin The skin to use, can be a string or an actual skin object, defaults to a default skin that is part of Pop.Box.
--- @param depth Can be an integer for how many levels to go skinning. Alternately, if `true`, will skin all children.
--TODO rewrite skin system to not rely on knowing internals of elements, --TODO rewrite skin system to not rely on knowing internals of elements,
-- instead call functions like setColor and setBackground -- instead call functions like setColor and setBackground
-- skins an element (and its children unless depth == true or 0) -- skins an element (and its children unless depth == true or 0)