-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add support for SDL2 #508
Merged
Merged
Add support for SDL2 #508
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since SDL2 requires the main() function to be called with C linkage, and I don't wan't to mess around with linking C with C++ anymore, I just converted the frontpanel library to C... With SDL2 the JPEG code in the frontpanel library isn't used anymore, instead SDL2_image is used to load texture files. This also adds support for other file types (bmp, png, ppm, ...). SDL2 (and macOS, and possible other OS's) require drawing, event handling, window creation etc. to be done from the main thread. So the simulator code now runs in a separate thread. Invoking just "make" compiles for X11, "WANT_SDL=YES make" compiles for SDL2. Not perfect, more work to do.
SDL_RenderDrawPoint was slow, now the FPS stays at 60, previously it dropped into the 30's.
Make fps display work in 3-D mode. Don't cut of descenders of font. Don't overlap fps and cursor position display.
The GL context attributes also apply to the other accelerated windows (Dazzler, VDM, VIO), so reset them after creating the frontpanel context. Don't install SDL signal handlers, we have our own.
These are what cmake uses when generating for macOS.
Arghh. This pull request was against master, sorry... Do you want to revert this and I submit it against dev? |
Just figured, no is OK, as far as I've seen it doesn't create new issues with X11 build. |
Could you merge master into dev, so I can submit more PR's, thanks. |
Sure, done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since SDL2 requires the main() function to be called with C linkage, and I don't wan't to mess around with linking C with C++ anymore, I just converted the frontpanel library to C...
With SDL2 the JPEG code in the frontpanel library isn't used anymore, instead SDL2_image is used to load texture files. This also adds support for other file types (bmp, png, ppm, ...).
SDL2 (and macOS, and possible other OS's) require drawing, event handling, window creation etc. to be done from the main thread. So the simulator code now runs in a separate thread.
Added a typeahead buffer for VDM/VIO for SDL2 because there is only one event loop for all windows.
Added mouse wheel/touchpad scrolling support to zoom in/out of the 3-D frontpanel view.
Invoking just "make" compiles for X11, "WANT_SDL=YES make" compiles for SDL2.