Changes

Jump to navigation Jump to search

Changes in OS 3.2

26 bytes removed, 14:11, 5 June 2012
no edit summary
Line 6: Line 6:     
==Compatibility mode==
 
==Compatibility mode==
Let me first begin with the compatibility mode. TI has 2 "apiLevel's" in 3.2. apiLevel 1.0 provides backwards compatibility for &lt;3.2 OS's 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 crash). Lua 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. However, it is currently not possible to create apilevel 2.0 documents with [[Luna]] due to changes in the XML structure (Luna crash). Lua may get updated soon.<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"''
    
==on.create==
 
==on.create==
[[on.create]] is removed in apiLevel 2.0 and replaced with [[on.construction]].<br />
+
[[on.create]] is removed in apilevel 2.0 and replaced with [[on.construction]].<br />
 
This event handler is guaranteed to run before all others.<br />
 
This event handler is guaranteed to run before all others.<br />
   Line 19: Line 19:  
* [[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 />  
+
* In [[platform.apilevel|apilevel]] 2.0, [[platform.gc]]() is removed and replaced with [[platform.withGC]](). An example of it:<br />  
 
<syntaxhighlight>function getStringWidth(gc, str)
 
<syntaxhighlight>function getStringWidth(gc, str)
 
   return gc:getStringWidth(str)
 
   return gc:getStringWidth(str)

Navigation menu