Sign in to follow this  

IDIRECT3DDEVICE9

This topic is 3632 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 use this pointer in my class and main program. I pass the pointer to my class when needed but do i need to? Can i create several of these types or do i need to just create 1 for my directx project. I dont want to keep passing this pointer if i can create another in the required class. IDIRECT3DDEVICE9 *g_pd3dDevice

Share this post


Link to post
Share on other sites
Obviously, you only have one actual device, but you could have several pointers to it if you wanted.

E.g:


class Sprite
{
private:
IDirect3DDevice9 *Dev;

public:
Sprite(IDirect3DDevice9 *D) : Dev(D) { }

void Draw(){ /* use Dev */ }
};


Then after you init the device and create a sprite, you could pass the device pointer to the sprite's constructor to avoid having to pass around among all of Sprite's methods.

Share this post


Link to post
Share on other sites

This topic is 3632 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this