Game Development Reference
In-Depth Information
buffer = keyboardBuffer()
_, bufferHeight = textSize(buffer)
if buffer then
text (buffer, 10, HEIGHT - 30 - bufferHeight)
end
end
Drawing Mode
When you draw something, it is not automatically persisted, i.e. erased and needs to be redrawn
everytime. However, you can set the mode so that the previously drawn frame persists on the screen
backingMode to RETAINED . The default mode is
.
Note When the RETAINED mode is used with the new iPad, a bug in iOS5 does not work as expected.
It is however fixed by Apple in iOS6 and works as expected.
background function. This function takes the color
background(red, green, blue, alpha)
Pen Color
The pen color, or foreground color, that is used for all the drawing can be set using the stroke
function. The parameters that the stroke function takes are also in RGBA format.
stroke(0,0,0,255) -- Would set the pen color to black
Fill Color
The fill color can be set using the fill function. It is set in terms of arguments, similar to the
preceding two color functions.
fill(255,164,0) -- sets the fill color to orange
Line Width
The line width for the drawing can be altered using the strokeWidth function.
strokeWidth(3) -- sets the stroke width to 3
 
Search WWH ::




Custom Search