JAVA 1.5 GP2X DEVKIT per Windows
Version 1.0 Beta 2.0
22 October 2006


<<<<<<<<<<<<<<<<<< THE APPLICATION LAUNCHER:

The AppLauncher is more than a simple frontend to start java apps, it provides some degree of freedom by standardising the GP2X lowlevel initialization and managing tasks like monitoring the battery.

Writing an application for the AppLauncher involves creating the appropriate properties file and writing the code in the way AppLauncher expects.

To be able to start your app, the Launcher looks for a specifies Class, and for a specifies Method inside this class, for example, this is the HelloWorld main class, somewhat reduced for clarity:

public class Hello
{
  private GP2x gp2x = null;
  
  // CONSTRUCTOR
  //
  public Hello(GP2x gp2x) throws Exception
  {
    // initialize the screen/joystick hardware devices
    //
    this.gp2x = gp2x;

    // Root Path
    //
    String ApplicationRootPath = System.getProperty("application.root.path");
    if (ApplicationRootPath == null)
      ApplicationRootPath = "." + File.separator;
    else
      ApplicationRootPath += File.separator;
  }


  public void mainGameLoop()
  {
      while (!finished)
          ...
  }
}


This is the basic structure of a Class for AppLauncher, it has a Constructor that accepts an instance of GP2x Class and a void methos mainGameLoop().

The Constructor receives the GP2x Object already correctly initialized and configured, this is the main interface between Java and the GP2X, and is used basically to draw on the screen.

Once constructed an instance of your class, AppLauncher calls your main method, in this case is mainGameLoop().

When this method returns, your application is considered terminated and the AppLauncher restarts its interface to select another app.



<<<<<<<<<<<<<<<<<< THE APPLAUNCHER PROPERTIES FILE:

This is the Hello World properties file, please read the comments.


# This is AppLauncher Properties information file
#

###############################
# App Base Root is defined to be the full path containing this file.
###############################

# Main JAR, Main Class and its Main Method to be invoked to start the app,
# the app terminates when its Main Method does.
# the Main JAR location is relative to the App Base Root
# defaults are: app.jar, gp2x.app.AppLauncherMain and AppLauncherStart
#
applauncher-main-jar=hello.jar
applauncher-main-class=val.games.hello.Hello
applauncher-main-method=mainGameLoop

# Application Name and Application Logo File relative to App Base Root.
# defaults are: "No Name" and no logo
#
applauncher-app-name=Hello World !!!
applauncher-app-logo=hello.bmp

# Extra classpath items, directory with trailing /, JAR or ZIP files, all relative to App Base Root.
# applauncher-extra-cp-count defaults to zero.
#
# First is the count of subsequent lines, for example :
# applauncher-extra-cp-count=3
# applauncher-extra-cp-item-1=path/
# applauncher-extra-cp-item-2=lib/file.jar
# applauncher-extra-cp-item-3=lib/file.zip
#
# Hello World has no extra classpath requirements

# Hello World wants the provided battery monitor (this is the default if not specified)
# if this property is false, the application has to provide its own mechanism to monitor battery.
applauncher-battery-monitor=true

# Hello world has not clock requirement, stick to default (this is the default if not specified)
# if this value is a number different from zero, the AppLanuncher tries to set the CPU clock to this value
# expressed in MHz, currently there is a limit on the clock value, minimum 50 MHz and maximum 300 MHz
applauncher-cpu-clock=0

