123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html>
- <head>
- <title>Module goo.object</title>
- <link rel="stylesheet" href="../luadoc.css" type="text/css" />
- <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
- </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">
- <div id="navigation">
- <h1>Goo</h1>
- <ul>
-
- <li><a href="../index.html">Index</a></li>
-
- </ul>
- <!-- Module list -->
- <h1>Modules</h1>
- <ul>
- <li>
- <a href="../modules/anim.html">anim</a>
- </li>
- <li>
- <a href="../modules/goo.html">goo</a>
- </li>
- <li>
- <a href="../modules/goo.button.html">goo.button</a>
- </li>
- <li>
- <a href="../modules/goo.checkbox.html">goo.checkbox</a>
- </li>
- <li>
- <a href="../modules/goo.colorpick.html">goo.colorpick</a>
- </li>
- <li>
- <a href="../modules/goo.image.html">goo.image</a>
- </li>
- <li>
- <a href="../modules/goo.null.html">goo.null</a>
- </li>
- <li><strong>goo.object</strong></li>
-
- <li>
- <a href="../modules/goo.panel.html">goo.panel</a>
- </li>
- <li>
- <a href="../modules/goo.progressbar.html">goo.progressbar</a>
- </li>
- <li>
- <a href="../modules/goo.text.html">goo.text</a>
- </li>
- <li>
- <a href="../modules/goo.textinput.html">goo.textinput</a>
- </li>
- </ul>
- <!-- File list -->
- </div><!-- id="navigation" -->
- <div id="content">
- <h1>Module <code>goo.object</code></h1>
- <p>This is the superclass for all goo objects, every object can access it's methods</p>
- <h2>Functions</h2>
- <table class="function_list">
- <tr>
- <td class="name" nowrap><a href="#goo.object:addToParent">goo.object:addToParent</a> (parent)</td>
- <td class="summary">This will hook the object onto the given parent </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:draw">goo.object:draw</a> ()</td>
- <td class="summary">Internal </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:enterHover">goo.object:enterHover</a> ()</td>
- <td class="summary">Callback function when the mouse enters the bounds of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:exitHover">goo.object:exitHover</a> ()</td>
- <td class="summary">Callback function when the mouse exits the bounds of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:getAbsolutePos">goo.object:getAbsolutePos</a> (x, y)</td>
- <td class="summary">Gets the absolute position of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:getAbsoluteScale">goo.object:getAbsoluteScale</a> (x, y)</td>
- <td class="summary">Gets the absolute scale of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:getRelativePos">goo.object:getRelativePos</a> (x, y)</td>
- <td class="summary">Get the relative position of an object </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:getRelativeScale">goo.object:getRelativeScale</a> (xscale, yscale)</td>
- <td class="summary">Get the relative scale of an object </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:initialize">goo.object:initialize</a> (parent)</td>
- <td class="summary">Internal function called from goo.object:new() </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:isMouseHover">goo.object:isMouseHover</a> ()</td>
- <td class="summary">is the mouse over the object? </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:mousePressed">goo.object:mousePressed</a> (x, y, button)</td>
- <td class="summary">Internal </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:mouseReleased">goo.object:mouseReleased</a> (x, y, button)</td>
- <td class="summary">Internal </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:onClick">goo.object:onClick</a> (x, y, button)</td>
- <td class="summary">Callback function when the object is clicked.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:removeFromParent">goo.object:removeFromParent</a> ()</td>
- <td class="summary">This will remove the object from it's parent, it will not remove it completely.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:resetStyle">goo.object:resetStyle</a> ()</td>
- <td class="summary">Resets the objects style to the one defined in style.lua </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setColor">goo.object:setColor</a> (colorTable)</td>
- <td class="summary">Internal function used to set the drawing color, used instead of love.graphics.setColor.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setOpacity">goo.object:setOpacity</a> (opacity)</td>
- <td class="summary">Sets the opacity of the object </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setPos">goo.object:setPos</a> (x, y)</td>
- <td class="summary">Sets the position of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setScale">goo.object:setScale</a> (x, y)</td>
- <td class="summary">Sets the scale of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setSize">goo.object:setSize</a> (w, h)</td>
- <td class="summary">Sets the size of the position and updates the bounds.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setStyle">goo.object:setStyle</a> (style)</td>
- <td class="summary">Sets the style of the object.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:setVisible">goo.object:setVisible</a> (visible)</td>
- <td class="summary">Set whether the object should be drawn.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:sizeToText">goo.object:sizeToText</a> ()</td>
- <td class="summary"> </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:styleDidUpdate">goo.object:styleDidUpdate</a> ()</td>
- <td class="summary">Called after goo.object:setStyle </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:update">goo.object:update</a> (dt)</td>
- <td class="summary">Internal </td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#goo.object:updateBounds">goo.object:updateBounds</a> ()</td>
- <td class="summary">Updates the bounds of the object.</td>
- </tr>
- </table>
- <br/>
- <br/>
- <h2><a name="functions"></a>Functions</h2>
- <dl class="function">
- <dt><a name="goo.object:addToParent"></a><span>goo.object:</span><strong>addToParent</strong> ( parent )</dt>
- <dd>
- <p class="func_description">This will hook the object onto the given parent</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>parent</b> <i><small>:goo_object</small></i><br/>the goo object to hook on to
- </li>
-
-
- </ul>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="">
- goo.object:removeFromParent
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:draw"></a><span>goo.object:</span><strong>draw</strong> ( )</dt>
- <dd>
- <p class="func_description">Internal</p>
- </dd>
- <dt><a name="goo.object:enterHover"></a><span>goo.object:</span><strong>enterHover</strong> ( )</dt>
- <dd>
- <p class="func_description">Callback function when the mouse enters the bounds of the object.</p>
- </dd>
- <dt><a name="goo.object:exitHover"></a><span>goo.object:</span><strong>exitHover</strong> ( )</dt>
- <dd>
- <p class="func_description">Callback function when the mouse exits the bounds of the object.</p>
- </dd>
- <dt><a name="goo.object:getAbsolutePos"></a><span>goo.object:</span><strong>getAbsolutePos</strong> ( x, y )</dt>
- <dd>
- <p class="func_description">Gets the absolute position of the object. <br/>This function moves up through the entire instance hierarchy returning it's absolute position. <br/>If the parent object is at position 10,10 then obj:getRelativePos(5,5) returns 15,15</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>x</b> <i><small>:number</small></i><br/>the relative x position. (defaults to objects x position)
- </li>
-
-
-
- <li>
- <b>y</b> <i><small>:number</small></i><br/>the relative y position. (defaults to objects y position)
- </li>
-
-
- </ul>
- <h3>Return values:</h3>
- <ol>
-
- <li>number: absolute x position.
-
- <li>number: absolute y position.
-
- </ol>
- </dd>
- <dt><a name="goo.object:getAbsoluteScale"></a><span>goo.object:</span><strong>getAbsoluteScale</strong> ( x, y )</dt>
- <dd>
- <p class="func_description">Gets the absolute scale of the object.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>x</b> <i><small>:number</small></i><br/>the x scale (0-1) (defaults to objects x scale)
- </li>
-
-
-
- <li>
- <b>y</b> <i><small>:number</small></i><br/>the y scale (0-1) (defaults to objects y scale)
- </li>
-
-
- </ul>
- <h3>Return values:</h3>
- <ol>
-
- <li>number: the absolute x scale (0-1)
-
- <li>number: the absolute y scale (0-1)
-
- </ol>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="">
- goo.object:getAbsolutePos
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:getRelativePos"></a><span>goo.object:</span><strong>getRelativePos</strong> ( x, y )</dt>
- <dd>
- <p class="func_description">Get the relative position of an object</p>
- </dd>
- <dt><a name="goo.object:getRelativeScale"></a><span>goo.object:</span><strong>getRelativeScale</strong> ( xscale, yscale )</dt>
- <dd>
- <p class="func_description">Get the relative scale of an object</p>
- </dd>
- <dt><a name="goo.object:initialize"></a><span>goo.object:</span><strong>initialize</strong> ( parent )</dt>
- <dd>
- <p class="func_description">Internal function called from goo.object:new()</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>parent</b> <i><small>:goo_object</small></i><br/>the parent class to use.
- </li>
-
-
- </ul>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="../modules/goo.html">
- goo
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:isMouseHover"></a><span>goo.object:</span><strong>isMouseHover</strong> ( )</dt>
- <dd>
- <p class="func_description">is the mouse over the object?</p>
- <h3>Return value:</h3>
- <p class="func_return">bool: returns true if the mouse is over the object. false otherwise.</p>
- </dd>
- <dt><a name="goo.object:mousePressed"></a><span>goo.object:</span><strong>mousePressed</strong> ( x, y, button )</dt>
- <dd>
- <p class="func_description">Internal</p>
- </dd>
- <dt><a name="goo.object:mouseReleased"></a><span>goo.object:</span><strong>mouseReleased</strong> ( x, y, button )</dt>
- <dd>
- <p class="func_description">Internal</p>
- </dd>
- <dt><a name="goo.object:onClick"></a><span>goo.object:</span><strong>onClick</strong> ( x, y, button )</dt>
- <dd>
- <p class="func_description">Callback function when the object is clicked. <br/>If this function exists it will be called when the mousePressed event occurs within the object's bounds.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>x</b> <i><small>:number</small></i><br/>the absolute x position of the mouse.
- </li>
-
-
-
- <li>
- <b>y</b> <i><small>:number</small></i><br/>the absolute y position of the mouse.
- </li>
-
-
-
- <li>
- <b>button</b> <i><small>:string</small></i><br/>the button pressed. 'l' for left, 'r' for right, 'm' for middle.
- </li>
-
-
- </ul>
- <h3>Usage:</h3>
- <pre class='example'> local button = goo.button:new()<br /> button.name = 'bob'<br /> function button:onClick(x,y,button)<br /> if button == 'l' then<br /> print(self.name .. ' has been clicked')<br /> end<br /> end<br /> -- when the button is clicked with left mouse button it prints:<br /> -- bob has been clicked</pre><br />
- </dd>
- <dt><a name="goo.object:removeFromParent"></a><span>goo.object:</span><strong>removeFromParent</strong> ( )</dt>
- <dd>
- <p class="func_description">This will remove the object from it's parent, it will not remove it completely. <br/>This can be used to unhook an object from it's parent preventing it from inheriting position. <br/>You could also bring an object to the top by calling removeFromParent followed by addToParent but <br/>there is a convient function <a href='#bringToTop'>bringToTop</a> for that.</p>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="">
- goo.object:addToParent
- </a>
-
- <li><a href="">
- goo.object:bringToTop
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:resetStyle"></a><span>goo.object:</span><strong>resetStyle</strong> ( )</dt>
- <dd>
- <p class="func_description">Resets the objects style to the one defined in style.lua</p>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="">
- goo.object:setStyle
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:setColor"></a><span>goo.object:</span><strong>setColor</strong> ( colorTable )</dt>
- <dd>
- <p class="func_description">Internal function used to set the drawing color, used instead of love.graphics.setColor. <br/>You should not need to use this unless you're overriding an objects draw method. <br/>It's much like love.graphics.setColor except it takes a table and respects the objects opacity methods.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>colorTable</b> <i><small>:table</small></i><br/>a table of 3 or 4 color values {r,g,b,a} the values should have no keys. Alpha is optional.
- </li>
-
-
- </ul>
- </dd>
- <dt><a name="goo.object:setOpacity"></a><span>goo.object:</span><strong>setOpacity</strong> ( opacity )</dt>
- <dd>
- <p class="func_description">Sets the opacity of the object</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>opacity</b> <i><small>:number</small></i><br/>the opacity value (0-255)
- </li>
-
-
- </ul>
- </dd>
- <dt><a name="goo.object:setPos"></a><span>goo.object:</span><strong>setPos</strong> ( x, y )</dt>
- <dd>
- <p class="func_description">Sets the position of the object.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>x</b> <i><small>:number</small></i><br/>x position
- </li>
-
-
-
- <li>
- <b>y</b> <i><small>:number</small></i><br/>y position
- </li>
-
-
- </ul>
- </dd>
- <dt><a name="goo.object:setScale"></a><span>goo.object:</span><strong>setScale</strong> ( x, y )</dt>
- <dd>
- <p class="func_description">Sets the scale of the object.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>x</b> <i><small>:number</small></i><br/>x scale (0-1)
- </li>
-
-
-
- <li>
- <b>y</b> <i><small>:number</small></i><br/>y scale (0-1)
- </li>
-
-
- </ul>
- </dd>
- <dt><a name="goo.object:setSize"></a><span>goo.object:</span><strong>setSize</strong> ( w, h )</dt>
- <dd>
- <p class="func_description">Sets the size of the position and updates the bounds.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>w</b> <i><small>:number</small></i><br/>width of the object
- </li>
-
-
-
- <li>
- <b>h</b> <i><small>:number</small></i><br/>height of the object
- </li>
-
-
- </ul>
- </dd>
- <dt><a name="goo.object:setStyle"></a><span>goo.object:</span><strong>setStyle</strong> ( style )</dt>
- <dd>
- <p class="func_description">Sets the style of the object. <br/>each object has a style similar to CSS stylesheets. <br/>You can find these styles in goo/skins/{current skin}/style.lua <br/>This function's purpose is to override the styles defined in style.lua. <br/>To override pass a table with the same keys but you're overridden values.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>style</b> <i><small>:table</small></i><br/>the <a href='goo.html#style'>style</a> which will override the style set in style.lua
- </li>
-
-
- </ul>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="../modules/goo.html#style">
- goo.style
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:setVisible"></a><span>goo.object:</span><strong>setVisible</strong> ( visible )</dt>
- <dd>
- <p class="func_description">Set whether the object should be drawn.</p>
- <h3>Parameters</h3>
- <ul>
-
-
- <li>
- <b>visible</b> <i><small>:bool</small></i><br/>Should the object be drawn?
- </li>
-
-
- </ul>
- </dd>
- <dt><a name="goo.object:sizeToText"></a><span>goo.object:</span><strong>sizeToText</strong> ( )</dt>
- <dd>
- <p class="func_description"></p>
- </dd>
- <dt><a name="goo.object:styleDidUpdate"></a><span>goo.object:</span><strong>styleDidUpdate</strong> ( )</dt>
- <dd>
- <p class="func_description">Called after goo.object:setStyle</p>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="">
- goo.object:setStyle
- </a>
-
- </ul>
- </dd>
- <dt><a name="goo.object:update"></a><span>goo.object:</span><strong>update</strong> ( dt )</dt>
- <dd>
- <p class="func_description">Internal</p>
- </dd>
- <dt><a name="goo.object:updateBounds"></a><span>goo.object:</span><strong>updateBounds</strong> ( )</dt>
- <dd>
- <p class="func_description">Updates the bounds of the object. <br/>The bounds of the object are 4 points, representing the bounding box. <br/>This box is used to detect mouse events.</p>
- </dd>
- </dl>
- </div> <!-- id="content" -->
- </div> <!-- id="main" -->
- <div id="about">
- <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
- </div> <!-- id="about" -->
- </div> <!-- id="container" -->
- </body>
- </html>
|