Sign in to follow this  

SDL problem- main() vs WinMain()

This topic is 3297 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
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

This topic is 3297 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this