Archived

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

Object-Screen relationship

This topic is 5001 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 developing a Java game. What''s the Object to the Drawing canvas relationship? Should I pass handle of the canvas to the object and have the object draw itself onto the canvas? Or do i need a different drawing class that harvests all drawable objects and draws them onto the canvas? I''m confused. I''ve used the first method but I''m beginning to think this would be a problem in certain cases. This is not only concerning java but other languages i''d imagine.

Share this post


Link to post
Share on other sites
having a collector object is probably the better idea, than allow each objects to render themselves. If you need to sort them, by say, texture, material, or Z order for transparency, it would be easier. It''s more work, but as you said, there are cases where it''s necessary. it''s also cleaner in my opinion.

Share this post


Link to post
Share on other sites
Can you elaborate in detail about this collector object? I have multiple drawable 2D models that are defined by vertices. During rendering sequence they''re drawn onto the canvas.

Share this post


Link to post
Share on other sites