03-01-2010 03:21 PM
JCarty wrote:Try using paintBackground instead of paint to draw your bitmap and see how it works out. Usually works for me too. I can't see what's wrong with your code.
I just tried that and it doesn't paint the image. It's just a blank screen, but the field shows just fine.
03-01-2010 03:26 PM - edited 03-01-2010 03:27 PM
public void paintBackground(Graphics g)
{
g.drawBitmap(0,0, _backgroundBM.getWidth(), _backgroundBM.getHeight(), _backgroundBM , 0, 0);
}
Actual code from one of my games that is out right now.
In the paint method, all I have are the elements that move.
public void paint(Graphics g)
{
super.paint(g);
for( int i=0; i<_pieceTotal; i += 6 ) {
_piece[i].draw(g);
_piece[i+1].draw(g);
_piece[i+2].draw(g);
_piece[i+3].draw(g);
_piece[i+4].draw(g);
_piece[i+5].draw(g);
}
}
These pieces are painted on top of the background and the elements that I've added to the screen via the standard add.
The only difference is I don't have a vertical manager sitting in between them. So maybe you need to add your paint to your HorizontalFieldManager.
03-01-2010 04:22 PM
I figured it out, but it was more trial and error then anything.
I created a vfm and put the background image in there. I then created a new vfm and added it to the first vfm. After playing around with the paint methods it now works. Thanks for your help.