in D3D sdk sample a game application is only a class?

Started by
3 comments, last by circlesoft 18 years, 11 months ago
I know a class is infrastructure of a program .so a program consist of many class. but in D3D sdk ,there is a CD3DApplication class.and this way, a program using that class just have a class /except compound class/ ,and all class just derived from it. this hint I will have different D3D application in a programe? I mean I will have some classes class skinapp : CD3DApplication class terrainapp : CD3DApplication class skyboxapp : CD3DApplication ..... why do this way? commonly a program just have a class and all class derived from it? the cause is : it provide a common interface for a whole program? and class just play role that providing a interface?
Advertisement
Quote:Original post by derek7
I know a class is infrastructure of a program .so a program consist of many class.

but in D3D sdk ,there is a CD3DApplication class.and this way, a program using that class

just have a class /except compound class/ ,and all class just derived from it.

this hint I will have different D3D application in a programe?

I mean I will have some classes

class skinapp : CD3DApplication

class terrainapp : CD3DApplication

class skyboxapp : CD3DApplication

.....

why do this way? commonly a program just have a class and all class derived from it?

the cause is : it provide a common interface for a whole program?
and class just play role that providing a interface?




You dont want to do that because CD3DApplication is a wrapper around the DirectX
COM object (graphics device) and does alot of stuff needed to run a Graphics application (message loop, constructor, destructor, device state change handlers, etc....)


You should only have one object derived from CD3DApplication -- in the sample programs its usually something like CMyD3DApplication in which you override
many methods to do specifics of your app (like skin, skybox, terrain etc...)



Try using the MS C++ wizard to create one of the standard project/program templates set as a 3D program (the one I did recently has a 'teapot' object as an example). You will see where that specific graphical entity gets patched into CMyD3DApplication/CD3DApplication.




where is D3Dapplication class ?

I find it at a book code.but I can't find it in D3D SDK directory. I use d3d 9.0c
Quote:Original post by derek7
where is D3Dapplication class ?

I find it at a book code.but I can't find it in D3D SDK directory. I use d3d 9.0c


I assume you are replying to "Anonymous Poster" (not sure) and when you say "D3Dapplication", I assume you mean "CD3DApplication".
CD3DApplication is a sample framework class from an older DirectX SDK version.
Is the DirectX SDK version you have installed the same as the one referenced in the book you are using?
Note "d3d 9.0c" is a version of the DirectX runtime libraries and not a version of the DirectX SDK.
The recent versions of the Direct SDK sample framework is completely changed and CD3DApplication no longer exists in those versions.

If you have a version of the SDK which does not use the CD3DApplication class in its sample framework, you have a few options.

1: install an older version SDK which uses the sample framework referenced in your book (maybe available on CD with your book?)

2: Use the SDK help file (and source files) for your current SDK as your reference for the sample framework.

3: Buy a new book which references the sample framework of the version of the SDK you are currently using (if one exists).

Note: If you do Install a new SDK, make sure you uninstall any older versions of the SDK first, or you may have problems.

Also if the DirectX runtimes you have installed are incompatible with the SDK you are trying to install, you may have problems.

HTH,
Cambo_frog
For the love of god, please tell me that you've just omitted your error checking code for brevity, and you don't really assume that all those functions succeed.
In reality, the old SDK framework is really confusing, and not very good for doing small, demo-like applications. The DirectX team recently redesigned the entire framework, and it is much better now. Whereas the old framework used a generic class for the entire application, the new framework uses a simple set of callbacks for the application skeleton.

I recommend that you at least check it out, and see which one you like more [smile]
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )

This topic is closed to new replies.

Advertisement