Changes

Jump to navigation Jump to search

Changes in OS 3.2

284 bytes added, 03:14, 7 May 2014
Line 5: Line 5:  
==Compatibility mode==
 
==Compatibility mode==
 
TI has 2 "[[platform.apilevel|apilevel]]s" in 3.2. apilevel 1.0 provides backwards compatibility for &lt; 3.2 OSes by keeping the old API structure.<br />
 
TI has 2 "[[platform.apilevel|apilevel]]s" in 3.2. apilevel 1.0 provides backwards compatibility for &lt; 3.2 OSes by keeping the old API structure.<br />
'''All''' documents created for 3.1 and previous will run in that apilevel by default. This is because some changes in the XML structure of the document. So most programs and games should run fine by default.<br /> Then there is apilevel 2.0. This apilevel has some big changes to the API structure, so you will have to update some of your code in order to have some of they new 3.2 stuff. However, it is currently not possible to create apilevel 2.0 documents with [[Luna]] due to changes in the XML structure. Luna may get updated soon.<br />
+
'''All''' documents created for 3.1 and previous will run in that apilevel by default. This is because some changes in the XML structure of the document. So most programs and games should run fine by default.<br /> Then there is apilevel 2.0. This apilevel has some big changes to the API structure, so you will have to update some of your code in order to have some of they new 3.2 stuff.<br />
 
For the best support and guarantee that you are using the correct apilevel, you should add the following to the top of new Lua documents you create:
 
For the best support and guarantee that you are using the correct apilevel, you should add the following to the top of new Lua documents you create:
:''platform.apilevel = "1.0"'' or ''platform.apilevel = "2.0"''
+
:''platform.apilevel = "1.0"'' ( or ''platform.apilevel = "2.0"'' depending on what you plan to use)
    
==Events==
 
==Events==
Line 13: Line 13:  
* New : [[on.getFocus]] is called when the script receives user input focus.
 
* New : [[on.getFocus]] is called when the script receives user input focus.
 
* New : [[on.loseFocus]] is called when the script loses user input focus.
 
* New : [[on.loseFocus]] is called when the script loses user input focus.
* New : [[on.getSymbolList]] is called when the script app symbol list is being serialized to the clipboard.  
+
* New : [[on.getSymbolList]] is called when the script app symbol list is being serialized to the clipboard.
 +
* Changed : if the mouse ([[cursor]]) is not shown whenever the user presses the center button of the clickpad/touchpad, [[on.mouseDown]] is now fired, with its parameters x and y being both 0.
    
==Graphical operations==  
 
==Graphical operations==  
Line 19: Line 20:  
* [[gc:setColorRGB]] now supports one number as input (as well as the old style). For example, you can do [[gc:setColorRGB]](0xFF00CC) or [[gc:setColorRGB]](0)
 
* [[gc:setColorRGB]] now supports one number as input (as well as the old style). For example, you can do [[gc:setColorRGB]](0xFF00CC) or [[gc:setColorRGB]](0)
 
* You can not use coordinates for drawing to the screen above/under (-) 32 000. (Be careful, some scripts might need to take that into account now, or they may crash)
 
* You can not use coordinates for drawing to the screen above/under (-) 32 000. (Be careful, some scripts might need to take that into account now, or they may crash)
* In [[platform.apilevel|apilevel]] 2.0, [[platform.gc]]() is removed and replaced with [[platform.withGC]](). An example of it:<br />  
+
* [[gc:clipRect]] doesn't have the ''intersect'' option anymore.
 +
* In [[platform.apilevel|apilevel]] 2.0, [[platform.gc]]() is removed and replaced with [[platform.withGC]](). Usage example:<br />  
    
<syntaxhighlight>function getHeightWidth(str, gc)
 
<syntaxhighlight>function getHeightWidth(str, gc)
Line 27: Line 29:  
end
 
end
 
height, width = platform.withGC(getHeightWidth, 'Hello World')</syntaxhighlight>
 
height, width = platform.withGC(getHeightWidth, 'Hello World')</syntaxhighlight>
So what it does it call the function you give as first argument and pass a dummy [[gc|GC]] (Graphics Context) to it.
+
What it does is calling the function you give as first argument, and additionally passing a dummy [[gc|GC]] (Graphics Context) to it.
    
==D2Editor==
 
==D2Editor==
Line 58: Line 60:     
==Physics==
 
==Physics==
Maybe the best part of it : OS 3.2 now includes the Open Source Chipmunk [[Physics_Engine|Physics engine]], and you can use it right from Lua!<br /> This will allow some great games and applications <br /> Find all the functions/categories [[Category:Physics_Engine|here]].Tutorials about it coming soon.<br />
+
Maybe the best part of it : OS 3.2 now includes the Open Source Chipmunk [[Physics_Engine|Physics engine]], and you can use it right from Lua!<br /> This will allow some great games and applications <br /> Find all the functions/categories [[:Category:Physics_Engine|here]] (WIP !).Tutorials about it coming soon.<br />
    
==Image==
 
==Image==
Line 78: Line 80:     
==Variable==
 
==Variable==
* [[var.recallAt]], fetch data from a certain spot in a list or matrix<br />
+
* [[var.recallAt]] : fetches data from a certain spot in a list or matrix<br />
* [[var.makeNumericList]], creates a list in the symbol table with the given name. The list is optimized to hold numeric values.
+
* [[var.storeAt]] : Stores a numeric value into an element of a math list or matrix with the given name.<br />
 +
* [[var.makeNumericList]] : creates a list in the symbol table with the given name. The list is optimized to hold numeric values.

Navigation menu