Porting small demos (like the SDL-Newton demos) is something trivial, but porting such a big application like the NewtonPlayGround is a rather hard and also time-consuming task, so I’ll have to put some thoughts into this before making decissions that I later on may regret. Porting it to other OS’es than Win32 was initially not on my list, but Dominique Louis pointed out that I should use SDL to start with porting, but sadly that’s not the only thing that needs to be done. So here is a list of the most important things I’ll have to do when porting it to Linux (maybe even MacOS, but I have no Mac around) :
Display and Windowhandling (minor)
Straight-forward. Like with some of my other demos/apss I’d go for SDL. Changing from my current way of window handling to using SDL should be very easy.
XML (major)
This would be a big amount of work. NewtonPlayGround uses the XML-components that are offered by Delphi (from Pro and up), so I’d have to replace them when I want to port it to FPC (Lazarus). The only real alternative seems to be the SmallXML-stuff from the JEDI-VCL, but I don’t know if it works with Lazarus. If that’s the case, it’s hopefully easy to replace my current XML loading and saving code (which should be hundreds of lines of code) with SmallXML. I’ll have to see how this works out.
User Interface (major)
This should give me the biggest headache of all the stuff that has to be done when porting the NewtonPlayGround. Up to now the application has a dozen different dialogs, some of which are simple (like the about dialog) and some of which are rather complex (like the one for creating bodies) and include dozens of different components. The VCL is one of Delphi’s biggest strength, so I used it for creating all the nifty and complicated dialogs, but the VCL (please count Kylix out, I won’t use it, Borland isn’t doing anything with it anymore, so CLX is no choice) is windows-only.
So I would need a good replacement for the VCL which works on all the platforms the NewtonPlayGround should run on. Dominique Louis pointed me to SDLControls, but I’m not sure if it’s sufficient for my needs. It’s nothing official (some personal project) and it also lacks some components I need. Another choice would be to create an OpenGL user interface myself, and I already have something I created for a gameproject of mine. It’s rather advanced but also lacks many components I would need, so this would mean additional time to implement those missing controls. But no matter what way I choose, changing the user interface would be the biggest and most time-consuming part of all the porting. So as one can see, porting the NewtonPlayGround would take many hours (days, weeks, who knows) of my very limited spare-time. So unless I don’t “gain” anything from it, I don’t think that I’ll be doing it. So if there are enough requests for a port to Linux (or even MacOS) I’ll consider this again, otherwise the NewtonPlayGround will stay Windows-only. And please don’t ask why I haven’t developed it with cross-platform in mind from the beginning, cause when I started out with it I neither thought it would become so popular and complex, nor was there a Linux/Mac-version of the Newton Physics Engine.