SDL

87 views
Skip to first unread message

LM

unread,
Jul 1, 2021, 3:05:29 PM7/1/21
to fltk.coredev
I downloaded fltk-1.4.x-20210618-713d1bfd and began to check the state of the PicoSDL driver.  After some experimentation, I decided to copy the code for PicoSDL and Pico and create a new SDL driver.  Added some code for drawing various shapes and made some other modifications.  I'm able to get it to compile and build with a SDL backend.  It's really buggy and crashes a lot at this point.  However, I can run some applications and I'm starting to see some of the windows rendered.  Needs a lot of work.  Thought it might be useful to have a working SDL backend though.  That might allow for easier porting to any systems that support SDL.  I'm using SDL2 now, but I can add SDL 1.2.15 support as well for older systems.  It wouldn't require much to get that working if SDL2 support is working properly. 

Thought I'd mention it in case anyone else might be interested in development of a SDL backend for FLTK.

Sincerely,
Laura

melcher....@googlemail.com

unread,
Jul 3, 2021, 7:49:45 AM7/3/21
to fltk.coredev
Sorry sorry sorry sorry. I have not touched Pico in years. Much of the development went into the Android driver, which is basically the idea of Pico in a much more interesting environment. The Android driver has a complete implementation of clipped drawing of text, fonts, polygons, arc, etc. . The missing features are line width and line patters. It supports multiple windows, but not yet a window decoration or desktop. Nevertheless, it is absolutely usable, and most of the non-OpenGL apps compile and run just fine on Android.

I always meant to merge Pico and Android to finally get this idea working, but my job has kept me extremely busy. I'll be happy to help, either in a public forum or by PM: fltk AT matthiasm DOT com , if you feel like investing time into this idea. Starting September, I will have half the work load, and I will hopefully tie all the strings together and implement the original idea of porting FLTK by implementing only three functions (positional event/klick/touch, timer event, and draw a pixel).

melcher....@googlemail.com

unread,
Jul 3, 2021, 8:01:23 AM7/3/21
to fltk.coredev
I should add that I may not have pushed all Android changes into the repos either, so I may be promising stuff that is not yet uploaded. Please let me know how important this is, and I will try to schedule updating the branch asap.

LM

unread,
Jul 12, 2021, 4:33:07 PM7/12/21
to fltk.coredev
The concept of Pico sounds great especially if you can get it working with minimal additional functions.  I started with the Pico and PicoSDL ports.  However, I've been going through the code in the other backends including the Android port.  I'm hoping to take advantage of the features SDL has.  I'm working on switching to TrueType fonts from the bitmap font that was implemented for Pico.  The Pico implementation for fonts is very nice especially considering how much code is needed for it.  What would help in porting is an idea of which functions one might recommend be overridden and some info on what they do.  Would be nice to see that as part of the FLTK documentation at some point.  I created Fl_Font.H and Fl_SDL_Graphics_Driver_font.cxx based on concepts from some of the other ports including the Android one but am having trouble figuring out where to create the font descriptor class from within the graphics driver class.  Each port seems to have its own way of doing it.  At least I'm learning a lot about the various backends for FLTK.  I'll keep experimenting with it.  There's no rush getting the Pico code updated.  I'm getting some useful concepts from the Windows, X11 and Quartz code that is working.   The Android code has a lot of interesting functionality as well and seems better fleshed out than the PicoAndroid code.  Think it would be useful to eventually get a SDL backend working for FLTK.  There are some specialty operating systems like Syllablle and Beos that can run some version of SDL, but can't run X Windows or even nano-x in some cases.  Would be nice to get FLTK working on those types of systems.  Thanks.

LM

unread,
Jul 13, 2021, 2:54:33 PM7/13/21
to fltk.coredev
I'm a little farther along.  I think I have the connections to initialize the fonts working properly.  I can get the tests programs hello, clock and boxtype running.  Event handling needs modifications.  Looks promising though.

Albrecht Schlosser

