It's alive! Absurd Engine mobile: program a game once in Java; compile it natively for Android and iOS. The test program that you see running moves a sprite around the screen on a one-second timer. Here's the code:
public class Game extends GameView
{
public Game(Context context)
{
super(context);
face = new Sprite(BitmapFactory.decodeResource(AbsurdGameTest.res, R.drawable.testface), 0, 0);
jumpTimer = new Timer(1, this, new Delegate()
{
public void function()
{
face.location.set((int)(Math.random()*getWidth()), (int)(Math.random()*getHeight()));
}
});
jumpTimer.start();
}
@Override
public void onDraw(Canvas canvas)
{
canvas.drawBitmap(face.bitmap, face.location.x, face.location.y, null);
}
private Sprite face;
private Timer jumpTimer;
}
There's a lot going on behind the scenes here. Notice that I've implemented delegates in Java! Less obviously, game rendering and logic (such are timing) are updated from separate threads, which makes everything silky smooth, even across platforms.
My goal in this project is to simplify simple mobile development. There's an intimidating amount of overhead involved in just getting a stable game loop running on a mobile device - I want to prototype crazy ideas as fast as they come to me without having to deal with thread concurrency issues! On that note, I want to make the unique features of mobile devices - accelerometers, GPSes, etc - as accessible to develop for as possible.