OLPCities/Interface: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This library is part of the <b>Gamelib</b>, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the [http://www.gnu.org/copyleft/lgpl.html GNU Library General Public Licence].
This library is part of the <b>Gamelib</b>, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the [http://www.gnu.org/copyleft/lgpl.html GNU Library General Public Licence].


To use this library (this Class) add this line to the <HEAD> section of the web page of the Lot:
To use this library (this Class) add one line to the <HEAD> section of the web page of the Lot.
<pre>
You need to click this link and "save" the library at the same folder of the web page or put it at another folder at the same server and make a reference:
<script language="Javascript" src="http://www.dmu.com/olpc/gamelib_interface.js"></script>
</pre>

Better to click this link and "save" the library at the same folder of the web page or put it at another folder at the same server and make a reference:


[http://www.dmu.com/olpc/gamelib_interface.js gamelib_interface.js ]
[http://www.dmu.com/olpc/gamelib_interface.js gamelib_interface.js ]
Line 24: Line 21:


<b>We do not use an object of this Class alone. We need to have, by example, an object of the Class [[Label]] added to it.</b>
<b>We do not use an object of this Class alone. We need to have, by example, an object of the Class [[OLPCities/Label|Label]] added to it.</b>


==Methods==
==Methods==
Line 54: Line 51:


==Properties==
==Properties==
<pre>

bgColor The current background color of the interface.

visible If true, the interface and its elements are visible.

x The x position of the interface.
y The y position of the interface.
z The z position of the interface.

</pre>

[[Category:OLPCities_JavaScript_Libraries]]

Latest revision as of 03:38, 14 February 2007

This library is part of the Gamelib, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the GNU Library General Public Licence.

To use this library (this Class) add one line to the <HEAD> section of the web page of the Lot.

You need to click this link and "save" the library at the same folder of the web page or put it at another folder at the same server and make a reference:

gamelib_interface.js

If you put it at the same folder, the line would be:

<script language="Javascript" src="gamelib_interface.js"></script> 

To create an "object" of the Class:

interface1=new In_Interface(200,200,'http://www.dmu.com/olpc'); 

The arguments are width, height and finally the path to the gamelib directory (the one containing all the gamelib_*.js files)


We do not use an object of this Class alone. We need to have, by example, an object of the Class Label added to it.

Methods


add(Object)              Adds an element to this interface. By example an object of the Class Label. 
 
hide()                  Hides the elements contained by the interface  

makeDraggable()          Makes the interface draggable. When dragged, all the elements 
                         the interface contains will move along with it.  

makeUndraggable()        Stops the interface from being draggable. 
 
moveTo(n,n)              Moves the interface to position x,y. This means all the elements contained 
                         by this interface will also be moved as an elements position is relative 
                         to the position of the interface that contains it.  

setBackground(URL of image) Sets a background image in the interface itself.  

setBgColor(Color)      Sets the background color of the interface itself. By default, interfaces 
                       are invisible.  

setZ(n)                Sets the Z index of the interface.   

show()                  Shows the elements contained by the interface  

Properties


bgColor                The current background color of the interface.   

visible                If true, the interface and its elements are visible.  

x                       The x position of the interface.    
y                       The y position of the interface.   
z                       The z position of the interface.