-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add an SDL example to the C bindings #250
Conversation
On Windows, I assume you used SDL2-devel-2.26.5-VC.zip. It wasn't immediately obvious that this is the archive to use, since the win32 zip file with just the DLL was at the top on the GitHub release page. Would be good to add a clarification in the example README. The macOS .dmg does include the CMake support, under SDL2.framework/Resources/CMake. But I got some compile errors. I can give you remote access to my Mac if that would help. |
Here are the compilation errors I got on macOS:
The first one looks easy; the |
75aae35
to
c169def
Compare
Please help to test again on Mac. Are the instructions in the README accurate? |
It would be nice to also try the shared library by using |
I see only one problem with the SDL example on macOS: For some reason, Tab doesn't work. Looking into that now. The instructions in the README are correct. A couple of minor changes though: the word "On" in the platform headings is redundant IMO, and is mildly annoying for a screen reader user trying to skim. Also, the name "Mac OS X" is outdated; it's now "macOS". |
Don't forget to rebase this branch now that #247 is merged. |
Oh I forgot to mention that hit-testing on Linux is not working either... I think something odd is happening with libwnck that Orca is using. |
It's clear enough that Linux support is a work in progress. I see no reason to block this PR on that. |
c169def
to
80ca8be
Compare
Update on the problem with Tab on macOS: I now see that pressing Tab updates the internal focus in the example program, but for some reason I haven't yet figured out, VoiceOver isn't getting a focus change event. This does work in the winit example on macOS. |
I figured out that |
I think the problem is that in SDL on macOS, the keyboard focus is on the window, not the view. So I need to see if overriding |
I tried writing code to subclass the window yesterday afternoon, but that somehow has the unwanted effect of preventing the window from appearing at all. I don't believe I currently have the expertise in Objective-C and Cocoa to debug this. So I can't tell if overriding Another thing I can try is forcing the view, rather than the window, to be the first responder (the object that has keyboard focus in Cocoa). But I don't know if that will have unwanted side effects. Presumably the SDL developers had a good reason for doing things the way they did. |
Thanks @mwcampbell for the detailed report. This is unfortunate. The bug will probably show up with pygame too, as it also uses SDL under the hood. Should I find another library to build the cross-platform with, or are you confident it can be fixed in a reasonable timeframe? FWIW I've used SFML in the past, but it's less popular. |
@mwcampbell |
@DataTriny If it's straightforward to use SFML with CMake, please go ahead and try that on another branch, and let's see if that has the same problem on macOS. Another option I was considering is GLFW, though I don't know how much OpenGL setup you have to do just to get a blank window on the screen with GLFW. |
To more directly answer your question, I might not be able to do any more work with the SDL example until about a week from now. |
80ca8be
to
503c42b
Compare
Finally getting back to the issue with focus on macOS. Contrary to what @rkk-ableton wrote, I did a quick experiment which shows that the |
The macOS focus issue is solved by #266. The change to the SDL example is simple. Just call this right before creating the macOS adapter:
This does require knowing the name of SDL's |
@DataTriny Now that I've merged #266, please rebase this branch and add the one line to the SDL example. Then I'll do one more build and test, and assuming that works, we should be ready to merge this and do a release. |
e157cbb
to
3b7b677
Compare
I built and ran this version on macOS, and it works. Let's ship it. |
Introduces a cross-platform examples using the SDL2 library.
Tested on Windows and Linux. Please help to validate on macOS.
You can use this test release to try the new example.