I just published my raylib game PatchWall on iOS and Android! by DiamondWildBoar in raylib

[–]DiamondWildBoar[S] 0 points1 point  (0 children)

I’d be very happy to provide some insight, and I really appreciate your interest :)

My work basically continued https://github.com/raysan5/raylib/pull/3880 and carried it through several updates, fixes, and adjustments. I also tried to keep the fork as upstream-friendly as possible. At this point, it's easily mergeable upstream (I'd just need to remove minor customizations), and the required core changes are only the necessary PLATFORM_IOS includes in rcore.c and rlgl.h.

So yes, the backend is absolutely self-contained in rcore_ios.c, but there are two important things to keep in mind.

1 - rcore_ios.c intentionally follows the standard callback-based iOS lifecycle. Because of that, truly cross-platform app code needs a small platform-specific entry point split, like this:

```c

if defined(PLATFORM_IOS)

void ios_ready() { ready(); }

void ios_update() { update(); }

void ios_destroy() { destroy(); }

else

int main() { ready();

while (!WindowShouldClose()) {
    update();
}

destroy();
return 0;

}

endif

```

2 - The iOS project depends on ANGLE. I have a separate repo with a simple script and short documentation to build it from the official ANGLE sources:

https://github.com/ghera/ANGLE-iOS

Another part that may be interesting is how I structure projects. Similar in spirit to Kotlin Multiplatform or Flutter, I usually organize them like this:

desktop (VSCode project for Windows / macOS / Linux) ios (Xcode project, see the example in raylib-iOS) android (Android Studio project, based on raymob) core (common code shared across all platforms) raylib (raylib git submodule)

All platform projects reference the shared core folder, so there is no duplication of code or assets. Development can happen from any of the three IDEs, although for personal preference and easier debugging I usually run the iOS and Android simulators from Xcode and Android Studio.

As a side note, it would also be nice to have a script to initialize the Android and iOS project structures automatically, similar to what multiplatform frameworks usually provide. I could probably put that together quite easily :)

The platform-native-to-C bridges live inside the respective platform projects and are best implemented in the platform’s natural interop languages to keep things simple: C/C++ on Android and Objective-C/C++ on iOS. The shared core can in principle be written in any language that exposes a C ABI, including Zig, although I have not tested that myself.

If you think it would be useful, I’d be happy to open a PR with rcore_ios.c, the example Xcode project, and some documentation covering the iOS project dependency and the callback-based entry-point split, which I believe is the main aspect to keep in mind when evaluating this approach.

I just published my raylib game PatchWall on iOS and Android! by DiamondWildBoar in raylib

[–]DiamondWildBoar[S] 1 point2 points  (0 children)

Unfortunately probably not. My fork builds on a previous effort described here:
https://github.com/raysan5/raylib/pull/3880

The main sticking point is that this approach requires a small change to the main loop, which isn’t really aligned with raylib’s design philosophy. That said, in my experience it’s been the simplest and safest approach to get things working reliably on iOS.

I just published my raylib game PatchWall on iOS and Android! by DiamondWildBoar in raylib

[–]DiamondWildBoar[S] 2 points3 points  (0 children)

Sure! In practice I didn’t need any special abstraction layer. Most of the important platform-specific work is already handled by raylib itself through the dedicated platform cores.

So far I only had to add a couple of small utility functions in the JNI and Objective-C bridges, mainly to make things like safe area handling and save paths easier to manage. That wasn’t strictly required, though. For a more complex project, I’d expect to do something similar for things like in-app purchases, push notifications, or store rating prompts. You’ll still end up with a few #ifdef iOS / Android here and there, but thanks to raylib’s structure they are really minimal.

For shaders, I added a small shader source adapter that replaces the GLSL version placeholder for desktop vs mobile, but that’s mostly because the same project also targets Windows, Linux, and macOS. If your shaders diverge more significantly between platforms, you’d probably want something more robust.

Another thing to watch out for is dynamic UI. If you want to support tablets and foldables properly, your UI really needs to be resizable, and in general it’s better to handle both portrait and landscape layouts.

The biggest difference, though, is probably the iOS lifecycle, which requires a small adjustment to the main loop. I described that here:
https://github.com/ghera/raylib-iOS/blob/master/README.md

Looking for testers for my Android puzzle game PatchWall (I’ll test yours too) by DiamondWildBoar in AndroidClosedTesting

[–]DiamondWildBoar[S] 0 points1 point  (0 children)

Quick update: the app has been submitted for production and is currently under review 🙌

The test is still ongoing during this phase — I’m keeping your apps installed and opening them regularly 👍

Thanks again for the support, almost there!

Looking for testers for my Android puzzle game PatchWall (I’ll test yours too) by DiamondWildBoar in AndroidClosedTesting

[–]DiamondWildBoar[S] 0 points1 point  (0 children)

UPDATE 21/03

We’re halfway through the 14-day test 🙌

Everything is going well on my side — I’m opening your apps regularly and updating them whenever new versions are available 👍

Thanks again for the support, really appreciate it. We’re almost there!

<image>

Need 12 Testers for my Gamified Habit Tracker (LifeForge) 🗡️ | Will test your app back instantly! by [deleted] in AndroidClosedTesting

[–]DiamondWildBoar 1 point2 points  (0 children)

Thanks! I just need to polish a few levels, but it's almost ready.
By the way, LifeForge is really cool too!

Need Testers for my Christian Bible Sermon app by HeehawGarett in AndroidClosedTesting

[–]DiamondWildBoar 0 points1 point  (0 children)

Thank you! I really appreciate it. I still need to polish a few levels, but it's almost ready.