SFML community forums

Help => General => Topic started by: Morozov_5f on January 28, 2015, 10:50:43 pm

Title: Building SFML for iOS and creating an iOS app
Post by: Morozov_5f on January 28, 2015, 10:50:43 pm
Hi everyone! I know about this topic (http://en.sfml-dev.org/forums/index.php?topic=13716.0), but after reading it I still got some questions:
1. I don't quite get how to make an iOS project with SFML. I mean, I've added include path, drag'n'dropped all the stuff i build before and what next? I mean, how can I add an entry point for my app? Could someone give a small example, please or just explain for dummies like me? :)
2. Do I have to write code in Objective-C or C++ in iOS SFML?

Thank you :)
Title: Re: Building SFML for iOS and creating an iOS app
Post by: Laurent on January 28, 2015, 10:55:53 pm
You write code in C++ like before, SFML handles the Obj-C stuff and main loop for you. The only additional thing to do is to include <SFML/Main.hpp> in the file where your main() function is.
Title: Re: Building SFML for iOS and creating an iOS app
Post by: Morozov_5f on January 28, 2015, 11:13:53 pm
You write code in C++ like before, SFML handles the Obj-C stuff and main loop for you. The only additional thing to do is to include <SFML/Main.hpp> in the file where your main() function is.
I still don't quite get. Xcode default iOS project contains main.m, which already contains main(). Do I have to include <SFML/Main.hpp> right there? That's doubtfully. Or I need to create a *.cpp file with new entry point and include Main.hpp? Could you explain please? Sorry for bothering.
Title: Re: Building SFML for iOS and creating an iOS app
Post by: Laurent on January 29, 2015, 08:08:53 am
Of course XCode creates a main.m file with a main() and a main loop. This is how everybody does when writing a native iOS app in Objective-C. But this is not what you do, you're writing a regular SFML app in C++, so you mustn't base it on the XCode iOS template (except for some project settings I guess). Just start with an empty project and add your own main.cpp and your own main function, which looks like the one you're used to write in C++. Don't overthink it, just do it like you did for non-iOS platforms ;)
Title: Re: Building SFML for iOS and creating an iOS app
Post by: Morozov_5f on January 29, 2015, 08:15:38 am
Oh, that simpe? Thanks a lot! I've been looking forward for iOS version of SFML, and now I can try it. Thank you again, SFML is the best. :)