unme
New user

Posts: 4
|
Hi!
I've programmed a little application for my cell phone that only draws an animated sprite on my screen. Here's an excerpt of the code: (I've cut out some unimportant things)
//Importing packages
class Level1 extends Canvas { Display display; Image offscreen; boolean firstrun = true; Player player;
Level1 (Display display) { this.display = display;
if (!isDoubleBuffered () && false) offscreen = Image.createImage (getWidth (), getHeight ()); }
public void paint (Graphics g) {
Graphics g2 = offscreen == null ? g : offscreen.getGraphics ();
if (firstrun) { try {Thread.sleep(1000);} catch (InterruptedException ex) {} try { player = new Player(Image.createImage("/Player/RunSprites.png")); } catch (Exception e) { System.out.println("Unable to read PNG image"); } firstrun = false; } g.setColor (0, 200, 200); g.fillRect (0, 0, getWidth (), getHeight ()); player.nextFrame(); player.paint(g);
if (offscreen != null) g.drawImage (offscreen, 0, 0, Graphics.TOP | Graphics.RIGHT);
try {Thread.sleep(100);} catch (InterruptedException ex) {} repaint(); } }
class Player extends Sprite {
Sprite player; Image runsprites;
public Player (Image image) {
super(image,80,120); setPosition(50,50); setRefPixelPosition(40,120); setFrameSequence(new int[] {0,1,2,3,4,5,6,7,8,9});
} }
public class GH extends MIDlet {
Player player;
public void startApp () {
Display display = Display.getDisplay (this);
Level1 logo = new Level1(display); display.setCurrent(logo);
}
public void pauseApp () {
}
public void destroyApp (boolean forced) { }
} In the emulator of the WTK everything works well. But when I create a jar of the image and the code and put it on my mobile phone, a LG KC550, the right background color appears but there is no sprite. Can it be that this phone does support MIDP 2.0 (MIDP configurations) but does not support sprites? Or did I do something wrong?
Thanks for your help!
|