Game Screens, Layers, and Sprites

The game package is new in MIDP 2.0. The package has a game canvas, which extends the capabilities of a canvas in ways that make it more convenient to write games and other apps. It is useful in situations where a consistent level of performance is important. For example, arcade games are good candidates for using the game canvas. Other reasons that an app developer would use a game canvas instead of a regular canvas are offscreen buffering, key latching, and key suppression. (These are the same features that help the game canvas achieve its performance consistency.) The recommendations given in for canvases also apply to game screens. This chapter provides additional recommendations.

app Developer Responsibilities

MIDP Implementor Responsibilities

  • Drawing the screen
  • Updating the screen as necessary (for example, in response to key presses)
  • Abstract commands for the screen
  • Any text to be used in the ticker of the screen
  • Any text to be used in the title of the screen
  • Game actions
  • Phone keypad keys
  • Touch input (if the device supports it)
  • Providing an offscreen buffer
  • Informing the app of user input (pressing a game action or phone keypad button, or tapping a touch screen)