e3roid version 1.2.8 has been released!

The new version 1.2.8 of e3roid framework has been released!

https://code.google.com/p/e3roid/

This new e3roid 1.2.8 are minor release that delivers:

  • FIX: TMX map and tiled sprite goes blank after returning from onPause()
  • FIX: parameter mismatch (int->float) around Camera#moveCenter, Camera#moveEye

Note: e3roid version 1.2.2 through 1.2.7 are deprecated because these version contains problem about moving Cameras and tiled map drawing issues after onPause(). It is recommended for everyone to upgrade to the latest version of e3roid.

Have fun with e3roid!

Listening on every frame

From e3roid version 1.2.2, com.e3roid.event.FrameListener interface
has added for listening on every frame. By using FrameListener, writing frame
listener has become rather easy.

FrameListener has two methods.

public interface FrameListener {
        // called before drawing frame
        void beforeOnDraw(E3Scene scene, GL10 gl);
        // called after drawing frame
        void afterOnDraw(E3Scene scene, GL10 gl);
}

… in activity class, just implement above interface.

public class ListenOnEveryFrameExample extends E3Activity implements
FrameListener {
        // snip
        @Override
        public E3Scene onLoadScene() {
                E3Scene scene = new E3Scene();

                // add myself as frame listener
                scene.addFrameListener(this);
                return scene;
        }

        public void beforeOnDraw(E3Scene scene, GL10 gl) {
                // do something important before drawing frame
        }
        public void afterOnDraw(E3Scene scene, GL10 gl) {
                // do something important after drawing frame
        }

}

Have fun with e3roid!

e3roid version 1.2.5 has been released!

The new version 1.2.5 of e3roid framework has been released!

https://code.google.com/p/e3roid/

This new e3roid 1.2.5 is minor release that delivers:

  • Bug fix around switching between activities

For more details, refer to the thread of e3roid-discuss group.

Note: e3roid version 1.2.2 through 1.2.4 are deprecated because these version contains problem about switching between activities and tiled map scrolling issue around WVGA screens. It is recommended for everyone to upgrade to the latest version of e3roid.

Have fun with e3roid!

Setting up E3roidExamples with Eclipse

This tutorial shows you how to setup E3roidExamples with Eclipse IDE.

First of all, make sure Android SDK and Eclipse IDE is installed on your PC. If not installed, the following link Android Developers and Talk Android describes how to setup Android SDK with Eclipse.

After installing Android SDK and Eclipse IDE, your PC is ready to install e3roid game framework. Download the latest e3roid source distribution(e3roid-source-X.X.zip) from Google code project page and unzip it to appropriate directory. Copy E3roidExamples folder from source distribution and copy them to your Eclipse workspace directory.

Create E3roidExamples/bin and E3roidExamples/gen directory if these directory does not exist. Eclipse may produce some weird errors if these directory does not found so make sure these directory exist before starting Eclipse.

After starting Eclipse, import the E3roidExamples by selecting “File” -> “Import” menu, and import the E3roidExamples directory. After that, you might see the first automatic build is succeed or not. If you find “Android requires .class compatibility set to 5.0″ error in the Eclipse’s console, right click on the project -> Properties -> Java Compiler -> Compiler compliance level to 1.5 and then rebuild the project.

This build after setting level to 1.5 must fail because e3roid’s source uses some kind of annotation (@Override and @Deprecated) used with Compiler level 1.6. So it is needed to set back the property. Right click on the project -> Properties -> Java Compiler -> Compiler compliance level to 1.6 and then rebuild the project.

