Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL problem- main() vs WinMain()

Started by asdqwe Dec 5, 2008 at 1:43 AM 4 replies 3.2k views
Original Post
asdqwe
asdqwe
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()?
djbuzzkill
djbuzzkill
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?
asdqwe
asdqwe
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.
nsto119
nsto119
SDL has its own way to handle user input and window events.
Kylotan
Kylotan
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.
Evil Steve
Evil Steve
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.