mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
lots of docs n stuff woo!
This commit is contained in:
parent
2ba0839ed8
commit
37a2cc125b
150
Element.luadoc
Normal file
150
Element.luadoc
Normal file
@ -0,0 +1,150 @@
|
||||
--- This is a description of what is expected in an element class.
|
||||
---
|
||||
--- **IMPORTANT**: Your class should inherit from *the* element class. This
|
||||
--- means that any methods defined on that class need to be compatible with or
|
||||
--- overridden by your class!
|
||||
--- @see element
|
||||
|
||||
|
||||
|
||||
--- **Optional**: Called during `pop.load()` with a reference to Pop.Box.
|
||||
--- @function load
|
||||
--- @tparam module pop The Pop.Box module.
|
||||
|
||||
--- **Optional**: Called during `pop.load()` to allow a custom wrapper function
|
||||
--- to be created for your element class.
|
||||
--- @function wrap
|
||||
--- @tparam module pop The Pop.Box module.
|
||||
--- @treturn function wrapper A function to be called to create an element of
|
||||
--- this class instead of using `pop.create()`.
|
||||
|
||||
--- **Optional**: Called from `pop.update()` if `data.update` and a child of
|
||||
--- `pop.screen`. Use it for any time-based updates your element may need.
|
||||
--- @function update
|
||||
--- @tparam number dt The amount of time elapsed since `update` was last called.
|
||||
|
||||
--- **Optional**: Called from `pop.draw()` if `data.draw` and a child of
|
||||
--- `pop.screen`. Use it to draw your element.
|
||||
--- @function draw
|
||||
|
||||
--- **Optional**: Called from `pop.mousemoved()` if in LOVE >= 0.10.0 and your
|
||||
--- element is focused.
|
||||
--- @function mousemoved
|
||||
--- @tparam integer x The x coordinate of the mouse.
|
||||
--- @tparam integer y The y coordinate of the mouse.
|
||||
--- @tparam number dx The distance on the x axis the mouse was moved.
|
||||
--- @tparam number dy The distance on the y axis the mouse was moved.
|
||||
--- @treturn boolean Was the event handled?
|
||||
|
||||
--- **Optional**: Called from `pop.mousepressed()` if a mouse button was pressed
|
||||
--- over your element.
|
||||
---
|
||||
--- **Note**: Your element must be visible (`data.draw` is true) for this method
|
||||
--- to be called.
|
||||
--- @function mousepressed
|
||||
--- @tparam integer x The x coordinate of the mouse press.
|
||||
--- @tparam integer y The y coordinate of the mouse press.
|
||||
--- @tparam ?string|integer button The mouse button pressed. (Type varies by
|
||||
--- LÖVE version.)
|
||||
--- @treturn boolean Was the event handled?
|
||||
|
||||
|
||||
|
||||
--- The parent element of this element.
|
||||
--- @tfield ?Element|false parent Parent element.
|
||||
|
||||
--- The child elements of this element.
|
||||
--- @tfield table child All child elements.
|
||||
|
||||
|
||||
|
||||
--- Every object has a data field with pre-defined values. Any serializable data
|
||||
--- should be saved in this field. Ideally, any Pop.Box element can be
|
||||
--- reconstructed from its data field.
|
||||
--- @table data
|
||||
--- @tfield ?table|false parent The parent of this element's data field. This
|
||||
--- will **not** be serialized. This is the *only* exception to all data being
|
||||
--- serialized.
|
||||
--- @tfield table child All child elements' data fields.
|
||||
--- @tfield integer x The left edge of your element.
|
||||
--- @tfield integer y The top edge of your element.
|
||||
--- @tfield integer w The width of your element.
|
||||
--- @tfield integer h The height of your element.
|
||||
--- @tfield boolean update Whether or not to update this element (and its
|
||||
--- children).
|
||||
--- @tfield boolean draw Whether or not to draw this element (and its children).
|
||||
|
||||
|
||||
|
||||
pop.mousereleased = (x, y, button, element) ->
|
||||
if element.clicked and element.data.draw
|
||||
clickedHandled = element\clicked x - element.data.x, y - element.data.y, button
|
||||
if element.mousereleased
|
||||
mousereleasedHandled = element\mousereleased x - element.data.x, y - element.data.y, button
|
||||
|
||||
-- if we clicked, we're focused!
|
||||
if clickedHandled
|
||||
pop.focused = element
|
||||
|
||||
pop.keypressed = (key) ->
|
||||
print "keypressed", key
|
||||
|
||||
-- keypressed events must be on visible elements
|
||||
element = pop.focused
|
||||
if element and element.keypressed and element.data.draw
|
||||
return element.keypressed key
|
||||
|
||||
return false
|
||||
|
||||
pop.keyreleased = (key) ->
|
||||
print "keyreleased", key
|
||||
|
||||
-- keyreleased events are always called
|
||||
element = pop.focused
|
||||
if element and element.keyreleased
|
||||
return element.keyreleased key
|
||||
|
||||
return false
|
||||
|
||||
pop.textinput = (text) ->
|
||||
print "textinput", text
|
||||
|
||||
-- textinput events must be on visible elements
|
||||
element = pop.focused
|
||||
if element and element.textinput and element.data.draw
|
||||
return element.textinput text
|
||||
|
||||
return false
|
||||
|
||||
pop.debugDraw = (element=pop.screen) ->
|
||||
if element.debugDraw
|
||||
element\debugDraw!
|
||||
else
|
||||
graphics.setLineWidth 1
|
||||
graphics.setLineColor 0, 0, 0, 100
|
||||
graphics.rectangle "fill", element.x, element.y, element.w, element.h
|
||||
graphics.setColor 150, 150, 150, 150
|
||||
graphics.rectangle "line", element.x, element.y, element.w, element.h
|
||||
graphics.setColor 200, 200, 200, 255
|
||||
graphics.print ".", element.x, element.y
|
||||
|
||||
for i = 1, #element.child
|
||||
pop.debugDraw element.child[i]
|
||||
|
||||
pop.printElementTree = (element=pop.screen, depth=0) ->
|
||||
cls = element.__class.__name
|
||||
|
||||
if cls == "text"
|
||||
cls = cls .. " (\"#{element\getText!\gsub "\n", "\\n"}\")"
|
||||
elseif cls == "box"
|
||||
bg = element\getBackground!
|
||||
|
||||
if type(bg) == "table"
|
||||
bg = "#{bg[1]}, #{bg[2]}, #{bg[3]}, #{bg[4]}"
|
||||
|
||||
cls = cls .. " (#{bg})"
|
||||
|
||||
print string.rep("-", depth) .. " #{cls}"
|
||||
|
||||
for i = 1, #element.child
|
||||
pop.printElementTree element.child[i], depth + 1
|
@ -1,7 +1,9 @@
|
||||
file = {
|
||||
"init.moon",
|
||||
--"main.moon",
|
||||
"elements/element.moon",
|
||||
"main.moon",
|
||||
"util.moon",
|
||||
"Element.luadoc",
|
||||
}
|
||||
|
||||
project = "Pop.Box()"
|
||||
|
120
docs/classes/element.html
Normal file
120
docs/classes/element.html
Normal file
@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Documentation</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>Pop.Box()</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Methods">Methods</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><strong>element</strong></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../modules/pop.html">pop</a></li>
|
||||
<li><a href="../modules/main.html">main</a></li>
|
||||
<li><a href="../modules/util.html">util</a></li>
|
||||
<li><a href="../modules/Element.html">Element</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Class <code>element</code></h1>
|
||||
<p>A generic element every element must inherit from.</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>Copyright</strong>: Paul Liverman III (2016)</li>
|
||||
<li><strong>License</strong>: The MIT License (MIT)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Methods">Methods</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#element.new">element.new (self, parent)</a></td>
|
||||
<td class="summary">Constructor expects nothing?</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Methods"></a>Methods</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "element.new"></a>
|
||||
<strong>element.new (self, parent)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Constructor expects nothing?
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">self</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">parent</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-08-21 00:47:30 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
@ -32,7 +32,13 @@
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="modules/pop.html">pop</a></li>
|
||||
<li><a href="modules/main.html">main</a></li>
|
||||
<li><a href="modules/util.html">util</a></li>
|
||||
<li><a href="modules/Element.html">Element</a></li>
|
||||
</ul>
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="classes/element.html">element</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -48,17 +54,32 @@
|
||||
<td class="name" nowrap><a href="modules/pop.html">pop</a></td>
|
||||
<td class="summary">The Pop.Box GUI itself.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/main.html">main</a></td>
|
||||
<td class="summary">A demo program for Pop.Box.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/util.html">util</a></td>
|
||||
<td class="summary">Utility functions, intended for internal use only.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/Element.html">Element</a></td>
|
||||
<td class="summary">This is a description of what is expected in an element class.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>Classes</h2>
|
||||
<table class="module_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="classes/element.html">element</a></td>
|
||||
<td class="summary">A generic element every element must inherit from.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-08-20 21:29:17 </i>
|
||||
<i style="float:right;">Last updated 2016-08-21 00:47:30 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
402
docs/modules/Element.html
Normal file
402
docs/modules/Element.html
Normal file
@ -0,0 +1,402 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Documentation</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>Pop.Box()</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../modules/pop.html">pop</a></li>
|
||||
<li><a href="../modules/main.html">main</a></li>
|
||||
<li><a href="../modules/util.html">util</a></li>
|
||||
<li><strong>Element</strong></li>
|
||||
</ul>
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../classes/element.html">element</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>Element</code></h1>
|
||||
<p>This is a description of what is expected in an element class.</p>
|
||||
<p> <strong>IMPORTANT</strong>: Your class should inherit from <em>the</em> element class. This
|
||||
means that any methods defined on that class need to be compatible with or
|
||||
overridden by your class!</p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#load">load (pop)</a></td>
|
||||
<td class="summary"><strong>Optional</strong>: Called during <code>pop.load()</code> with a reference to Pop.Box.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#wrap">wrap (pop)</a></td>
|
||||
<td class="summary"><strong>Optional</strong>: Called during <code>pop.load()</code> to allow a custom wrapper function
|
||||
to be created for your element class.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#update">update (dt)</a></td>
|
||||
<td class="summary"><strong>Optional</strong>: Called from <code>pop.update()</code> if <code>data.update</code> and a child of
|
||||
<code>pop.screen</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#draw">draw ()</a></td>
|
||||
<td class="summary"><strong>Optional</strong>: Called from <code>pop.draw()</code> if <code>data.draw</code> and a child of
|
||||
<code>pop.screen</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#mousemoved">mousemoved (x, y, dx, dy)</a></td>
|
||||
<td class="summary"><strong>Optional</strong>: Called from <code>pop.mousemoved()</code> if in LOVE >= 0.10.0 and your
|
||||
element is focused.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#mousepressed">mousepressed (x, y, button)</a></td>
|
||||
<td class="summary"><strong>Optional</strong>: Called from <code>pop.mousepressed()</code> if a mouse button was pressed
|
||||
over your element.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#data">data</a></td>
|
||||
<td class="summary">Every object has a data field with pre-defined values.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#parent">parent</a></td>
|
||||
<td class="summary">The parent element of this element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#child">child</a></td>
|
||||
<td class="summary">The child elements of this element.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "load"></a>
|
||||
<strong>load (pop)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>Optional</strong>: Called during <code>pop.load()</code> with a reference to Pop.Box.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">pop</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#pdf-module">module</a></span>
|
||||
The Pop.Box module.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "wrap"></a>
|
||||
<strong>wrap (pop)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>Optional</strong>: Called during <code>pop.load()</code> to allow a custom wrapper function
|
||||
to be created for your element class.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">pop</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#pdf-module">module</a></span>
|
||||
The Pop.Box module.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
wrapper A function to be called to create an element of
|
||||
this class instead of using <code>pop.create()</code>.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "update"></a>
|
||||
<strong>update (dt)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>Optional</strong>: Called from <code>pop.update()</code> if <code>data.update</code> and a child of
|
||||
<code>pop.screen</code>. Use it for any time-based updates your element may need.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">dt</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The amount of time elapsed since <a href="../modules/Element.html#update">update</a> was last called.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "draw"></a>
|
||||
<strong>draw ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>Optional</strong>: Called from <code>pop.draw()</code> if <code>data.draw</code> and a child of
|
||||
<code>pop.screen</code>. Use it to draw your element.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "mousemoved"></a>
|
||||
<strong>mousemoved (x, y, dx, dy)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>Optional</strong>: Called from <code>pop.mousemoved()</code> if in LOVE >= 0.10.0 and your
|
||||
element is focused.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The x coordinate of the mouse.
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The y coordinate of the mouse.
|
||||
</li>
|
||||
<li><span class="parameter">dx</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The distance on the x axis the mouse was moved.
|
||||
</li>
|
||||
<li><span class="parameter">dy</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The distance on the y axis the mouse was moved.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the event handled?
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "mousepressed"></a>
|
||||
<strong>mousepressed (x, y, button)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>Optional</strong>: Called from <code>pop.mousepressed()</code> if a mouse button was pressed
|
||||
over your element. </p>
|
||||
|
||||
<p> <strong>Note</strong>: Your element must be visible (<code>data.draw</code> is true) for this method
|
||||
to be called.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The x coordinate of the mouse press.
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The y coordinate of the mouse press.
|
||||
</li>
|
||||
<li><span class="parameter">button</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">integer</span></span>
|
||||
The mouse button pressed. (Type varies by
|
||||
LÖVE version.)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the event handled?
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "data"></a>
|
||||
<strong>data</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Every object has a data field with pre-defined values. Any serializable data
|
||||
should be saved in this field. Ideally, any Pop.Box element can be
|
||||
reconstructed from its data field.
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">parent</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a> or <span class="type">false</span></span>
|
||||
The parent of this element's data field. This
|
||||
will <strong>not</strong> be serialized. This is the <em>only</em> exception to all data being
|
||||
serialized.
|
||||
</li>
|
||||
<li><span class="parameter">child</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
All child elements' data fields.
|
||||
</li>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The left edge of your element.
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The top edge of your element.
|
||||
</li>
|
||||
<li><span class="parameter">w</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The width of your element.
|
||||
</li>
|
||||
<li><span class="parameter">h</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The height of your element.
|
||||
</li>
|
||||
<li><span class="parameter">update</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Whether or not to update this element (and its
|
||||
children).
|
||||
</li>
|
||||
<li><span class="parameter">draw</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Whether or not to draw this element (and its children).
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "parent"></a>
|
||||
<strong>parent</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
The parent element of this element.
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">parent</span>
|
||||
<span class="types"><span class="type">Element</span> or <span class="type">false</span></span>
|
||||
Parent element.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "child"></a>
|
||||
<strong>child</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
The child elements of this element.
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">child</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
All child elements.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-08-21 00:47:30 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
@ -37,6 +37,11 @@
|
||||
<li><a href="../modules/pop.html">pop</a></li>
|
||||
<li><strong>main</strong></li>
|
||||
<li><a href="../modules/util.html">util</a></li>
|
||||
<li><a href="../modules/Element.html">Element</a></li>
|
||||
</ul>
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../classes/element.html">element</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -66,7 +71,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-08-20 19:46:37 </i>
|
||||
<i style="float:right;">Last updated 2016-08-21 00:47:30 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -34,13 +34,20 @@
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Issues">Issues</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><strong>pop</strong></li>
|
||||
<li><a href="../modules/main.html">main</a></li>
|
||||
<li><a href="../modules/util.html">util</a></li>
|
||||
<li><a href="../modules/Element.html">Element</a></li>
|
||||
</ul>
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../classes/element.html">element</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -103,10 +110,6 @@
|
||||
<td class="summary">Event handler for <code>love.textinput()</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#skin">skin (element, skin, depth)</a></td>
|
||||
<td class="summary">Applies skins to elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#debugDraw">debugDraw (element)</a></td>
|
||||
<td class="summary">Draws simple rectangle outlines to debug placement of elements.</td>
|
||||
</tr>
|
||||
@ -124,6 +127,31 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Issues">Issues</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#update-todo1">update-todo1</a></td>
|
||||
<td class="summary">Define Elements and @ see that documentation from here. Generic documentation, not specifically element!
|
||||
data.update boolean controls an element and its children being updated</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#mousemoved-todo2">mousemoved-todo2</a></td>
|
||||
<td class="summary">Implement a way for an element to attach itself to <code>love.mousemoved()</code> events?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#mousereleased-todo3">mousereleased-todo3</a></td>
|
||||
<td class="summary"> 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),</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#printElementTree-todo4">printElementTree-todo4</a></td>
|
||||
<td class="summary">Correct this once elements are reimplemented if it needs correction.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
@ -139,7 +167,8 @@
|
||||
<dd>
|
||||
Loads elements, skins, extensions, and initializes <code>pop.screen</code>. </p>
|
||||
|
||||
<p> <strong>IMPORTANT</strong>: Intended to only be called once, and is automatically called when you require Pop.Box.
|
||||
<p> <strong>IMPORTANT</strong>: Intended to only be called once, and is automatically called
|
||||
when you require Pop.Box.
|
||||
|
||||
|
||||
|
||||
@ -147,7 +176,8 @@
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/pop.html#">pop</a>
|
||||
<li><a href="../modules/pop.html#">pop</a></li>
|
||||
<li><a href="../modules/Element.html#">Element</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -163,15 +193,20 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">element</span>
|
||||
A string naming the element class to use.
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The element class to use.
|
||||
</li>
|
||||
<li><span class="parameter">parent</span>
|
||||
[opt] The parent element. If <code>false</code>, an element is created with no parent. If <code>nil</code>, defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span>, <span class="type">false</span> or <span class="type">nil</span></span>
|
||||
[opt] The parent element. If <code>false</code>, an
|
||||
element is created with no parent. If <code>nil</code>, defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
[opt] Any number of parameters can be passed to the constructor for the element.</p>
|
||||
[opt] Any number of parameters can be passed to the constructor
|
||||
for the element.</p>
|
||||
|
||||
<p> (<strong>Note</strong>: An element with no parent will not be handled by Pop.Box's event handlers unless you handle it explicitly.)
|
||||
<p> (<strong>Note</strong>: An element with no parent will not be handled by Pop.Box's event
|
||||
handlers unless you handle it explicitly.)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -179,7 +214,8 @@
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/pop.html#">pop</a>
|
||||
<li><a href="../modules/pop.html#">pop</a></li>
|
||||
<li><a href="../modules/Element.html#">Element</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -195,15 +231,23 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">dt</span>
|
||||
The amount of time passed since the last call to update, in seconds.
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The amount of time passed since the last call to update,
|
||||
in seconds.
|
||||
</li>
|
||||
<li><span class="parameter">element</span>
|
||||
[opt] The element to update (will update all its children as well). Defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
[opt] The element to update (will update all its
|
||||
children as well). Defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -218,12 +262,18 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">element</span>
|
||||
[opt] The element to draw (will draw all its children as well). Defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
[opt] The element to draw (will draw all its children
|
||||
as well). Defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -232,21 +282,25 @@
|
||||
<strong>mousemoved (x, y, dx, dy)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Event handler for <code>love.mousemoved()</code>. (*LÖVE >= 0.10.0*)
|
||||
Event handler for <code>love.mousemoved()</code>. (LÖVE >= 0.10.0)
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The x coordinate of the mouse.
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The y coordinate of the mouse.
|
||||
</li>
|
||||
<li><span class="parameter">dx</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The distance on the x axis the mouse was moved.
|
||||
</li>
|
||||
<li><span class="parameter">dy</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The distance on the y axis the mouse was moved.
|
||||
</li>
|
||||
</ul>
|
||||
@ -254,7 +308,8 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<code>true</code> / <code>false</code>: Was the event handled?
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the event handled?
|
||||
</ol>
|
||||
|
||||
|
||||
@ -272,26 +327,37 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The x coordinate of the mouse press.
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The y coordinate of the mouse press.
|
||||
</li>
|
||||
<li><span class="parameter">button</span>
|
||||
The mouse button pressed.
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">integer</span></span>
|
||||
The mouse button pressed. (Type varies by
|
||||
LÖVE version.)
|
||||
</li>
|
||||
<li><span class="parameter">element</span>
|
||||
[opt] The element to check for event handling (will check its children as well). Defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
[opt] The element to check for event handling (will
|
||||
check its children as well). Defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<code>true</code> / <code>false</code>: Was the event handled?
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the event handled?
|
||||
</ol>
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -306,28 +372,40 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The x coordinate of the mouse release.
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">integer</span></span>
|
||||
The y coordinate of the mouse release.
|
||||
</li>
|
||||
<li><span class="parameter">button</span>
|
||||
The mouse button released.
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">integer</span></span>
|
||||
The mouse button released. (Type varies by
|
||||
LÖVE version.)
|
||||
</li>
|
||||
<li><span class="parameter">element</span>
|
||||
[opt] The element to check for event handling (will check its children as well). Defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
[opt] The element to check for event handling (will
|
||||
check its children as well). Defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<code>true</code> / <code>false</code>: Was a click handled?</li>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was a click handled?</li>
|
||||
<li>
|
||||
<code>true</code> / <code>false</code>: Was a mouse release handled?</li>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was a mouse release handled?</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -342,6 +420,7 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The key that was pressed.
|
||||
</li>
|
||||
</ul>
|
||||
@ -349,7 +428,8 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<code>true</code> / <code>false</code>: Was the event handled?
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the event handled?
|
||||
</ol>
|
||||
|
||||
|
||||
@ -367,6 +447,7 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The key that was released.
|
||||
</li>
|
||||
</ul>
|
||||
@ -374,7 +455,8 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<code>true</code> / <code>false</code>: Was the event handled?
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the event handled?
|
||||
</ol>
|
||||
|
||||
|
||||
@ -392,6 +474,7 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">text</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The text that was typed.
|
||||
</li>
|
||||
</ul>
|
||||
@ -399,38 +482,13 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<code>true</code> / <code>false</code>: Was the text input handled?
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Was the text input handled?
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "skin"></a>
|
||||
<strong>skin (element, skin, depth)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Applies skins to elements. (<strong>NOTE</strong>: This function will be rewritten and change at some point...)
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">element</span>
|
||||
The element to skin (will also be applied to children). Defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
<li><span class="parameter">skin</span>
|
||||
The skin to use, can be a string or an actual skin object, defaults to the default skin included with Pop.Box.
|
||||
</li>
|
||||
<li><span class="parameter">depth</span>
|
||||
[opt] An integer for how many child levels to skin, OR, if <code>true</code>, will skin all children.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "debugDraw"></a>
|
||||
@ -443,12 +501,18 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">element</span>
|
||||
The element to draw (will draw its children as well). Defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
[opt] The element to draw (will draw its children as
|
||||
well). Defaults to <code>pop.screen</code>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -463,12 +527,18 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">element</span>
|
||||
The element to start at. Defaults to <code>pop.screen</code>.
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
[opt] The element to start at. Defaults to
|
||||
<code>pop.screen</code>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -489,19 +559,26 @@
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">elements</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
All GUI classes are stored here.
|
||||
</li>
|
||||
<li><span class="parameter">skins</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
All skins are stored here.
|
||||
</li>
|
||||
<li><span class="parameter">extensions</span>
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
All extensions are loaded here.
|
||||
</li>
|
||||
<li><span class="parameter">screen</span>
|
||||
The top level GUI element. Represents the game screen. Initialized in <code>pop.load()</code>
|
||||
<span class="types"><span class="type">Element</span></span>
|
||||
The top level GUI element. Represents the game
|
||||
screen. Initialized in <code>pop.load()</code>
|
||||
</li>
|
||||
<li><span class="parameter">focused</span>
|
||||
The currently focused GUI element (or <code>false</code> if none is focused).
|
||||
<span class="types"><span class="type">Element</span> or <span class="type">false</span></span>
|
||||
The currently focused GUI element (or <code>false</code>
|
||||
if none is focused).
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -509,10 +586,77 @@
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/pop.html#load">pop.load</a>
|
||||
<li><a href="../modules/pop.html#load">pop.load</a></li>
|
||||
<li><a href="../modules/Element.html#">Element</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Issues"></a>Issues</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "update-todo1"></a>
|
||||
<strong>update-todo1</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Define Elements and @ see that documentation from here. Generic documentation, not specifically element!
|
||||
data.update boolean controls an element and its children being updated
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "mousemoved-todo2"></a>
|
||||
<strong>mousemoved-todo2</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Implement a way for an element to attach itself to <code>love.mousemoved()</code> events?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "mousereleased-todo3"></a>
|
||||
<strong>mousereleased-todo3</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
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),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "printElementTree-todo4"></a>
|
||||
<strong>printElementTree-todo4</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Correct this once elements are reimplemented if it needs correction.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@ -521,7 +665,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-08-20 21:29:17 </i>
|
||||
<i style="float:right;">Last updated 2016-08-21 00:47:30 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -39,7 +39,13 @@
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../modules/pop.html">pop</a></li>
|
||||
<li><a href="../modules/main.html">main</a></li>
|
||||
<li><strong>util</strong></li>
|
||||
<li><a href="../modules/Element.html">Element</a></li>
|
||||
</ul>
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../classes/element.html">element</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -54,7 +60,6 @@
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>Copyright</strong>: Paul Liverman III (2015-2016)</li>
|
||||
<li><strong>Release</strong>: 0.0.0</li>
|
||||
<li><strong>License</strong>: The MIT License (MIT)</li>
|
||||
</ul>
|
||||
|
||||
@ -89,19 +94,27 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">object</span>
|
||||
A table (MoonScript object expected) to be checked for inheritence from the "element" element.
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
MoonScript object to be checked for inheritence from
|
||||
the "element" element.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<code>true</code> / <code>false</code>: Is the table an object inherting from "element"?
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
Is the table an object inherting from "element"?
|
||||
</ol>
|
||||
|
||||
<h3>Raises:</h3>
|
||||
Can error if the table has a similar structure to a MoonScript object without being the same structure.
|
||||
Can error if the table has a similar structure to a MoonScript object
|
||||
without being the same structure.
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/Element.html#">Element</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -112,7 +125,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-08-20 21:29:17 </i>
|
||||
<i style="float:right;">Last updated 2016-08-21 00:47:30 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -6,7 +6,7 @@ do
|
||||
}
|
||||
_base_0.__index = _base_0
|
||||
_class_0 = setmetatable({
|
||||
__init = function(self) end,
|
||||
__init = function(self, parent) end,
|
||||
__base = _base_0,
|
||||
__name = "element"
|
||||
}, {
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- A generic element every element must inherit from.
|
||||
--- @module pop
|
||||
--- @classmod element
|
||||
--- @copyright Paul Liverman III (2016)
|
||||
--- @license The MIT License (MIT)
|
||||
--- @release 0.0.0
|
||||
|
||||
class element
|
||||
new: =>
|
||||
--- Constructor expects nothing?
|
||||
new: (parent) =>
|
||||
--do stuff
|
||||
|
||||
setSize: =>
|
||||
|
34
init.lua
34
init.lua
@ -111,12 +111,18 @@ pop.create = function(element, parent, ...)
|
||||
element = pop.elements[element](parent, ...)
|
||||
insert(parent.child, element)
|
||||
insert(parent.data.child, element.data)
|
||||
element.parent = parent
|
||||
element.data.parent = parent.data
|
||||
elseif parent == false then
|
||||
element = pop.elements[element](false, ...)
|
||||
element.parent = false
|
||||
element.data.parent = false
|
||||
else
|
||||
element = pop.elements[element](pop.screen, parent, ...)
|
||||
insert(pop.screen.child, element)
|
||||
insert(pop.screen.data.child, element.data)
|
||||
element.parent = pop.screen
|
||||
element.data.parent = pop.screen.data
|
||||
end
|
||||
return element
|
||||
end
|
||||
@ -233,34 +239,6 @@ pop.textinput = function(text)
|
||||
end
|
||||
return false
|
||||
end
|
||||
pop.skin = function(element, skin, depth)
|
||||
if element == nil then
|
||||
element = pop.screen
|
||||
end
|
||||
if skin == nil then
|
||||
skin = pop.skins.default
|
||||
end
|
||||
if element.background and skin.background then
|
||||
element.background = skin.background
|
||||
end
|
||||
if element.color and skin.color then
|
||||
element.color = skin.color
|
||||
end
|
||||
if element.font and skin.font then
|
||||
element.font = skin.font
|
||||
end
|
||||
if not (depth or (depth == 0)) then
|
||||
if depth == tonumber(depth) then
|
||||
for i = 1, #element.child do
|
||||
pop.skin(element.child[i], skin, depth - 1)
|
||||
end
|
||||
else
|
||||
for i = 1, #element.child do
|
||||
pop.skin(element.child[i], skin, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pop.debugDraw = function(element)
|
||||
if element == nil then
|
||||
element = pop.screen
|
||||
|
147
init.moon
147
init.moon
@ -27,12 +27,15 @@ import insert from table
|
||||
import inheritsFromElement from require "#{path}/util"
|
||||
|
||||
--- @table pop
|
||||
--- @field elements All GUI classes are stored here.
|
||||
--- @field skins All skins are stored here.
|
||||
--- @field extensions All extensions are loaded here.
|
||||
--- @field screen The top level GUI element. Represents the game screen. Initialized in `pop.load()`
|
||||
--- @tfield table elements All GUI classes are stored here.
|
||||
--- @tfield table skins All skins are stored here.
|
||||
--- @tfield table extensions All extensions are loaded here.
|
||||
--- @tfield Element screen The top level GUI element. Represents the game
|
||||
--- screen. Initialized in `pop.load()`
|
||||
--- @tfield ?Element|false focused The currently focused GUI element (or `false`
|
||||
--- if none is focused).
|
||||
--- @see pop.load
|
||||
--- @field focused The currently focused GUI element (or `false` if none is focused).
|
||||
--- @see Element
|
||||
|
||||
pop.elements = {}
|
||||
pop.skins = {}
|
||||
@ -44,12 +47,13 @@ pop.focused = false
|
||||
|
||||
--- Loads elements, skins, extensions, and initializes `pop.screen`.
|
||||
---
|
||||
--- **IMPORTANT**: Intended to only be called once, and is automatically called when you require Pop.Box.
|
||||
--- **IMPORTANT**: Intended to only be called once, and is automatically called
|
||||
--- when you require Pop.Box.
|
||||
--- @function load
|
||||
--- @see pop
|
||||
--- @see Element
|
||||
|
||||
pop.load = ->
|
||||
--@todo @ see Elements
|
||||
--@todo @ see Skins
|
||||
--@todo @ see Extensions
|
||||
elements = filesystem.getDirectoryItems "#{path}/elements"
|
||||
@ -121,28 +125,37 @@ pop.load = ->
|
||||
|
||||
--- Creates an element.
|
||||
--- @function create
|
||||
--- @param element A string naming the element class to use.
|
||||
--- @param parent[opt] The parent element. If `false`, an element is created with no parent. If `nil`, defaults to `pop.screen`.
|
||||
--- @param ...[opt] Any number of parameters can be passed to the constructor for the element.
|
||||
--- @tparam string element The element class to use.
|
||||
--- @tparam ?Element|false|nil parent[opt] The parent element. If `false`, an
|
||||
--- element is created with no parent. If `nil`, defaults to `pop.screen`.
|
||||
--- @param ...[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.)
|
||||
--- (**Note**: An element with no parent will not be handled by Pop.Box's event
|
||||
--- handlers unless you handle it explicitly.)
|
||||
--- @see pop
|
||||
--- @see Element
|
||||
|
||||
pop.create = (element, parent=pop.screen, ...) ->
|
||||
--@todo @ see Elements
|
||||
-- if valid parent element, use it
|
||||
if inheritsFromElement parent
|
||||
element = pop.elements[element](parent, ...)
|
||||
insert parent.child, element
|
||||
insert parent.data.child, element.data
|
||||
element.parent = parent
|
||||
element.data.parent = parent.data
|
||||
-- if explicitly no parent, just create the element
|
||||
elseif parent == false
|
||||
element = pop.elements[element](false, ...)
|
||||
element.parent = false
|
||||
element.data.parent = false
|
||||
-- else use pop.screen (and "parent" is actually the first argument)
|
||||
else
|
||||
element = pop.elements[element](pop.screen, parent, ...)
|
||||
insert pop.screen.child, element
|
||||
insert pop.screen.data.child, element.data
|
||||
element.parent = pop.screen
|
||||
element.data.parent = pop.screen.data
|
||||
|
||||
return element
|
||||
|
||||
@ -150,11 +163,14 @@ pop.create = (element, parent=pop.screen, ...) ->
|
||||
|
||||
--- Event handler for `love.update()`.
|
||||
--- @function update
|
||||
--- @param dt The amount of time passed since the last call to update, in seconds.
|
||||
--- @param element[opt] The element to update (will update all its children as well). Defaults to `pop.screen`.
|
||||
--- @tparam number dt The amount of time passed since the last call to update,
|
||||
--- in seconds.
|
||||
--- @tparam Element element[opt] The element to update (will update all its
|
||||
--- children as well). Defaults to `pop.screen`.
|
||||
--- @see Element
|
||||
|
||||
pop.update = (dt, element=pop.screen) ->
|
||||
--@todo Define Elements and @ see that documentation from here. Generic documentation, not specifically element!
|
||||
--- @todo Define Elements and @ see that documentation from here. Generic documentation, not specifically element!
|
||||
-- data.update boolean controls an element and its children being updated
|
||||
if element.data.update
|
||||
if element.update
|
||||
@ -166,10 +182,11 @@ pop.update = (dt, element=pop.screen) ->
|
||||
|
||||
--- Event handler for `love.draw()`.
|
||||
--- @function draw
|
||||
--- @param element[opt] The element to draw (will draw all its children as well). Defaults to `pop.screen`.
|
||||
--- @tparam Element element[opt] The element to draw (will draw all its children
|
||||
--- as well). Defaults to `pop.screen`.
|
||||
--- @see Element
|
||||
|
||||
pop.draw = (element=pop.screen) ->
|
||||
--@todo @ see Elements
|
||||
-- data.draw boolean controls an element and its children being drawn
|
||||
if element.data.draw
|
||||
if element.draw
|
||||
@ -179,16 +196,16 @@ pop.draw = (element=pop.screen) ->
|
||||
|
||||
|
||||
|
||||
--- Event handler for `love.mousemoved()`. (*LÖVE >= 0.10.0*)
|
||||
--- Event handler for `love.mousemoved()`. (LÖVE >= 0.10.0)
|
||||
--- @function mousemoved
|
||||
--- @param x The x coordinate of the mouse.
|
||||
--- @param y The y coordinate of the mouse.
|
||||
--- @param dx The distance on the x axis the mouse was moved.
|
||||
--- @param dy The distance on the y axis the mouse was moved.
|
||||
--- @return `true` / `false`: Was the event handled?
|
||||
--- @tparam integer x The x coordinate of the mouse.
|
||||
--- @tparam integer y The y coordinate of the mouse.
|
||||
--- @tparam number dx The distance on the x axis the mouse was moved.
|
||||
--- @tparam number dy The distance on the y axis the mouse was moved.
|
||||
--- @treturn boolean Was the event handled?
|
||||
|
||||
pop.mousemoved = (x, y, dx, dy) ->
|
||||
--@todo Implement a way for an element to attach itself to `love.mousemoved()` events?
|
||||
--- @todo Implement a way for an element to attach itself to `love.mousemoved()` events?
|
||||
if pop.focused and pop.focused.mousemoved
|
||||
return pop.focused\mousemoved x, y, dx, dy
|
||||
|
||||
@ -198,11 +215,14 @@ pop.mousemoved = (x, y, dx, dy) ->
|
||||
|
||||
--- Event handler for `love.mousepressed()`.
|
||||
--- @function mousepressed
|
||||
--- @param x The x coordinate of the mouse press.
|
||||
--- @param y The y coordinate of the mouse press.
|
||||
--- @param button The mouse button pressed.
|
||||
--- @param element[opt] The element to check for event handling (will check its children as well). Defaults to `pop.screen`.
|
||||
--- @return `true` / `false`: Was the event handled?
|
||||
--- @tparam integer x The x coordinate of the mouse press.
|
||||
--- @tparam integer y The y coordinate of the mouse press.
|
||||
--- @tparam ?string|integer button The mouse button pressed. (Type varies by
|
||||
--- LÖVE version.)
|
||||
--- @tparam Element element[opt] The element to check for event handling (will
|
||||
--- check its children as well). Defaults to `pop.screen`.
|
||||
--- @treturn boolean Was the event handled?
|
||||
--- @see Element
|
||||
|
||||
pop.mousepressed = (x, y, button, element) ->
|
||||
-- start at the screen, print that we received an event
|
||||
@ -234,12 +254,15 @@ pop.mousepressed = (x, y, button, element) ->
|
||||
|
||||
--- Event handler for `love.mousereleased()`.
|
||||
--- @function mousereleased
|
||||
--- @param x The x coordinate of the mouse release.
|
||||
--- @param y The y coordinate of the mouse release.
|
||||
--- @param button The mouse button released.
|
||||
--- @param element[opt] The element to check for event handling (will check its children as well). Defaults to `pop.screen`.
|
||||
--- @return `true` / `false`: Was a click handled?
|
||||
--- @return `true` / `false`: Was a mouse release handled?
|
||||
--- @tparam integer x The x coordinate of the mouse release.
|
||||
--- @tparam integer y The y coordinate of the mouse release.
|
||||
--- @tparam ?string|integer button The mouse button released. (Type varies by
|
||||
--- LÖVE version.)
|
||||
--- @tparam Element element[opt] The element to check for event handling (will
|
||||
--- check its children as well). Defaults to `pop.screen`.
|
||||
--- @treturn boolean Was a click handled?
|
||||
--- @treturn boolean Was a mouse release handled?
|
||||
--- @see Element
|
||||
|
||||
pop.mousereleased = (x, y, button, element) ->
|
||||
-- we are trying to handle a clicked or mousereleased event
|
||||
@ -266,7 +289,7 @@ pop.mousereleased = (x, y, button, element) ->
|
||||
-- if we clicked, we're focused!
|
||||
if clickedHandled
|
||||
pop.focused = element
|
||||
--@todo Figure out how to bring a focused element to the front of view (aka the first element in its parent's children).
|
||||
--- @todo 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
|
||||
@ -284,8 +307,8 @@ pop.mousereleased = (x, y, button, element) ->
|
||||
|
||||
--- Event handler for `love.keypressed()`.
|
||||
--- @function keypressed
|
||||
--- @param key The key that was pressed.
|
||||
--- @return `true` / `false`: Was the event handled?
|
||||
--- @tparam string key The key that was pressed.
|
||||
--- @treturn boolean Was the event handled?
|
||||
|
||||
pop.keypressed = (key) ->
|
||||
print "keypressed", key
|
||||
@ -301,8 +324,8 @@ pop.keypressed = (key) ->
|
||||
|
||||
--- Event handler for `love.keyreleased()`.
|
||||
--- @function keyreleased
|
||||
--- @param key The key that was released.
|
||||
--- @return `true` / `false`: Was the event handled?
|
||||
--- @tparam string key The key that was released.
|
||||
--- @treturn boolean Was the event handled?
|
||||
|
||||
pop.keyreleased = (key) ->
|
||||
print "keyreleased", key
|
||||
@ -318,8 +341,8 @@ pop.keyreleased = (key) ->
|
||||
|
||||
--- Event handler for `love.textinput()`.
|
||||
--- @function textinput
|
||||
--- @param text The text that was typed.
|
||||
--- @return `true` / `false`: Was the text input handled?
|
||||
--- @tparam string text The text that was typed.
|
||||
--- @treturn boolean Was the text input handled?
|
||||
|
||||
pop.textinput = (text) ->
|
||||
print "textinput", text
|
||||
@ -333,39 +356,11 @@ pop.textinput = (text) ->
|
||||
|
||||
|
||||
|
||||
--- Applies skins to elements. (**NOTE**: This function will be rewritten and change at some point...)
|
||||
--- @function skin
|
||||
--- @param element The element to skin (will also be applied to children). Defaults to `pop.screen`.
|
||||
--- @param skin The skin to use, can be a string or an actual skin object, defaults to the default skin included with Pop.Box.
|
||||
--- @param depth[opt] An integer for how many child levels to skin, OR, if `true`, will skin all children.
|
||||
|
||||
--TODO rewrite skin system to not rely on knowing internals of elements,
|
||||
-- instead call functions like setColor and setBackground
|
||||
-- skins an element (and its children unless depth == true or 0)
|
||||
-- depth can be an integer for how many levels to go down when skinning
|
||||
-- defaults to pop.screen and the default skin
|
||||
pop.skin = (element=pop.screen, skin=pop.skins.default, depth) ->
|
||||
--@todo Rewrite the skin function taking advantage of data block / whatever else is needed.
|
||||
if element.background and skin.background
|
||||
element.background = skin.background
|
||||
if element.color and skin.color
|
||||
element.color = skin.color
|
||||
if element.font and skin.font
|
||||
element.font = skin.font
|
||||
|
||||
unless depth or (depth == 0)
|
||||
if depth == tonumber depth
|
||||
for i = 1, #element.child
|
||||
pop.skin element.child[i], skin, depth - 1
|
||||
else
|
||||
for i = 1, #element.child
|
||||
pop.skin element.child[i], skin, true
|
||||
|
||||
|
||||
|
||||
--- Draws simple rectangle outlines to debug placement of elements.
|
||||
--- @function debugDraw
|
||||
--- @param element The element to draw (will draw its children as well). Defaults to `pop.screen`.
|
||||
--- @tparam Element element[opt] The element to draw (will draw its children as
|
||||
--- well). Defaults to `pop.screen`.
|
||||
--- @see Element
|
||||
|
||||
pop.debugDraw = (element=pop.screen) ->
|
||||
--@todo Make this better in the future when different element types have been created and whatnot.
|
||||
@ -387,10 +382,12 @@ pop.debugDraw = (element=pop.screen) ->
|
||||
|
||||
--- Prints a basic structure of GUI elements with minimal info.
|
||||
--- @function printElementTree
|
||||
--- @param element The element to start at. Defaults to `pop.screen`.
|
||||
--- @tparam Element element[opt] The element to start at. Defaults to
|
||||
--- `pop.screen`.
|
||||
--- @see Element
|
||||
|
||||
pop.printElementTree = (element=pop.screen, depth=0) ->
|
||||
--@todo Correct this once elements are reimplemented if it needs correction.
|
||||
--- @todo Correct this once elements are reimplemented if it needs correction.
|
||||
cls = element.__class.__name
|
||||
|
||||
if cls == "text"
|
||||
|
11
util.moon
11
util.moon
@ -2,12 +2,15 @@
|
||||
--- @module util
|
||||
--- @copyright Paul Liverman III (2015-2016)
|
||||
--- @license The MIT License (MIT)
|
||||
--- @release 0.0.0
|
||||
|
||||
--- @function inheritsFromElement
|
||||
--- @param object A table (MoonScript object expected) to be checked for inheritence from the "element" element.
|
||||
--- @return `true` / `false`: Is the table an object inherting from "element"?
|
||||
--- @raise Can error if the table has a similar structure to a MoonScript object without being the same structure.
|
||||
--- @tparam table object MoonScript object to be checked for inheritence from
|
||||
--- the "element" element.
|
||||
--- @treturn boolean Is the table an object inherting from "element"?
|
||||
--- @raise Can error if the table has a similar structure to a MoonScript object
|
||||
--- without being the same structure.
|
||||
--- @see Element
|
||||
|
||||
inheritsFromElement = (object) ->
|
||||
if object and object.__class
|
||||
cls = object.__class
|
||||
|
Loading…
Reference in New Issue
Block a user