Can I use DirectX with C?

Started by
4 comments, last by XELON 20 years, 9 months ago
I haven''t learnt C++ yet.So Can DirectX be used with C?
Ýstanbul-Türkiye
Advertisement
Yes, it is possible. I even think there is a document on it somewhere on this site. However, those who have done it and lived to tell describe it as a rather painful experience.
Besides - you don''t really need to learn much C++ in order to utilize DirectX from it. Most of the basic DirectX tutorials and examples look like some kind of C''ified C++ anyway.


AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
This is the place where it teaches you how to use C and DirectX to make Tetris:

http://gamedev.net/community/forums/forum.asp?forum_id=33
You can use C with DirectX, but each time you call a directX function, you must refer to the ''vtable, something like this:
pDevice->vTable->SomeCommand(), and you can''t use D3DX, as it''s object oriented.



--------
Leave all your expectations behind, or
they''ll pull you down on your way to the top.

-Ivan
-----------------------------------------------------It's better to rule in hell than to serve in heaven.------------------------------------------------------Ivan
quote:Original post by Death Hunter
You can use C with DirectX, but each time you call a directX function, you must refer to the ''vtable, something like this:
pDevice->vTable->SomeCommand(), and you can''t use D3DX, as it''s object oriented.



--------
Leave all your expectations behind, or
they''ll pull you down on your way to the top.

-Ivan


You can use D3DX just fine in C. They''re structs and interfaces, just like D3D.

I like pie.
[sub]My spoon is too big.[/sub]
quote:Original post by Death Hunter
pDevice->vTable->SomeCommand()


More precisely:

pDevice->lpVtbl->SomeCommand(pDevice, other args... )

For more of this, take a look at the C macros in the various DX headers.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

This topic is closed to new replies.

Advertisement