Dungeon Plus!!!

I’ve just created a new version of my Dungeon game featuring a custom user interface!!!

As I was saying the other day, the lcdui components don’t make for a very attractive user interface. Particularly for a game, it’s nice to have all of the game’s GUI components match the style and theme of the game. Rather than going with a third-party solution, it’s possible to program the entire user-interface yourself by painting it onto a canvas. One advantage to this is that you can really optimize and only add code that’s relevant to the game rather than filling your game jar with code for widgets you might have used but didn’t.

For my dungeon game (which you can download from my game page which I’ve conveniently added to my sidebar) I’ve added a bunch of new graphical features to make it more attractive. First it starts with an animated splash screen:

The title and the keys fade in if the handset supports a sufficient amount of blending, otherwise they slide in from the sides of the screen.

Then I’ve painted the timer and custom softkeys onto a full-screen canvas instead of using lcdui commands:


This includes two different sizes of graphics for different screen sizes:


Then the menu of options is painted over the current game screen. I’ve indicated which item is selected by coloring the text blue and putting stars behind it with an animated sparkling effect:


Plus, it shows the labels in French if the microedition.locale system property starts with “fr”:


As I said before, the hardest part is to get the keycodes right for the softkeys. And unfortunately, even if you have a list of key codes for a number of common handsets, it isn’t always easy for the MIDlet to identify the handset. The microedition.platform system property sometimes helps, but not always. Some manufacturers just set this property to return the generic string “j2me” and from there, there’s not a lot your MIDlet can do.

The current version of Dungeon is set so that the custom softkeys will work on the Sagem my700x and probably some other handsets. However if it doesn’t work, I’ve provided a second version with the custom softkey feature disabled. This second version still has the custom menus I’ve added, but uses lcdui commands to make the menu appear and disappear. This is what it looks like:


It’s not as pretty, but I guess it’s not the end of the world…


2 comments so far

  1. George DALLA on

    I want the code of Dungeon, can you give it to me?

  2. carolhamer on

    this is an application I wrote for my new book, so all of the code will be available on the publisher’s site as soon as the book comes out. It’s not clear if I’m supposed to be distributing the code for the book examples before that. However, the earlier version of Dungeon (without the beautified menus, etc.) appears in the the previous edition, hence the code is available here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: