Jump to content
  • Advertisement
Sign in to follow this  
asdqwe

SDL problem- main() vs WinMain()

This topic is 3661 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 a 2D C++ game that I'd like to port to SDL for speed reasons. Problem is the program is Win32 (has WinMain, WndProc etc) while SDL tutorials all begin with main(). Is there any way to make SDL accept the WinMain()?

Share this post


Link to post
Share on other sites
Advertisement
Is there any reason why you need WinMain? Is seems that you have to choose between one or the other. SDL aims to abstract the user from platform specifics and therefore have their own facilities for windowing, event handling, etc. Also, you dont get much faster than the win32 functions, what in particular do you find is a performance issue?

Share this post


Link to post
Share on other sites
Well, performance-wise, I thought I've read somewhere SDL is faster (isn't it hardware-accelerated even without OpenGL?).
As for WinMain, I don't need it; I need WndProc(), which allowed me to respond to the Windows messages (WM_), particularly the keys messages.

Share this post


Link to post
Share on other sites
Quote:
Original post by asdqwe
Well, performance-wise, I thought I've read somewhere SDL is faster (isn't it hardware-accelerated even without OpenGL?).

This is wrong. You won't see the same benefits as you would by using OpenGL for graphics.

Share this post


Link to post
Share on other sites
Quote:
Original post by asdqwe
As for WinMain, I don't need it; I need WndProc(), which allowed me to respond to the Windows messages (WM_), particularly the keys messages.
You don't need WinMain for that. If you need to get the HINSTANCE, you can just call GetModuleHandle(NULL) to get that.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!