unread,
Jul 13, 2021, 6:05:46 PM7/13/21
to fltkc...@googlegroups.com
Great! Would you like to fork our GitHub repo, add a branch in your fork
(if you didn't do that already), and let us participate? Or is it too early?


LM

unread,
Jul 14, 2021, 7:35:43 AM7/14/21
to fltk.coredev
On Tuesday, July 13, 2021 at 6:05:46 PM UTC-4 Albrecht Schlosser wrote:
Great! Would you like to fork our GitHub repo, add a branch in your fork
(if you didn't do that already), and let us participate? Or is it too early?

Definitely too early.  I want to get as much of it debugged as possible and get it working as well as I can before I upload it anywhere.  There are still a lot of modifications and changes I want to make to the SDL support.  Also, I'm currently testing on Windows.  Would be nice to test it on Linux too at some point.

LM

unread,
Aug 17, 2021, 9:37:24 AM8/17/21
to fltk.coredev
Still working on the SDL backend.  I found the unittests program which has been a big help in debugging.  At this point, all but two of the unittests seem to be working.  There's an issue with circle and arc drawing.  There is a routine for arc and pie drawing for use with SDL.  However, it needs radius and angles and the input from FLTK is bounding box and angles.  I'm having trouble locating information on how best to convert information about a bounding box to a working radius value.  The other issue is with the schemes test.  It uses multiple windows.  I'm wondering how to handle windowing on a system that might not support creation of multiple windows.  Possibly multiple bitmaps drawn on a main window will work.  SDL 2 does have some support for multiple windows on certain platforms while earlier versions of SDL did not.  I'm attempting to go through the windowing logic in some of the other drivers to see how this works conceptually and how best to handle it.  If anyone has any tips in this area, they'd be greatly appreciated.  I also still need to work on character input.  I'm slowly making progress on the project though.

Bill Spitzak

unread,
Aug 17, 2021, 10:23:14 AM8/17/21
to fltkc...@googlegroups.com
Generally fltk just tries to draw the nicest shape provided by the toolkit. If SDL cannot draw ellipses then I would use sqrt(width*height)/2 as the radius, and make sure the center is in the center of the rectangle, thus getting a circle of the same area.
The circles are very rarely used, especially for anything other than full circles, so it is not very important that they be correct. The current api just matches what X11 provided.


On Tue, Aug 17, 2021 at 6:37 AM LM <lme...@gmail.com> wrote:
Still working on the SDL backend.  I found the unittests program which has been a big help in debugging.  At this point, all but two of the unittests seem to be working.  There's an issue with circle and arc drawing.  There is a routine for arc and pie drawing for use with SDL.  However, it needs radius and angles and the input from FLTK is bounding box and angles.  I'm having trouble locating information on how best to convert information about a bounding box to a working radius value.  The other issue is with the schemes test.  It uses multiple windows.  I'm wondering how to handle windowing on a system that might not support creation of multiple windows.  Possibly multiple bitmaps drawn on a main window will work.  SDL 2 does have some support for multiple windows on certain platforms while earlier versions of SDL did not.  I'm attempting to go through the windowing logic in some of the other drivers to see how this works conceptually and how best to handle it.  If anyone has any tips in this area, they'd be greatly appreciated.  I also still need to work on character input.  I'm slowly making progress on the project though.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/d2f29cd6-59b6-4b38-b370-b987329096een%40googlegroups.com.

LM

unread,
Aug 18, 2021, 8:23:08 AM8/18/21
to fltk.coredev
On Tuesday, August 17, 2021 at 10:23:14 AM UTC-4 <spi...@gmail.com> wrote:
Generally fltk just tries to draw the nicest shape provided by the toolkit. If SDL cannot draw ellipses then I would use sqrt(width*height)/2 as the radius, and make sure the center is in the center of the rectangle, thus getting a circle of the same area.


Thanks for the tips, especially the part about the center being in the center of the rectangle.  I just assumed the arc edges were on the rectangle and that's it.

Reply all
Reply to author
Forward
0 new messages