Archived

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

johnnyBravo

Can people post their dx wrapper designs?

Recommended Posts

Hi, im designing the way my dx wrapper will be used, but I still can''t decide completey on how to make all my classes etc. Im wondering if people could post their wrapper designs, so I could maybe use parts or even copy their design. Thankyou,

Share this post


Link to post
Share on other sites
im not sure if u want to see what the d3d wrapper class looks like or what all the classes are

heres the d3d class I have made


class CDirect3D
{

protected:

WNDCLASSEX m_wc;
HWND m_hWnd;

LPDIRECT3D9 m_pd3d;
LPDIRECT3DDEVICE9 m_pd3dDevice;

LPD3DXSPRITE m_pd3dxSprite;

public:

HWND GetWindow() { return m_hWnd; }
LPDIRECT3DDEVICE9 GetDevice() { return m_pd3dDevice; }
LPD3DXSPRITE GetSprite() { return m_pd3dxSprite; }

void Init(UINT Width, UINT Height, D3DFORMAT Format, BOOL Windowed);
void Cleanup();

void ResizeScene(UINT Width, UINT Height);

void BeginScene();
void EndScene();

void SetWorldMatrix(D3DXMATRIX matWorld);

void TakeScreenShot(LPCTSTR pDestFile);

void EnableBlending(D3DBLEND SrcBlend, D3DBLEND DestBlend);
void DisableBlending();

void EnableLighting(D3DCOLOR Ambient=0xffffffff);
void DisableLighting();

void EnablePointLight(DWORD Index, float x, float y, float z, float r=1.0f, float g=1.0f, float b=1.0f, float Range=1000.0f);
void EnableSpotLight(DWORD Index, float x, float y, float z, float dx, float dy, float dz, float r=1.0f, float g=1.0f, float b=1.0f, float Range=1000.0f, float Theta=1.0f, float Phi=10.0f);
void EnableDirectionalLight(DWORD Index, float dx, float dy, float dz, float r=1.0f, float g=1.0f, float b=1.0f);
void DisableLight(DWORD Index);

void EnableFog(FLOAT fFogStart=30.0f, FLOAT fFogEnd=80.0f, D3DCOLOR FogColor=0xff00bfff, BOOL bRange=FALSE);
void DisableFog();

};

Share this post


Link to post
Share on other sites
If you think closely, you''ll know that every intermediate programming, is trying to write his own wrapper or GDK, this is not the way it has to.

All those dirty wrappers do the same thing, i just want to minimize this work of every body, why now four of five peoples combine to code a fully commented, easily extendable modular wrapper so other people don''t waste time writing their own, & focuse on the real game content.

I have Programming RPGs with DX, an excellent book on writing wrappers or a medium functionality engine, so the guys intermediate ones, who have that book maybe, we can combine to write a wrapper based on the techs discussed on that book & use the same design approach, very good which is.

Like
System Core:
NetWork Core:
Input Core:
Sound Core:

i have the graphics core done. So if some one agree or wanna join hands i am agreed, i''ll handle the graphics core, you can do Network, Input, Sound cores, or any one of them what you like, but note the design must be followed as described in "Programming RPGs With DX". so we don''t go astray with our own designs.

Share this post


Link to post
Share on other sites
My system has wrapped up d3d, input, and sound. Currently I am working on intergrating my existing network (UDP) code into my game engine. I don''t know as to how you are designing your system but I followed a modular approach in that I have numerous objects that can be linked by renderable objects for example:

class cRenderObject{
....
cEffect* mEffect;
cMesh* mMesh;
cViewPort *mViewPort;
};

The components themselves (mEffect etc) are classes that hold the relevant data for that component. A renderobject can share components with other renderobjects etc.
My renderobjects use to hold many more components but when I switched over to an effects driven engine many of them became redundant. Now the main render workhorse is the mEffect object.

My system is designed using these major components:


class cRenderer //handles rendering via a self sorting queue system.
class cSoundManager //handles sound utilisng linkable sounds
class cIVBManager //handles the vertex and index buffers
class cInputManager //handles keyboard/mouse input
class cEffect //handles dx effects.
class cMesh //handles mesh information that will be automatically
//parsed to the IVBmanager on render if required
... and many more minor objects that i can''t be bothered listing

I have concentrated on automating my system so that the user need only worry about object creation as opposed to object implementation. Many of the object creations can be done via file loading methods in each of the objects.(eg .x, .wav, .fx, .bmp, .dds etc), or you can do it the plain old manual way.



Share this post


Link to post
Share on other sites