It is also OK to keep compiler level to 1.5 but you have to remove all annotations (@Override and @Deprecated so on) to build e3roid examples. If you faces “Refreshing external folders” error, try close the project and re-open it. Despite of after following those steps, Eclipse may produce some kind of weird errors that never tell us the possible solution at times. If you face that kind of errors, try to “clean the project” or delete the project and reset from the first step or just ignore these errors if possible. :(

e3roid version 1.2.4 has been released!

The new version 1.2.4 of e3roid framework has been released!

https://code.google.com/p/e3roid/

This new e3roid 1.2.4 is minor release that delivers:

  • Huge performance improvement for TMX tiled map rendering

This maintenance release delivers HUGE performance improvement for TMX tiled map that can render so smoothly. Everyone who uses TMXTiledMap is recommended to update to the latest version of e3roid.

Note: e3roid version 1.2.2 through 1.2.3 are deprecated because these version contains tiled map scrolling issue around WVGA screens.

Have fun with e3roid!

e3roid version 1.2.2 has been released!

The new version 1.2.2 of e3roid framework has been released!

https://code.google.com/p/e3roid/

This new e3roid 1.2.2 is minor release that delivers:

  • Improve TMX tiled map performance
  • Added FrameListener that can listen on every frame

Have fun with e3roid!

Implementing Splash Screen

This tip illustrates how to implement your own splash screen. Below example shows how to show the splash image and then proceed to the next activity.

First of all, you have to create the splash screen sprite and add it to the scene. In onLoadResources block, E3Scene#registerUpdateListener must be called so that update listener method will be executed after the seconds is elapsed.

	@Override
	public void onLoadResources() {
		logoTexture = new AssetTexture("logo.png", this);
	}

	@Override
	public E3Scene onLoadScene() {
		E3Scene scene = new E3Scene();

		// start next activity after waiting 3 seconds.
		scene.registerUpdateListener(3, this);

		logo = new Sprite(logoTexture, centerX, centerY);

		// snip other initializations..

		// show the splash image
		scene.getTopLayer().add(logo);

		return scene;
	}

Because update listener is registered to the scene, onUpdateScene will be called after showing splash screen in 3 seconds. Within this block, un-register the update listener and start next activity, and then finish this slpash screen.

	@Override
	public void onUpdateScene(E3Scene scene, long elapsedMsec) {
		scene.unregisterUpdateListener(this);
		startActivity(new Intent(this, Launcher.class));
		finish();
	}

Splash screen example is included in the E3roidExamples source. Refer to the SplashScreenActivity example in the source distribution for details.

Game Engine Architecture

I recently bought the book “Game Engine Architecture” published by A K PETERS. I’ve heard that this book is excellent, so I will be digging into the book and hopefully will apply those architectural ideas to e3roid framework too…

e3roid version 1.2.1 has been released!

The new version 1.2.1 of e3roid framework has been released!

https://code.google.com/p/e3roid/

This new e3roid 1.2.1 is minor release that delivers:

  • Added TGA formatted image file support
  • Check OpenGL errors strictly
  • Use SystemClock.uptimeMillis instead of System.currentTimeMillis to check elapsed msec
  • Update javadoc and source comments

Have fun with e3roid!

Supporting Multiple Screens(5)

The new resolution policy RESOLUTION_FIXED_RATIO_WITH_ROTATION has been added from e3roid version 1.1. Here is the example.

private final static int WIDTH  = 320;
private final static int HEIGHT = 480;

@Override
public E3Engine onLoadEngine() {
    E3Engine engine = new E3Engine(this, WIDTH, HEIGHT,
        E3Engine.RESOLUTION_FIXED_RATIO_WITH_ROTATION);
    return engine;
}

RESOLUTION_FIXED_RATIO_WITH_ROTATION resolution policy is almost similar to RESOLUTION_FIXED_RATIO, but also has feature of ‘auto rotation’ that is suitable for splash screens which need to rotate the ratio whenever the screen has been rotated. If the screen orientation is portrait, the screen has 320×480 dimension.

If the screen orientation is changed to landscape, the screen has 480×320 dimension.

This policy rotates the ratio whenever the screen orientation has been changed. This policy is suitable for splash screens which needs to display the same image whenever the screen has been rotated.