Jump to content
  • Advertisement
Sign in to follow this  
omgh4x0rz

undoing a drawImage

This topic is 4068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to undo a drawImage in Java so that the screen only shows what was there right before? Right now my game is really simple so I can just draw a big white rectangle where the image was and then move the image over. However, I don't think this will suffice in the long run. What do you suggest the best method for this is? Thanks even if you don't have any suggestions for java in particular, I would like to hear how you would do this with another language so I can get ideas.

Share this post


Link to post
Share on other sites
Advertisement
The general way of doing this is with double buffering. The entire screen is rendered to a buffer. Then you just replace the current screen with the contents of the buffer. Then you clear the back-buffer and start drawing to that. Your graphics hardware can do this automatically by just passing a couple parameters in the setup (assuming you're using some graphics library to draw).

If you're writing a software renderer you'll have to implement this by hand.

-me

Share this post


Link to post
Share on other sites
Hmm, well I'm just starting to teach myself so that was alot of big vocabulary I haven't learned yet :D

I know i'm using swing. Is that a graphics library?

Share this post


Link to post
Share on other sites
Swing is a GUI toolkit, like Gtk+, Qt and wxWidgets (although those are all C/C++ - I'm not aware of any other Java toolkits ignoring AWT). Basically a GUI toolkit gives you a library of common user interface elements like menus, buttons, textboxes and lots of others.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!