Game Development Reference
In-Depth Information
The screen in Codea is a bit different from other frameworks. In most frameworks, the top-left
corner is the origin (0, 0), and the x-axis value increases moving right and the y-axis value increasing
moving downward. In Codea, the lower-left corner is the origin, and the x-axis value increments as it
moves to the right and the y-axis increases as it moves upward.
Secondly, because of the side panels, the screen is obscured, and the size reported is 750×768
in landscape mode and 494×1024 in portrait mode. You can remove this panel by calling the
displayMode(FULLSCREEN) function. However, even in full-screen mode, the buttons as seen at the
bottom of the screen in Figure 12-2 above, still remain. To remove the buttons as well, you can use
the displayMode(FULLSCREEN_NOBUTTONS) function.
If you use the displayMode function with the FULLSCREEN_NO_BUTTONS , argument, you need to
manually call the close function to return back to the editor.
Orientation
The orientation for your Codea app can be set using the supportedOrientation function. The default
value for supportedOrientation is ANY , which supports all orientations. However, you can preset it to
the ones that you need.
The options are
ANY
LANDSCAPE_ANY
LANDSCAPE_LEFT
LANDSCAPE_RIGHT
PORTRAIT
PORTRAIT_ANY
PORTRAIT_UPSIDE_DOWN
System Keyboard
The keyboard can be displayed or hidden as needed using the showKeyboard and hideKeyboard
functions. There is another keyboard-related function, keyboardBuffer , which returns the text in
the keyboard buffer. Every time the keyboard is shown, the keyboard buffer is cleared. Here is an
example of using the showKeyboard and keyboardBuffer functions:
function touched(touch)
showKeyboard()
end
function draw()
background(40,40,50)
fill(255)
textMode(CORNER)
 
Search WWH ::




Custom Search