Changes

Jump to navigation Jump to search

Changes in OS 3.2

61 bytes added, 23:44, 6 June 2012
Line 20: Line 20:  
* 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)
+
 
  return gc:getStringWidth(str)
+
<syntaxhighlight>function getHeightWidth(str, gc)
 +
    local width = gc:getStringWidth(str) -- Gets the pixel length of str
 +
    local height = gc:getStringHeight(str) -- Gets the pixel height of str
 +
    return height, width
 
end
 
end
function on.construction() -- was on.create before
+
height, width = platform.withGC(getHeightWidth, 'Hello World')</syntaxhighlight>
  local strw = platform.withGC(getStringWidth, "The game") -- was platform.gc() before
  −
end</syntaxhighlight>
   
So what it does it call the function you give as first argument and pass a dummy [[gc|GC]] (Graphics Context) to it.
 
So what it does it call the function you give as first argument and pass a dummy [[gc|GC]] (Graphics Context) to it.
  

Navigation menu