Advertisement Jump to content
Sign in to follow this  
Thaligar

api independent...

This topic is 4881 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 folks, i finally get an api independent texture class to work (multiple inheritance), my brain was some kind of dizzy during the implementation, well now i try to get it to run with the handlemanager from "Games Gems I" and now the problem, the handlemanager tries to create a template object through the std. constr., well not a problem but if i pass as template parameter the texture interface class the compiler hangs, (well not surprising) but how can i get it to run without implementing one handlemanager for each texture (2D, 3D, 1D...), because it works without a problem when i pass as template not the interface class but the specialized class, thanks in advance for your time (for reading this as well as participate), greets tgar

Share this post


Link to post
Share on other sites
Advertisement
I don't know this particular handlemanager class, but if it is/has a collection of your objects, then the simple answer is you need to store pointers to the interface class, not the interface class itself.

Example:


class A {
int a;
public:
virtual int value() const { return a; }
};
class B : public A {
int b;
public:
virtual int value() const { return b; }
};

std::vector<A> as; // bad!
std::vector<B> bs; // ok
std::vector<A*> pas; // also ok

pas.push_back(new B);



Without seeing handlemanager, I'm guessing it's a similar situation as the vector in my example.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!