Original Post
Hi guys... Im trying to make some Object Oriented Programming here. Im making a Dll and im using abstract classes. As i can see, the error points to the constructor of the derived class!!! I will place some code to clear any doubts! I hope i didnt let things too much confused :) [Edited by - Corrosive on September 13, 2004 11:15:36 PM]
//anauel_init.h
#include "anaueld3d.h"
HRESULT CreateRenderDevice(HINSTANCE hDll, AnauEngine **aDevice)
{
if(!*aDevice)
{
*aDevice = new anaueld3d(hDll);//line possibly with error
return 0; //return A_OK quando estiver implementado o controle de erros
}
return 1;
}
//anauel.h
#define Max_Instances 8
class AnauEngine
{
protected:
HWND a_HwndMain;
HWND a_Hwnd[Max_Instances]; //limite de janelas de renderização
UINT a_HwndCount; //número de janelas usadas
UINT a_ActiveWindowId; // Identificação da janela ativa
HINSTANCE a_Dll; //Usado para carregar a DLL
DWORD a_largura; //largura da tela
DWORD a_altura; //altura da tela
bool a_Windowed; //tela cheia ou janela?
char a_GpuId[256]; //Modelo da GPU
FILE *a_Log; //Arquivo de log
bool a_Ativo; //Verifica se o engine está rodando
public:
AnauEngine(HINSTANCE) {};
virtual ~AnauEngine(void)=0;
virtual HRESULT Init(HWND) =0; //Inicializa o dispositivo para a janela solicitada
virtual void Release(void) =0;
virtual bool Ativo(void) =0;
virtual HRESULT UseWindow(UINT Hwnd) =0;
virtual HRESULT Render(bool ClearPixel, bool ClearDepth, bool ClearStencil) =0;
virtual void StopRender(void) =0;
virtual HRESULT Clear(bool ClearPixel, bool ClearDepth, bool ClearStencil) =0;
virtual void SetClearColor(float Red, float Green, float Blue) =0;
};
typedef struct AnauEngine *ANAUENGINE;
extern "C"
{
HRESULT CreateRenderDevice(HINSTANCE hDll, AnauEngine **pInterface);
typedef HRESULT (*CREATERENDERDEVICE) (HINSTANCE hDll, AnauEngine **pInterface);
HRESULT ReleaseRenderDevice(AnauEngine **pInterface);
typedef HRESULT (*RELEASERENDERDEVICE) (AnauEngine **pInterface);
}
//anaueld3d.h
#define Max_Instances 8
class anaueld3d : public AnauEngine
{
public:
anaueld3d(HINSTANCE a_Dll);
~anaueld3d(void);
HRESULT Init(HWND);
BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
void Release(void);
bool Ativo(void) {return a_Ativo;}
HRESULT Render(bool, bool, bool);
HRESULT Clear(bool, bool, bool);
void StopRender(void);
void SetClearColor(float, float, float);
HRESULT UseWindow(UINT Hwnd);
private:
//AnauD3DEnum *a_Enum;
LPDIRECT3D9 a_D3D;
LPDIRECT3DDEVICE9 a_Device;
LPDIRECT3DSWAPCHAIN9 a_Chain[Max_Instances];
D3DPRESENT_PARAMETERS a_d3dpp;
D3DCOLOR a_ClearColor;
bool a_Rendering;
bool a_Stencil;
HRESULT Go(void);
void Log(char *, ...);
};