Introduces the MIDP 2.0 GameCanvas class and the game loop concept. Required reading for all aspiring "first person shooter" developers.
Tutorial Details:
Many, perhaps most, of the early commercial applications developed on the J2ME platform were games. With all the obvious interest in gaming - and the many device-specific gaming extensions developed by different handset vendors - it was no surprise to anyone that the Java Community Process group responsible for defining MIDP 2.0 introduced basic gaming capabilities. Let's take a look at the core of those capabilities, the GameCanvas class.
The GameCanvas class, found in the javax.microedition.lcdui.game package, extends the venerable Canvas class. As you know, Canvas lets an application draw screens using the low-level user-interface API, and also receive key and pointer events directly. The shortcoming of Canvas is that it gives the application no control over when a canvas repaints itself - all it can do is request a repaint - or over how quickly key and pointer events get delivered to the canvas. This lack of control can cause action games and others that are speed-sensitive to feel sluggish and unresponsive. GameCanvas was designed specifically to fix these weak points.
The first thing to remember, though, is that a game canvas is still a canvas, so all the usual behavior is there. The showNotify() and hideNotify() methods are still called when the canvas is shown and hidden. Key and pointer events are still delivered, except for certain key events which optionally can be suppressed. You still have to do all the drawing yourself, and you can still attach Command objects to the canvas. Here's a very simple test canvas you can use inside a MIDlet you run with the J2ME Wireless Toolkit 2.0 or higher:
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Game Canvas Basics
View Tutorial: Game Canvas Basics
Related
Tutorials:
Solve real problems with aglets, a type of
mobile agent - JavaWorld May 1997
Solve real problems with aglets, a type of
mobile agent - JavaWorld May 1997 |
Make room for JavaSpaces, Part 3 - JavaWorld March
2000
Make room for JavaSpaces, Part 3 - JavaWorld March
2000 |
Device programming with MIDP, Part
2 - JavaWorld
March 2001
Device programming with MIDP, Part
2 - JavaWorld
March 2001 |
J2ME: The next
major games
platform? - JavaWorld March 2001
J2ME: The next
major games
platform? - JavaWorld March 2001 |
Embed Java code into your
native apps -
JavaWorld May 2001
Embed Java code into your
native apps -
JavaWorld May 2001 |
Remote-control
Java
Remote-control
Java |
Develop state-of-the-art mobile
games
Develop state-of-the-art mobile
games |
Eye Of Newt -
LDAP Editor
Eye Of Newt - LDAP Editor |
Extensible Code Generation with Java, Part 1
Extensible Code Generation with Java, Part 1
Code generation is a key new trend in engineering, one that you need to understand well. The reason is simple: today's modern frameworks are extremely code-intensive. Using a code generator to build the code |
An Intelligent Nim Computer Game, Part 1
An Intelligent Nim Computer Game, Part 1
In this article, you learn how to play Nim, and discover tools for creating an intelligent computer player. In the next article, you apply those tools to the creation of that player, while building console and G |
Writing Ant Tasks
Writing Ant Tasks
A nice feature of Ant is that it is designed to allow you to add your own tasks and use them in an build. This article shows you the basics of writing an Ant task and how to get a task to work. |
JDBC scripting, Part 2
JDBC scripting, Part 2
Programming and Java scripting in JudoScript
Summary
JudoScript is a rich functional scripting language, and an easy and powerful general programming and Java scripting language.
JudoScript's power comes from its synergy of |
JMS Messaging Online Resource
JMS Messaging Online Resource
JMS Tutorials
JMS provides a way for Java programs to access an enterprise messaging system, also known as message oriented middleware (MOM). Check out the below tutorials.
|
Berkeley DB, Java Edition I: The Basics
The original version of Berkeley DB is written in C. This means that, up until now, if a Java programmer wanted to use Berkeley DB, she would have to use some sort of translation layer (for example, JNI) to handle the communication between Java and Berkel |
J2EE pathfinder: Implement JSP custom tags in five easy steps
JSP custom tags provide a standardized mechanism for separating presentation and business logic in a dynamic Web page, allowing page designers to focus on presentation while application developers code the back end. In this installment of J2EE pathfinder, |
A first look at Apache Geronimo
Start developing and deploying J2EE apps on the first open source J2EE server. When released, Geronimo will be the first J2EE-certified open source server. This article will give you the basics you need for developing and deploying J2EE applications on Ge |
Game Canvas Basics
Introduces the MIDP 2.0 GameCanvas class and the game loop concept. Required reading for all aspiring "first person shooter" developers. |
Writing a Custom Counter Component
MIDP 2.0 introduced the javax.microedition.lcdui.CustomItem class. As the name implies, a developer can now create custom UI components by extending the CustomItem class. This tech tip designs and implements a UI component for displaying a numeric counter |
Java Technology Fundamentals
Learn how to use variable arguments lists, the new JConsole utility to monitor applications, and discover ways to learn what you need to know to get Sun certified. |
Buy Peanut 9.6 Linux in India from us. Peanut 9.6 distribution is available in India.
Buy Peanut 9.6 Linux in India from us. Peanut 9.6 distribution is available in India.
Peanut 9.6 Linux
Now Available Peanut 9.6 Linux CD
It is a Linux OS (operating system), especially made for those new to Linux. This is the most POWERFUL and |
|
|
|