I know this has been done, but I hadn’t done it, so it was my weekend nerd snipe. (no game audio)
This was a lot easier thanks to doomgeneric!
Basic breakdown
Since doomgeneric exposes the framebuffer, I throw that into an SKTexture and that gets added to a node in the SpriteKit scene, which is subclassed to override the update
method to call doomgeneric_Tick()
. Objective-C is used for interop between C and Swift, and fulfills most of the functions listed here. SwiftUI ultimately outputs the scene.
Very few tweaks needed to be made in doomgeneric itself.
They were basically:
- Conditional compilation for a few calls that watchOS didn’t support (and we didn’t need).
- Tweaking the 32-bit color bit offsets.
- Handling a crash related to passing in arguments.
- On watchOS we pass the absolute path of the WAD file in the main bundle to the engine.
- Adjusting some SDL2 includes so headers could be found.
GitHub repo: https://github.com/twstokes/AppleGenericDoom