Sign in to follow this  
fantasy_world

how to design classes ?

Recommended Posts

fantasy_world    100
Hi, I have read some directX tutorials. I want to create a simple library which supports a simple framework for working with DX. I don't know steps I have to do to design classes. So anyone tell me which steps you have done to design classes for a library. (should I write down any ideas in my head... then what's next ?... a diagram...?) SO what do a game programmer have to do when designing a game engine... thanks [smile] (sorry for my bad english)

Share this post


Link to post
Share on other sites
fantasy_world    100
I want to create a library because I want to practice.
I know I have to practice but I also need some guides. It's not easy to practice if I don't know what I have to do.

Any tools required ?

Any suggestion ?
thanks [smile]

Share this post


Link to post
Share on other sites
stormrunner    720
theres really no clear formula. since you want a simple wrapper, consider what you'd like to wrap (that was catchy). for instance, you'd probably want a window class that creates a window and initializes whatever dx stuff you want. mostly, just whip up what you'd like in your head, and just go at it. you will redo it multiple times, so don't worry about being perfect. just get it to work.
as for tutorials, the chris hargrove tutorials are both game related and wrap win32 and dx. they are worth scanning for ideas.
good luck.

Share this post


Link to post
Share on other sites
fantasy_world    100
Here is my idea

- cApplication: this class will control the program flow by calling virtual functions of cObject (an abstract class).
In this class there is a stack manager that store the classes (like cGraphics, cInput, ... these classes are derived from cObject class).

- ....

So should I use STL and if so, where can I find a good STL tutorial ?

thanks [smile]

Share this post


Link to post
Share on other sites
Ainokea    435
Quote:
Original post by fantasy_world
Here is my idea

- cApplication: this class will control the program flow by calling virtual functions of cObject (an abstract class).
In this class there is a stack manager that store the classes (like cGraphics, cInput, ... these classes are derived from cObject class).

- ....

So should I use STL and if so, where can I find a good STL tutorial ?

thanks [smile]

About the stl of course you should use it. here is one tutorial linky
and here is the docs click

Share this post


Link to post
Share on other sites
icosahedron    122
You could try and imitate some frameworks that you like. If you're thinking DirectX solely, look at Microsoft's DirectX sample application framework in the SDK. See what you might like, and use it, and disregard or change what you don't like.

If you're looking for some other APIs, look at Ogre perhaps for something more grandiose, or GLUT for an example of something very simple and easy. There are plenty of frameworks out there for you to sample from.

Writing a framework is a little like writing a paper or story. You can't hope to come up with something completely original, so take those parts that you find the most pleasing and make them your own.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Plonk all your data in the private part of the class, then create methods to do stuff to it.


class CDirectDraw {
LPDIRECTDRAW7 lpdd;
LPDIRECTDRAWSURFACE7 lpddsprimary;
public:
void Initialize(HWND);
void Shutdown();

LPDIRECTDRAWSURFACE7 BitmapLoader(char*);
void DrawSurface(LPDIRECTDRAWSURFACE7);

//More methods...
};



Now the only operations you can do on the data is the methods provided.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
1. Do some brainstorming about the idea, think about how a person who would do the job of the class, would manage the used data.

2. Make a detailed description of what you like to do.

3. Make a diagramm about all this.

4. Forget rule 1-3 and start coding, maybe you should recognize coding as a form of art. It's purely intuitive because of its logic nature. There are no rules. If you really want to learn about what you did, watch your computer, how it reacts to the code you made. Get inspired by other code, or examples in machinery and even nature.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this