Jump to content
  • Advertisement
Sign in to follow this  
prof_89

loading images in java

This topic is 4127 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

Hi, im working on a game and for the moment my main class is flooded with "image-loading-code"... how can i load the images in a seperate class (imageload.class) ??

Share this post


Link to post
Share on other sites
Advertisement
You would need to make a separate class like you've suggested. You could have a method such as getImage(imageName). It would be handy to store the images so they don't have to be loaded every time. You could use a hash map for this, using the image's path/name as a key. That way, when you request an image from the class it will look up the hash map and return the image. If the image hasn't been loaded then go ahead and load it.

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!