Renderer

Hello there, I’m quite new at Java Game Dev.

I want to write my own Rendering-Engine with the standard Java2D-API. (because it’s a small J’n’R)

In Java2D-API you use the Graphics-Object from the PaintComponent()-Method from e.g. JPanel.

I want to write my “Engine” quite dynamic. Means: If I create an Object, it has to be “sent” automatically to a global Rendering-Object, which renders everything.
Does someone have an idea, how I start with that?

I have a JPanel, which is my Display and has the paintComponent()-Method
Something like that:

https://dl.dropboxusercontent.com/u/13341521/Unbenannt.jpg

I hope someone can help :>

Make each of wannabe object to implements/inherits render() method (I prefer implementing aka interface). Then on your global renderer save reference of them in list, bag, or whatever. Then on action, the renderer will loop every object to a) render them or b) inject Graphics ref so they will render themselves.