Original Post
In my game engine I''ve put the graphics routines into seperate runtime dynamic dll''s (one for directX and one for opengl).
now my dll''s have functions the same functions like beingScene() and the implimentation is different in each dll. The graphics dll''s and loaded by my loadtime dynamic dll.
Since direct x using LPDIRECT3DTEXTURE8 and opengl doesn''t i wanted to encapulate it into a class called texture which would be stored in each graphic dll. The the engine and game would only use texture and the graphics module would do something like texture.LPDIRECT3DTEXTURE8 to get the texture in the directX dll and texture.whatever in the opengl dll.
Now the problem is that I don''t want the game engine to know that texture contains a LPDIRECT3DTEXTURE8 or whatever opengl uses but I have to include the header file defining the texture class into the game engine dll.
here''s the header file i have to include in the graphic dll and the gameengine dll.
struct I_MyInterface
{
virtual HRESULT intdriver(HWND hWnd, DWORD width, DWORD height, BOOL fullscreen) = 0;
virtual HRESULT killdriver() = 0;
virtual HRESULT beginScene() = 0;
virtual HRESULT endScene() = 0;
virtual HRESULT beginSprite() = 0;
virtual HRESULT endSprite() = 0;
virtual HRESULT beginText() = 0;
virtual HRESULT endText() = 0;
virtual HRESULT setUpView(D3DXVECTOR3* look, D3DXVECTOR3* eye, D3DXVECTOR3* up) = 0;
virtual HRESULT setUpProjection(FLOAT fovy, FLOAT aspect, FLOAT nearP, FLOAT farP) = 0;
virtual HRESULT setUpWorld(D3DXMATRIX* matWorld) = 0;
virtual HRESULT setVerticeSource(UINT startVertice, LPDIRECT3DVERTEXBUFFER8 vb, UINT vertexSize) = 0;
virtual HRESULT drawPrim(D3DPRIMITIVETYPE primType, UINT startVertice, UINT primCount) = 0;
virtual HRESULT drawText(TCHAR* buffer, RECT* size, DWORD format, D3DCOLOR color) = 0;
virtual HRESULT drawSprite(LPDIRECT3DTEXTURE8 texture, RECT* size, D3DXMATRIX mat, D3DCOLOR color) = 0;
virtual HRESULT setRenderState(D3DRENDERSTATETYPE state, INT value) = 0;
virtual HRESULT setTextureStage(DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value) = 0;
virtual HRESULT enableLights() = 0;
virtual HRESULT setLight(D3DLIGHT8 d3dLight) = 0;
virtual HRESULT loadTexture(TCHAR fileName[], LPDIRECT3DTEXTURE8* texture) = 0;
virtual HRESULT setTexture(IDirect3DBaseTexture8* texture) = 0;
virtual HRESULT resetD3D(HWND* hWnd, DWORD width, DWORD height, BOOL fullscreen) = 0;
virtual HRESULT screenShot() = 0;
};
extern "C"
{
HRESULT GetMyInterface(I_MyInterface ** pInterface);
typedef HRESULT (*GETINTERFACE)(I_MyInterface ** pInterface);
HRESULT FreeMyInterface(I_MyInterface ** pInterface);
typedef HRESULT (*FREEINTERFACE)(I_MyInterface ** pInterface);
}
i want to replace all the LPDIRECT3DTEXTURE8 with the texture class.
So there would be a texture class in each dll and if the direct x dll is loaded then the texture class would be defined as -
class texture {
public:
LPDIRECT3DTEXTURE8 surface;
};
so how would i export this function from my runtime graphic dll without letting the engine know whats inside the class. I am using the DLL interface method described in the reference section under platform specific->windows at this site.
thanks
flashlaserz