1
General discussions / Re: IOS support?
« on: April 16, 2017, 09:46:12 pm »
I asked this very question in January and nobody responded... I was/am looking for a 2d graphics library, too, and iOS support is essential.
So I downloaded the source code for SFML and spent a few hours figuring it out. Long and short of it is: I got it working on iOS! But I really haven't tested it much.
Attached is a screenshot of SFML running in the iOS simulator as I type this, with sound working too! (the picture doesn't fill the screen because it is too small)
I haven't had time since then to document what I did to get it working. The amount of code I changed is tiny, actually: there are really three problems that I encountered and had to fix:
I've been meaning to fork the the SFML repo and document all of this, but haven't had time (and probably won't for a few more weeks).
So I downloaded the source code for SFML and spent a few hours figuring it out. Long and short of it is: I got it working on iOS! But I really haven't tested it much.
Attached is a screenshot of SFML running in the iOS simulator as I type this, with sound working too! (the picture doesn't fill the screen because it is too small)
I haven't had time since then to document what I did to get it working. The amount of code I changed is tiny, actually: there are really three problems that I encountered and had to fix:
- Code modification: SFML for iOS tries to use some crazy linking to allow int main() OR int main(int, char**) as the starting point of your app. It doesn't work. I removed the linking stuff and set int main(int, char**) as the only possible starting function and it works great! Of course, all those command line arguments are useless on iOS, but who cares? The relevant files to look at are SFMain.hpp, SFMain.mm, and SFAppDelegate.mm, all in the sfml-window/ios folder! Once you look at it, it's obvious what the problem is.
- In order to compile the SFML library for iOS, I had to grab libjpeg.a from online - the file that is included with the repo refuses to link for the simulator. I think I grabbed libturbojpeg.a from this link and just renamed it libjpeg.a and it worked!
- Setup all your linking flags correctly for the iOS SFML app to include all the core Frameworks (NOTE: I probably included more than I needed to!): OpenAL, AVFoundation, GameController, CoreMotion, AudioToolbox, QuartzCore, OpenGLES, CoreGraphics, UIKit, Foundation and CoreAudio
I've been meaning to fork the the SFML repo and document all of this, but haven't had time (and probably won't for a few more weeks).