I'm writing a small graphics class for direct3d 9 and have some OOP problems.
CGraphics contains the d3d device and initialization/drawing code. It also contains CTextureManager as public.
I figured there's nothing wrong with typing something like:
Another option is to wrap the texture manager methods in the graphics class like:
Which way is best and why?
Now my problem is the texture manager needs access to the d3d device in order to load textures. How should I set up my scope and structure in a professional way?
I could get around this by making the Device a public property and typing:
but that would be sloppy and I know there's a better way.
If my whole approach isn't right, I'd be happy to be shown a better structure.
CGraphics contains the d3d device and initialization/drawing code. It also contains CTextureManager as public.
I figured there's nothing wrong with typing something like:
Code:
Graphics.TextureManager.AddTexture(FilePath)
Another option is to wrap the texture manager methods in the graphics class like:
Code:
Sub CGraphics.AddTexture(FilePath)
TextureManager.AddTexture(FilePath)
End Sub
Graphics.AddTexture(FilePath)
Which way is best and why?
Now my problem is the texture manager needs access to the d3d device in order to load textures. How should I set up my scope and structure in a professional way?
I could get around this by making the Device a public property and typing:
Code:
TextureManager.Device = Graphics.Device
but that would be sloppy and I know there's a better way.
If my whole approach isn't right, I'd be happy to be shown a better structure.