Firstly, forgive me for my code. I have really tried my best to make is as easy to read as possible but DirectX is never the easiest thing to code. I originally wanted to write DirectX applications but found that every book I read relating to DirectX was coded using SDK material and not MFC. I wanted to create a very simple wrapper that allowed the easy display of bitmaps on the screen using DirectDraw.
The code itself is fairly limited to displaying bitmaps on the screen (FULLSCREEN MODE) using DirectDraw but it shows the concepts of using wrappers to make your programs far easier to use. I could have put it all in a DLL but realised that this would not be simple for you all to use. Anyway, here is how you use the libraries.
2. Create an instance of the CDirectControl Object. For example:
3. In the App Init Instance call the following code:
m_pMainWnd = m_Control.CreateFullScreen(800,600,16);
4. You can now use the Controller to create bitmaps (from the resource) using the code :
The first parameter is the object identifier that I use to manipulate or select the object at a further time. The second parameter is the resource id of the bitmap.
You also need to tell the controller that the bitmap is available to be rendered. The default is false so you need to set the visibility by using the code:
5. The bitmaps are defaulted to the top left of the screen (x=0,y=0) but you can alter its position by using:
6. Once you have created your bitmap/s you can render the screen by calling:
Ok. What I suggest is that you look at the example project I have done. If anyone wishes to expand it further etc. I would welcome and more additional source code or comments. Please dont laugh at my code. I just wanted Direct X to be easy for everyone. Enjoy.
BTW... I havn't implemented the Escape key so you will have to press ALT-F4 to quit.