Jump to content
  • Advertisement
Sign in to follow this  
wicked357

DirectX in a console

This topic is 2704 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been curious about creating DirectX in a console program using int main instead of int WINAPI WinMain, from my understandings you cannot do this, but I have noticed you choose your renderer device in Irrlicht Engine and it is all created in a int main function and very clean. Anyone have any ideas or examples of how this works I am more curious from a learning point of view, any suggestions/pointers are much appreciated. Thank you.

Share this post


Link to post
Share on other sites
Advertisement
If you include windows.h and link to the appropriate libraries (probably kernal32.lib, user32.lib, etc.), you can certainly create a window with CreateWindow(...).


Share this post


Link to post
Share on other sites
main/WinMain are just different entry points into the program. The code to create a window and a DX device are the same regardless of the entry point used.

Share this post


Link to post
Share on other sites

you won't get any messages from windows with winproc then I guess

Is that true though? If you use main() rather than WinMain(), make the appropriate changes to your project to facilitate that, use GetModuleHandle() to get the application instance handle, and then do everything else as you would normally, would that not work? (I don't know, as I've never tried it myself - I'm just curious.)

Share this post


Link to post
Share on other sites

you won't get any messages from windows with winproc then I guess

That's not true at all. It works fine as described.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!