Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


[java] Drawing in Java games.

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

I''m (trying to) build an object-oriented 2D game. How should I do the painting? I made my own Canvas class, and deal with the painting and drawing in there. But would it be good to make my objects paint themselves(so that I pass Graphics context to them) or to "pass them" to Canvas class, and make some kind of paint-methods there. Are Thanks in advance.

Share this post

Link to post
Share on other sites
If you have the objects paint themselves, all you have is a single method call for each object and only one parameter is passed. If you have your canvas draw each object, then the canvas would have to call at least one method per object(to get x and y coordinates). It would also have to have the correct picture to draw. Plus if you introduce new objects, then your canvas may have to be changed to account for those. It would probably be better to have the objects draw themselves.

Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home

Share this post

Link to post
Share on other sites

  • 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!