pointer issues

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
itsjuan2001
Posts: 12
Joined: Tue Jul 05, 2005 7:05 pm

pointer issues

Post by itsjuan2001 »

ok i am almost done with version 0.7 of my open engine that i am going to release soon (so look for it in project announcements forum)
I'm just having a problem with accessing the video driver pointer, i built off some off of the tutorials so its defined in main along with the device.
problem is, i need my sprite loading functions (among a few others) access it so i can call :

// draw intro bitmap, hack hack will replace this with a avi loader
// when i learn how to

driver->draw2DImage(intro, core::position2d<s32>(50,50), core::rect<s32>(0,0,342,224), 0, video::SColor(255,255,255,255), true);

i basically need a way to globally be able to call the driver pointer from any function within any class.
thank you for your help in advance
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to route the pointer to the method where you need it. Of course you could also use global variables, but this is not good style (and might lead to problems later on).
itsjuan2001
Posts: 12
Joined: Tue Jul 05, 2005 7:05 pm

Post by itsjuan2001 »

whats would be a good way of doing that?
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Re: pointer issues

Post by Baal Cadar »

itsjuan2001 wrote:I basically need a way, to globally be able, to call the driver pointer from any function within any class.
Do you really? I doubt that. This sounds like design flaw. Try to streamline your design in a way, that only a specific amount of components, for specific, clearly outlined tasks, need to access the video driver. It should then be easy to pass the driver to these class instances during initialisation.
Post Reply