Can't make work events in C and SDL2 |
MrTAToad
|
use
SDL_QUIT looks like it isn't being received for some reason. |
|||||||||||||
|
César
|
Thanks for your answer.
I changed by SDL_WINDOWEVENT_CLOSE, but it still not close the window when I click the X. |
|||||||||||
|
Can't make work events in C and SDL2 |
Ryan C. Gordon
Guest
|
On 06/18/2015 02:50 PM, MrTAToad wrote:
Nope, SDL_QUIT is sent when all windows are closed, so that should work as-is. Also, the window events are strange, you'd actually have to check for this for your approach: ((e.type==SDL_WINDOWEVENT) && (e.window.event==SDL_WINDOWEVENT_CLOSE))
Fwiw, the program worked correctly here. Maybe he's using really old headers with a newer library, and the value of SDL_QUIT changed? --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
César
|
Oh, sorry, I just found the solution.
It was in the build option in my project, I apparently needed to put -lSDL2 in the linker option and now it works well, all kind of events. It was not on the tutorial I saw to install SDL2, but on an other one. It propose to add "-lmingw32 -lSDL2main -lSDL2" too, but I don't really know what does it mean. Should I add all of them ? |
|||||||||||
|
MrTAToad
|
The -l commands are libraries that need to be used. Might be worth adding them to your project.
Looks like you were nearly correct! |
|||||||||||||
|