Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Android and iOS ports available for testing  (Read 340989 times)

0 Members and 3 Guests are viewing this topic.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #435 on: December 29, 2015, 06:18:31 pm »
While I don't remember testing it so far, these functions should – in theory – work out of the box, given you're using the correct path (to be determined using the native context). This can be tricky and suggestions to improve this on SFML side are welcome. :)

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: Android and iOS ports available for testing
« Reply #436 on: December 29, 2015, 09:09:28 pm »
Wow, great to see SFML on iOS. So far I only tested/played around on simulator, but if you guys need to test something on device count on me.
« Last Edit: January 08, 2016, 08:58:02 pm by CJ_COIMBRA »
CJ

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: Android and iOS ports available for testing
« Reply #437 on: January 08, 2016, 08:58:07 pm »
Is there a way to get applicationDidEnterBackground notification from iOS?
CJ

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Android and iOS ports available for testing
« Reply #438 on: January 08, 2016, 09:14:35 pm »
Laurent Gomila - SFML developer

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: Android and iOS ports available for testing
« Reply #439 on: January 09, 2016, 06:07:07 am »
Oh well, I could put a notification on didFinishLaunchingWithOptions from SFAppDelegate just like the one for orientation changes. I get the notifications now but I don't think it will help me back in my game as I was thinking.
CJ

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: Android and iOS ports available for testing
« Reply #440 on: January 12, 2016, 04:51:35 pm »
Hello again,

I was wondering if someone can help me with this problem. After successfully building the libs my app will run on iPhone 4s and 5 simulators but fails on simulators 5s and up. I get this kind of warning for every module:

Quote
ld: warning: ignoring file /Users/christian/Desktop/SFMLtest/SFMLtarget/libsfml-network-s.a, file was built for archive which is not the architecture being linked (x86_64): /Users/christian/Desktop/SFMLtest/SFMLtarget/libsfml-network-s.a

And then tons of errors of course because of undefined stuff. Probably related to "architectures/valid architectures" but I don't know much about it. Tried a few changes but the problem remained. Any suggestions?
CJ

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Android and iOS ports available for testing
« Reply #441 on: January 12, 2016, 08:27:25 pm »
You probably need to build for 64 bits. But don't ask me how to do that ;D
Laurent Gomila - SFML developer

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: Android and iOS ports available for testing
« Reply #442 on: January 12, 2016, 10:55:01 pm »
Yeah, I did a lot of combinations until one of them worked out. Curiously it is was not the 64 bit one but this:
32 bit Intel (i386) $(ARCHS_STANDARD_32_BIT)
CJ

imnaero

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Android and iOS ports available for testing
« Reply #443 on: February 07, 2016, 02:54:07 am »
Hello!

I've been trying all day to compile SFML for android and i have been following this guide:
https://github.com/SFML/SFML/wiki/Tutorial:-Building-SFML-for-Android

So far I've made it to actually building the android example by calling 'ndk-build'.
However when I do, i get a load of errors. It seems to start out well and then fails when it reaches a shared
library in main.cpp. I can't make any sense of what it's looking for that isn't there and when i should have created that object.

Here are my errors, can any of you brilliant people infer from this what i might have done wrong?

EDIT: I have circumvented this issue by changing this line in my Application.mk:
APP_STL := gnustl_shared (instead of c++shared)

