Event issues on Mac |
dandago
|
I wrote several basic SDL2 tutorials a couple of years ago. I've had several people claim that the code didn't work on a Mac. This one for example:
http://programmersranch.blogspot.com.mt/2014/02/sdl2-pixel-drawing.html You can see from the comments at the bottom what the issues reported are. Someone also suggests changing the way events are being processed. I don't have a Mac and haven't been able to investigate these issues. Does anyone have any insight into why these problems occur and how to solve them? |
|||||||||||
|
Event issues on Mac |
Jonny D
|
Yeah, the suggestion is to use while(SDL_PollEvent(&event)) instead of SDL_WaitEvent. Have you tried that?
Jonny D On Sunday, November 8, 2015, dandago wrote:
|
|||||||||||||
|
Re: Event issues on Mac |
brada
|
that comment is from 2014, are you sure this is still an issue? In the past I too have had the problem with SDL not dispatching the SDL_QUIT event on Mac OS X; I had to work around it in my application code by implementing applicationShouldTerminate in my app delegate and manually creating the SDL_QUIT event and queuing it with SDL_PushEvent.
No idea about the other issue with nothing being drawn. I do know that mac trackpads send a mix of touch events and mouse events. If the commenters notion of "clicking" is just taping the trackpad then its not going to hit the mouse down. the mousemotion events could not be being sent because it is instead sending touch events too. |
|||||||||||
|
dandago
|
I don't know; as I said I don't have a Mac. I was hoping someone could shed some light on whether this is a bug in SDL2 or I'm doing something wrong. It may well be a bug that's been fixed, but I can't check it myself.
|
|||||||||||
|
Event issues on Mac |
eric.w
|
I just tested that tutorial ( http://programmersranch.blogspot.com.mt/2014/02/sdl2-pixel-drawing.html ) with SDL2 hg, on OSX 10.11.1, and it works fine for me. I can paint by clicking the laptop's trackpad. (The only things I changed were the new/delete to malloc/free because I was running it inside the SDLTest.xcodeproj, and didn't want to bother configuring it for c++.)
The process also exits when I close the window, as expected. Cheers, Eric On Tue, Nov 10, 2015 at 10:58 AM, dandago wrote:
|
|||||||||||||
|
dandago
|
Great, thanks for checking.
|
|||||||||||
|