Getting started with DirectX9 (C++ Shell)

Started by
7 comments, last by ForbiddenX 13 years, 2 months ago
Hey guys,

I'm currently in a game programming course at my college and was wondering if anyone one could help me out with a few questions.

Right now our teacher wants us to create a Win32/DirectX environment using C++. I'm having a really tough time doing that because I learned
how to do Win32 API using C and not C++. If we use any C code or C coding practices, we'll get a mark of 0. I know how to do the DirectX stuff too
it's just getting it all started that's killing me!

Are there any tutorials you guys have that can help me out? I understand how Win32 works, I just don't understand how to get it to work in C++.

Please help if you have any links or a "shell" that I could use just for the window it'd be great!

Thank you so much in advance!
Advertisement
The windows API is written for C, and as such the same functions etc will be available. The only real difference will be wrapping static callbacks into classes.
If you look around for "Win32 C++ wrapper" you should find a few examples floating around. In fact there used to be one hosted here, but the links are dead after the redesign. Most of them have class that uses a bit of Win32 trickery to redirect calls to a static window proc to a member function, and from there it's just standard OOP stuff.
Well if you can use the WTL it provides a super-thin C++ wrapper around the win32 windowing system, documentation is a bit light but being a thin wrapper you can just look at the code, and search around a bit on the internet for people who have written some examples.

Basically you write your own window classes that derive from some template based base classes that provide the bulk of the boilerplate functionality you need, and hook up your own function handlers for the message handler.

http://wtl.sourceforge.net/
http://www.gearboxsoftware.com/
Using the Windows API without C coding practices is pretty much impossible; at the very least your WndProc will need to be a procedural function.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


Using the Windows API without C coding practices is pretty much impossible; at the very least your WndProc will need to be a procedural function.


Out of curiosity, how would you define "procedural function"?
Ask your tutor to define exactly what they mean by C code and practices. As you describe it, it is a nonsensical requirement.

Using the Windows API without C coding practices is pretty much impossible; at the very least your WndProc will need to be a procedural function.


static functions inside the class can be used for the WndProc, obviously outside the object instance.
Thanks for the replies guys and sorry for the really late reply I've been crunching away at the next step of my project. I did exactly what you guys told me and I wrapped the functions into method calls and got full marks!

Thanks a lot

This topic is closed to new replies.

Advertisement