C:\Androidstuff\SFML\examples\android>ndk-build -B
[armeabi-v7a] Prebuilt       : libsfml-activity.so <= <NDK>/sources/sfml/lib/arm
eabi-v7a/
[armeabi-v7a] Install        : libsfml-activity.so => libs/armeabi-v7a/libsfml-a
ctivity.so
[armeabi-v7a] Compile++ thumb: sfml-example <= main.cpp
[armeabi-v7a] Prebuilt       : libsfml-graphics.so <= <NDK>/sources/sfml/lib/arm
eabi-v7a/
[armeabi-v7a] Prebuilt       : libsfml-audio.so <= <NDK>/sources/sfml/lib/armeab
i-v7a/
[armeabi-v7a] Prebuilt       : libsfml-network.so <= <NDK>/sources/sfml/lib/arme
abi-v7a/
[armeabi-v7a] Prebuilt       : libc++_shared.so <= <NDK>/sources/cxx-stl/llvm-li
bc++/libs/armeabi-v7a/thumb/
[armeabi-v7a] Prebuilt       : libsfml-window.so <= <NDK>/sources/sfml/lib/armea
bi-v7a/
[armeabi-v7a] Prebuilt       : libsfml-system.so <= <NDK>/sources/sfml/lib/armea
bi-v7a/
[armeabi-v7a] SharedLibrary  : libsfml-example.so
jni/main.cpp:10: error: undefined reference to 'sf::String::String(char const*,
std::__1::locale const&)'
jni/main.cpp:13: error: undefined reference to 'sf::Texture::loadFromFile(std::_
_1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
const&, sf::Rect<int> const&)'
jni/main.cpp:21: error: undefined reference to 'sf::Music::openFromFile(std::__1
::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > co
nst&)'
C:/Androidstuff/android-ndk-r10e/sources/sfml/lib/armeabi-v7a/libsfml-main.a(Mai
nAndroid.o):MainAndroid.cpp:function ANativeActivity_onCreate: error: undefined
reference to 'std::basic_ios<char, std::char_traits<char> >::rdbuf(std::basic_st
reambuf<char, std::char_traits<char> >*)'
C:/Androidstuff/android-ndk-r10e/sources/sfml/lib/armeabi-v7a/libsfml-main.a(Mai
nAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefin
ed reference to 'std::locale::~locale()'
C:/Androidstuff/android-ndk-r10e/sources/sfml/lib/armeabi-v7a/libsfml-main.a(Mai
nAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefin
ed reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)'
C:/Androidstuff/android-ndk-r10e/sources/sfml/lib/armeabi-v7a/libsfml-main.a(Mai
nAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefin
ed reference to 'std::string::_Rep::_S_empty_rep_storage'
C:/Androidstuff/android-ndk-r10e/sources/sfml/lib/armeabi-v7a/libsfml-main.a(Mai
nAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefin
ed reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'

C:/Androidstuff/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/w
indows/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideab
i/bin/ld.exe: the vtable symbol may be undefined because the class is missing it
s key function
collect2.exe: error: ld returned 1 exit status
make.exe: *** [obj/local/armeabi-v7a/libsfml-example.so] Error 1

C:\Androidstuff\SFML\examples\android>
« Last Edit: February 07, 2016, 01:33:20 pm by imnaero »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #444 on: February 09, 2016, 09:08:15 am »
Haven't tried latest NDK so far, maybe they've changed something. From first guess looks some issue with linking order.

johnyrex

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Android App Development Company
    • Email
Re: Android and iOS ports available for testing
« Reply #445 on: July 21, 2017, 07:44:17 am »
Hi

The iOS/Android ports are finally ready for beta-testing. This happens one month after the expected date, sorry for the delay (everyone is very busy -- more than usual). Until Jonathan pushes the code to the public repository, here is what you need to know if you want to play with them.

Where?

The ports will be available in the ios_and_android branch of the repository. This way it won't bother people who are not interested, and the amount of testers (and reports) is kept under control.

How to compile the iOS port?

To compile the iOS port, you must use the Xcode generator of CMake, and define the "IOS" boolean variable (set to TRUE) before configuring for the first time. The generated projects can then be compiled for x86 (simulator) or armv6/v7 (device) by selecting the target in Xcode; no need to generate multiple builds for that. SFML is built as static libraries on iOS (this is the only option for this OS).

To use SFML in your iOS app project, do as usual: add the include path to your project settings, and drag'n'drop the libraries into your project. Since SFML is linked statically, you'll have to link all its non-default dependencies as well (extlibs/libs-ios).
Note that you'll need a registered Apple developer account in order to copy and run your app on a device; otherwise the simulator will be your only choice.

How to compile the Android port?
How to compile the OpenGL ES port for Linux?
Things to know for Android

Jonathan will explain that as soon as he is available ;)

New API

Only a few things have been added to the public API:
  • The sf::Keyboard::setVirtualKeyboardVisible function
  • The Touch API:
    • A sf::Touch class (similar to sf::Mouse)
    • sf::TouchBegan / sf::TouchMoved / sf::TouchEnded events (similar to mouse events)

General things to know

The sensors (accelerometer, gyroscope, compass, ...) are currently using the Joystick API (see the sources for more detail about the mapping). We'll soon add a sf::Sensor API that better matches the requirements.

The foreground / background events are mapped to the GainedFocus and LostFocus events.

Orientation changes are mapped to the Resize event.

sf::Shader is not available, because the implementation is based on OpenGL ES 1. Shaders are only available in OpenGL ES 2, which would require a major rewriting of the graphics part. So that won't be done in a near future.

Things to know for iOS

On iOS, the working directory is automatically set to the resources directory.

There's no audio module on iOS, I'm still waiting for libsndfile to add a license exception for iOS so that I can use it statically without breaking the terms of the license. The author said it was one of its priorities, but it was months ago and I've got no news...

The implementation should be compatible with iOS 4.0 and more.

The size of the window is ignored, the screen size is always used.

Examples are not available. It seems that CMake is not ready for that, it still requires too many hacks, and even with them, it was still pretty bad.

The ugly hack: you need to include <SFML/Main.hpp> in the file where your main function is defined. This is because SFML has to hijack it, and rename your own main to call it later.

There's no specific support for high-resolution (retina) screens, they currently produce the same output as low-res screens (this will be done later).

Important

Until everything is merged into master, please use the forum for your feedback. You can post here or open new threads. There are still many things to do, I don't want to pollute the task tracker ;)

Thanks @Laurent

eigen

  • Jr. Member
  • **
  • Posts: 64
  • Brobdingnagian ding dong
    • View Profile
    • Pioneersgame.com
Re: Android and iOS ports available for testing
« Reply #446 on: May 14, 2018, 10:15:54 pm »
Hey guys.

So, I was testing out the iOS port last night for my game City Clickers and it seems to work sufficiently enough. Adding touch in addition to mouse controls was really straightforward. Have some weird flickering at launch (the whole screen is magenta for a moment), hopefully something I can track down. I'm not sure about actually targeting iOS, just experimenting for now but it seems promising.

Two quick questions:
1) Are render textures supposed to work on iOS?
2) As I understand, shaders are not supported due to older OpenGL ES and upgrading is quite a bit of work. How much work you reckon? What are the roadblocks? Given some good pointers, could I (with no real graphics programming experience) make something work?

It's pretty much the only thing I'm really missing atm. I have a post-processing shader to get the look I want, sort of complicated to achieve without it.

I guess I can work around something somehow but that would be an awesome addition/upgrade to the library.

The exciting moment I first got everything playable:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Android and iOS ports available for testing
« Reply #447 on: May 14, 2018, 10:40:21 pm »
Really cool seeing the porting to be quite okay. :)

I'd say it's quite a bit of work and you'll have to adjust for some changes. Doing it without thinking about backwards compatibility probably makes things a bit easier.
Personally I haven't dug into the depth of SFML's rendering, but you'd have to most likely change quite a bit regarding context management, then you'd have to change all the rendering for modern OpenGL and finally, you'll have to ditch the current shader implementation and adjust it for modern OpenGL.

The final part is, what we've been discussion not very actively in this thread and it's the first stepping stone towards modern OpenGL.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #448 on: July 28, 2018, 06:40:57 pm »
Just to mention it here for everyone subbed to the thread: SFML's current master branch on GitHub should once again build and run Android properly for everyone, even if you're using the audio module and/or use the shared C++ runtime. Apps will still fail to regain a working context once you switch out of them, though.
« Last Edit: July 28, 2018, 06:51:17 pm by Mario »

 

anything