Jump to content
  • Advertisement


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


How To Structure OO App

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

Hi Guys, I am after some answers in my questions with setting up my app in an OO style. This is just one example, but i have a few situations where the problem is similar. I setting up a basic D3D app (for 2d drawing), and i am using the d3dxsprite helper class to render sprites. I have wrapped up the direct3D functions i think i will need (basically the init and release funcs). I also have a sprite class that encapsulated the data that goes with a d3dxsprite. Note that the example does not have to be the d3d derived sprite, but any sprite class. Now the question is this : as far as i understand it, some of the principles of oo is encapsulation and abstraction? I take that to mean that the sprite should not necessarily know about the direct3d class, and vice versa. The problem is, to render, the sprite requires a pointer to a direct3d backbuffer, which must be locked before being passed, so at least one class needs to be aware of the other. I can think of a few ways to get around this but currently i am using this method : The sprite draw() method takes the backbuffer as an argument. The direct3D calls a redrawgui() function, passing the backbuffer after locking it. This requires a global Gui object, which the direct3D class must know about as well. Am i missing something? is this method optimal? Thanks for any help or ideas. Aface

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!