Extending Layer

I understand that it’s not possible to extend the Layer class from searching the forum. :frowning:

This is what I originally wanted to do.

The reason I wanted to do this was to be able to draw some text (high score, etc)
on my J2ME game.

I can draw directly on the gamecanvas, but it’s not the right layer I want to draw on.

Is there a way to extend Sprite or TiledLayer and be able to use drawString() on it?
(I don’t have an image associated with the text)

Thanks,

Jon

As far as I’m aware of, no :frowning: Visibility of layer constructor does not allow this. In the siemens-game-api the visibility of layer constructor was protected and I used it to subclass Layer, but in sun’s implementation this is not possible. So sad :frowning: the only way to subclass a layer is to wright your own implementation of layer and all of the javax.microedition.lcdui.game classes. Luckily you can decompile the WTK jars and take their sourcecode (as did i :slight_smile: ) for tiledlayer, sprite, etc. it works fine on my nokia 6630.

Or, you can take source from any other opensource, there are a lot of implementations of gameapi in MIDP1.0. Though the main drawback will be that your api wont work as fast as natively supported one.