O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java™ ME Game Programming, Second Edition

Book Description

Get ready to create your own J2ME game! This updated edition to the popular J2ME Game Programming provides updated sofware coverage as well as updates to the programming approaches specific to Java ME software. It also covers the recent innovations in mobile games with relations to iPods and cell phones. You will learn the essentials of J2ME game development from the ground up. Throughout the book you will discover the issues involved in developing for multiple target devices and how to work through the jungle of device-specific libraries and device capabilities. Working on a limited platform it is important to squeeze as much as you can out of those precious bytes, so in this book you will find the tools and source code you need to get the most out of the constrained resources. You will also learn how to structure your code and classes to achieve as small an application footprint as possible. As you work toward developing your own J2ME game, you'll examine the game lifecycle, how to handle resources, various methods of drawing to the screen, optimizing memory usage, handling the users input, and even sharing high-scores online! Previous experience in programming object-oriented languages and a basic level of math skills is recommended.

Table of Contents

  1. Copyright
  2. Acknowledgments
  3. About the Authors
  4. About This Book
  5. Mobile Device Fundamentals
    1. Java ME History
      1. Java’s Acorn
      2. Java’s Growth in the Sun
      3. What Is Java?
      4. Multiple Editions
      5. Mobile Information Devices Everywhere
      6. Micro Devices and Software
      7. Conclusion
    2. Java ME Overview
      1. A Comprehensive Toolkit
      2. The CDC
      3. The CLDC
      4. CLDC Target Device Characteristics
      5. CLDC Security Model
      6. Application Management
      7. Restrictions
      8. JVM Differences
      9. CLDC Packages and Class Libraries
      10. MIDP
      11. MIDP Packages and Class Libraries
      12. MIDP 2.0 Game Package
      13. MID Applications
      14. MIDP 2.0 and MIDP 1.0
      15. Conclusion
    3. Java ME-Enabled Devices
      1. MID Overview
      2. Nokia
      3. Sony Ericsson
      4. Motorola
      5. Conclusion
  6. Setting Up for Development
    1. The JDK, the MIDP, and a MIDlet Suite
      1. Getting the Tools
      2. Installing and Setting Up the JDK
      3. Installing and Setting Up the MIDP
      4. Setting Up a Working Directory
      5. Creating a MIDlet
      6. Creating the Full Package
      7. Conclusion
    2. Using the Java Wireless Toolkit 2.5
      1. Development Settings
      2. The Java Wireless Toolkit
      3. Creating a New Project
      4. Conclusion
    3. Using NetBeans
      1. The NetBeans IDE
      2. Adding Mobility
      3. Creating a MIDlet Project
      4. Adding Code
      5. The JAD and JAR Files
      6. Conclusion
  7. Text-Oriented Activities
    1. Java ME API BASICS
      1. MIDP API Overview
      2. The MIDlet Class
      3. Using Timer and TimerTask Objects
      4. Networking
      5. Conclusion
    2. Persistence with the RMS
      1. Persistence
      2. Record Enumerations and Record Stores
      3. Using a RecordComparator Object
      4. Using a RecordFilter Object
      5. Using RecordListener Objects
      6. Conclusion
    3. User Interface Basics
      1. User Interface (LCDUI)
      2. Class Hierarchy
      3. Display and Displayable
      4. The NameGameTest Class
      5. Lists
      6. Lists with Single Selection
      7. Lists with Multiple Selection
      8. Conclusion
  8. Using Graphics
    1. Forms and Items
      1. General Features of the Item and Form Classes
      2. The Form Class
      3. TextField
      4. Playing with Numbers
      5. StringItem
      6. The ItemPlayTest Class
      7. Conclusion
    2. Images and Choices
      1. ChoiceGroup
      2. The ComedyChoiceGroup Class
      3. ImageItem and Image
      4. The ImageItemFind Class
      5. Conclusion
    3. Gauges, Dates, Calendars
      1. Calendar and Date
      2. DateField
      3. The CalendarFortune Class
      4. Gauge
      5. The SonnetMaker Class
      6. Conclusion
  9. Game Orientation
    1. Canvas, Graphics, Thread
      1. Canvas
      2. CGExplorer
      3. Extended Canvas Work
      4. GameStart
      5. GSCanvas
      6. GSCanvas Definition and Construction
      7. Conclusion
    2. The Game API
      1. The Game API
      2. GameCanvas
      3. SpritePlay
      4. TiledLayer
      5. Key Events
      6. Parent Classes
      7. Conclusion
    3. The Game API and Game Implementation
      1. Diamond Dasher
      2. DasherStart
      3. DasherSprite
      4. Definition and Construction
      5. DasherCanvas
      6. Construction and Definition
      7. Conclusion
  10. Scrolling Background
    1. ScrollStart
    2. ScrollCanvas