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


dll design question for game library

Recommended Posts

wazoo69    157
Hi, I''m implementing my BasicEngine (which mostly just handles doing 2d stuff with 3d hardware using OpenGL or Direct3D) This is what I''m hoping to accomplish, but not even SURE if it''s possible in c++!! 1. Pure Virtual Base Class in BasicEngine.lib called ICanvas. Within ICanvas it has a pure virtual function - InitScene() 2. DLL #1: D3DCanvas.dll - implements the ICanvas class for direct3d8 - Only defines InitScene as a virtual function 3. DLL #2: OGLCanvas.dll - implements the ICanvas class for OpenGL -Only defines InitScene as a virtual function.. I''ve got the library working now, where I can instantiate the DLL I want at runtime through interface pointers. QUESTION: CAN I derive ANOTHER class from D3DCanvas (remember it''s a DLL) which THEN implements the InitScene function()?? ie. joe coder dl''s the library, and wants to make his game. Since I''ve left the InitScene function blank (as I want as many as possible to use the engine), joe coder derives a class from D3DCanvas - MyD3DCanvas. In this one, he defines InitScene with a swak load of initialization code. Then during runtime, when the engine calls InitScene() - It loads up the D3DCanvas.dll then uses joe coder''s InitScene function...) is this possible??? thanks, Wazoo

Share this post

Link to post
Share on other sites