how do i set the background in applet as an image?
is there liek a one line code?
rite now all i have is a blue background with
setBackground(new Color(0,160,255));
but i want to use an image
Printable View
how do i set the background in applet as an image?
is there liek a one line code?
rite now all i have is a blue background with
setBackground(new Color(0,160,255));
but i want to use an image
g.drawImage( ... cover the whole applet ... );Quote:
Originally posted by nanokooshball
how do i set the background in applet as an image?
is there liek a one line code?
rite now all i have is a blue background with
setBackground(new Color(0,160,255));
but i want to use an image
:)
ya i tried that.... but my game goes WAY slower if i do that... anyother way?Quote:
Originally posted by Doomah
g.drawImage( ... cover the whole applet ... );
:)
I don't want it to always redraw the image
anyone?
need to know soon plz
I think it's always going to have to redraw/rerender every frame, regardless ... maybe there's some technique out there that I haven't heard about ... Volatile Images might be what something you want?Quote:
Originally posted by nanokooshball
ya i tried that.... but my game goes WAY slower if i do that... anyother way?
I don't want it to always redraw the image
Beyond that I'm not sure, you can certainly cut corners to improve performance (reduce the amount of time your applet thread sleeps, reduce background image color depth, etc).
ya i've tried cutting out a lot of code that makes it go slower before i get to this part....
but my game runs perfectly fast and fine before adding the background image and i've tried adding a lot of other stuff and it doesnt slow it down.... but the moment i add it, there is a significant slow down.... and lowering the thread sleep time does little to help it....
so do i just add that code for Volatile Images in my Applet?
http://java.sun.com/products/java-me...ackground.html
Will that link help you out.
Have you enabled double buffering for your window? If not, that could help with performance using the drawImage method.
.Quote:
Originally posted by rock
Have you enabled double buffering for your window? If not, that could help with performance using the drawImage method.
already did double buffering... gonna check out that link by richardginn