Jump to content
  • Advertisement
Sign in to follow this  
derek7

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

This topic is 4899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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.




Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!