Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

A couple graphics questions...

Hey Everyone

I'm working on a game in Java (I know I know... I should do it in C++... but I love Java!) Anyway... I've got two big problems:

1.) When I load images to display them, I'm trying to have them "preload" at startup. But this doesn't work. The game starts and a couple seconds later the images start popping up one by one. Is there anyway to know when the images have actually finnished lasing?
I'm using getToolkit().createImage("my image.gif") to load them.

2.)Rotating images... I've gotten this to work nicely by using this code:

Graphics2 g2 = (Graphics2)g;
//rotate
g2.rotate(xDegrees);
g2.drawImage(image,x,y,observer);
//"unrotate"
g2.rotate(-xDegrees);

However, sometimes when I call this, the "unrotate" part doesn't seem to kick in. The whole screen is left rotated and looks REALLY messy.
Does anyone know why this would be or a better way of drawing a rotated image on the screen?

Thanks!!!
[1039 byte] By [GuyFlash] at [2007-11-11 7:26:51]
# 1 Re: A couple graphics questions...
looks REALLY messy.
you draw image but you dont clear the surface
before you do "un-rotate".

g.rotate() do not re-draw anything already drawn.
it rotates the coordinate system for the objects
you will draw after method( rotate) call.
mr1yh1 at 2007-11-11 22:38:15 >
# 2 Re: A couple graphics questions...
1.) When I load images to display them, I'm trying to have them "preload" at startup. But this doesn't work. The game starts and a couple seconds later the images start popping up one by one. Is there anyway to know when the images have actually finnished lasing?
I'm using getToolkit().createImage("my image.gif") to load them.

MediaTracker
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/MediaTracker.html
Joe Beam at 2007-11-11 22:39:25 >