Cross-Platform Sparrow
Hello!
I've been thinking of submitting a PR to make Sparrow cross platform, this'd involve:
- Using ObjFW instead of Apple's ObjC Runtime
- Using ANGLE where GLES isn't supported and/or making a Desktop GL Renderer
- Using SDL2 rather than UIKit Directly
- Removing the AVFoundation based sound stuff and using only the OpenAL classes, as OpenAL is cross platform
- Using CMake rather than XCode directly (CMake supports generating XCode Project)
Since GCC and Clang both support ObjC I won't need to rewrite the whole library to make it cross plat
I'm opening this issue mainly to know if this'd be desirable, as Sparrow hasn't been getting maintained for a bit. The idea of a Starling-like Framework that could be used in Obj-C and Obj-C++ is just very a appealing idea to me, and I'd love to help bringing this little bird up to modern times.
Oh, wow, @Fancy2209 – I'd absolutely love to see this happening!
Back in the day, Sparrow was first moved to the back seat because of my work for Starling; then, with the introduction of Swift, I didn't see any chance of keeping a pure Objective-C framework attractive enough for being used; and with SpriteKit as competition directly from Apple, a port to Swift didn't seem very useful, either. So I decided it's best to stop working on it.
However, a cross-platform version based on the Objective-C code – that's an intriguing idea. 😃 I'm not sure if this should be a pull request or rather be done in a fork; you'd have every freedom in making this your own project, then. (I'd be totally fine with you using the Sparrow name / logo / whatnot, or giving this a name of your own choice.)
Alternatively, I'd be happy to give you write access to this repository. But since this is still under the "Gamua" hood and would be more your project than mine, I don't know if that's really what you want.
In any case, keep in mind that Sparrow is somewhat behind Starling in its architecture; I never ported the features introduced in Starling 2.x back to Sparrow (i.e., "MeshBatch", custom filters + styles are not available yet). Should you want to move the architecture forward, too, I'm happy to share some insights of what I did in Starling 2.x, what is worth porting over, and what wasn't worth the effort (automatic batching, for example, caused me a lot of headaches and should be replaced with something simpler).
But it's much too soon for getting into that, I suppose. 😆
I mainly wanted to do this as PR so someone could review my changes, I still have a lot to learn and this is my first time using Objective C seriously If you don't have time it's fine but for the first few contributions I'd like to have someone else to review my work before considering write access as it's my first time working on Sparrow.
Definetely interested in backporting feature from Starling to Sparrow too though, but first let's get this done. Writing a meson.build or CMakeLists.txt will probably take longer than actually porting the library
I've never used UIKit before so I'm a bit confused about how I should approach replacing it Instead of a UIView, sparrow would manage an SDL Window who it creates, I'm just not sure what class the Window Creation should happen Should I just try to keep the API as close as possible and abstract the Window with SPViewController?
After a lot of thinking on this, it'd be much easier to rewrite Sparrow on C++ and make a ObjC++ wrapper after the base API is done, Foundation not being cross platform and it being so tied to iOS really kills the idea of using the current codebase I will try to do a POC basing myself from Starling 1 and Sparrow in C++ This would also make it easier to use everywhere as you'd not depend on Clang, and not have the licensing issues of using a ObjC runtime since both of them don't seem to have permissive licenses
Mhm ... probably you're right. There will be a reason why there are so few cross-platform projects using Objective-C. I was always fond of that language, but it's becoming a relict of the past, with most new Apple development done in Swift.
Mhm ... probably you're right. There will be a reason why there are so few cross-platform projects using Objective-C. I was always fond of that language, but it's becoming a relict of the past, with most new Apple development done in Swift.
Yeah :/ I would want to make an ObjC++ wrapper if possible once the C++ version works so people could at least still use sparrow with it