Can I use DirectX using C only?
Or...do I have to bite the C++ bullet?
If I need to learn C++ quickly enough to do Directx, will "Accelerated C++" by Koenig and Moo bring me up to speed?
FWIW I have been using C for years, and I know enough Java to do simple games and animation.
But now I want to do DirectX!
Capt Logic
You can do it with C but it might not be pretty. The COM style of DirectX works better with C++.
quote:Original post by Captain Logic
Or...do I have to bite the C++ bullet?
If I need to learn C++ quickly enough to do Directx, will "Accelerated C++" by Koenig and Moo bring me up to speed?
FWIW I have been using C for years, and I know enough Java to do simple games and animation.
But now I want to do DirectX!
Capt Logic
I haven''t learned DirectX yet but Accelerated C++ would be good if it''s necessary for DirectX. I read that after programmming in C for a while.
1. The easiest thing to do is write C style code in a CPP file and compile it as C++ - just think of the COM calls as calls to a function pointer (the method) stored in a structure (the interface). Your program doesn''t need to use any classes or be at all object oriented to use DirectX.
2. Read the following part of the SDK docs:
Introducing DirectX 9.0 ->
Using the DirectX SDK ->
Programming DirectX with C/C++ ->
Using COM ->
Using C to Access COM Objects
That tells you how to call the COM objects from C specifying the v-table/this pointer explicitly.
3. Additionally read:
Introducing DirectX 9.0 ->
Using the DirectX SDK ->
Programming DirectX with C/C++ ->
Using COM ->
Using macros to Call DirectX COM Methods
That tells you about the helper macros for use with C which do the v-table stuff for you.
4. The rest of that "Programming DirectX with C/C++" section is probably worth a read too if you''re new to DirectX programming.
5. Older versions of the SDK had a few samples written in C so if you''ve got a reasonable connection it might be worth downloading say the DirectX 7 SDK to look over the samples (still use DX9, just copy the programming "style" from the DX7 samples).
--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP
2. Read the following part of the SDK docs:
Introducing DirectX 9.0 ->
Using the DirectX SDK ->
Programming DirectX with C/C++ ->
Using COM ->
Using C to Access COM Objects
That tells you how to call the COM objects from C specifying the v-table/this pointer explicitly.
3. Additionally read:
Introducing DirectX 9.0 ->
Using the DirectX SDK ->
Programming DirectX with C/C++ ->
Using COM ->
Using macros to Call DirectX COM Methods
That tells you about the helper macros for use with C which do the v-table stuff for you.
4. The rest of that "Programming DirectX with C/C++" section is probably worth a read too if you''re new to DirectX programming.
5. Older versions of the SDK had a few samples written in C so if you''ve got a reasonable connection it might be worth downloading say the DirectX 7 SDK to look over the samples (still use DX9, just copy the programming "style" from the DX7 samples).
--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement