I'm learning how to program games using C++ and D3D11. I've got a basic 3D application that I re-factored from one of the simple tutorials; the one with a single spinning cube. I'm about to write a basic object manager, and pull the code for the cube out into an object class.
Now, I've been reading about object managers and game objects, etc. I've read two different takes on it.
- Each game object is responsible for updating and drawing itself. So each object has its own draw method that the object manager would call.
- Game objects only contain the information needed to draw itself; the object manager actually handles the drawing logic using that information.
I'm familiar with the first method, because it's pretty simple to wrap my head around. I've seen it used in quite a few examples and stuff. I'm trying to grok the 2nd way, though. Wouldn't the draw function of the object manager need to iterate over each object, and depending on the type do specific stuff? This would result in a pretty massive draw function with a bunch of if-else branches based on the object type. Is that good? I know it consolidates all the drawing logic into one area, so it's not spread out over many different object classes, so I could see that being a bonus.
Just looking for some advice on which method to go with, I guess. Thanks!