diff --git a/examples/android/AndroidManifest.xml b/examples/android/AndroidManifest.xml new file mode 100644 index 000000000..dc43718d1 --- /dev/null +++ b/examples/android/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/android/assets/canary.wav b/examples/android/assets/canary.wav new file mode 100644 index 000000000..a0f3aecc5 Binary files /dev/null and b/examples/android/assets/canary.wav differ diff --git a/examples/android/assets/image.png b/examples/android/assets/image.png new file mode 100644 index 000000000..29ba0102e Binary files /dev/null and b/examples/android/assets/image.png differ diff --git a/examples/android/assets/orchestral.ogg b/examples/android/assets/orchestral.ogg new file mode 100644 index 000000000..f764d61db Binary files /dev/null and b/examples/android/assets/orchestral.ogg differ diff --git a/examples/android/assets/sansation.ttf b/examples/android/assets/sansation.ttf new file mode 100644 index 000000000..d85fbc81d Binary files /dev/null and b/examples/android/assets/sansation.ttf differ diff --git a/examples/android/jni/Android.mk b/examples/android/jni/Android.mk new file mode 100644 index 000000000..8c42b78fd --- /dev/null +++ b/examples/android/jni/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := sfml-example + +LOCAL_SRC_FILES := main.cpp + +LOCAL_SHARED_LIBRARIES := sfml-system +LOCAL_SHARED_LIBRARIES += sfml-window +LOCAL_SHARED_LIBRARIES += sfml-graphics +LOCAL_SHARED_LIBRARIES += sfml-audio +LOCAL_SHARED_LIBRARIES += sfml-network +LOCAL_WHOLE_STATIC_LIBRARIES := sfml-main + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,sfml) diff --git a/examples/android/jni/Application.mk b/examples/android/jni/Application.mk new file mode 100644 index 000000000..385dd64dc --- /dev/null +++ b/examples/android/jni/Application.mk @@ -0,0 +1,4 @@ +APP_PLATFORM := android-17 +APP_STL := stlport_shared +APP_ABI := armeabi-v7a +APP_MODULES := sfml-activity sfml-example diff --git a/examples/android/jni/main.cpp b/examples/android/jni/main.cpp new file mode 100644 index 000000000..90b148d7c --- /dev/null +++ b/examples/android/jni/main.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include + + +int main(int argc, char *argv[]) +{ + sf::RenderWindow window(sf::VideoMode::getDesktopMode(), ""); + + sf::Texture texture; + if(!texture.loadFromFile("image.png")) + return EXIT_FAILURE; + + sf::Sprite image(texture); + image.setPosition(0, 0); + image.setOrigin(texture.getSize().x/2, texture.getSize().y/2); + + sf::Music music; + if(!music.openFromFile("canary.wav")) + return EXIT_FAILURE; + + music.play(); + + while (window.isOpen()) + { + sf::Event event; + + while (window.pollEvent(event)) + { + if (event.type == sf::Event::Closed) + { + window.close(); + } + } + + if (sf::Touch::isDown(0)) + { + sf::Vector2i position = sf::Touch::getPosition(0); + image.setPosition(position.x, position.y); + } + + window.clear(sf::Color::White); + window.draw(image); + window.display(); + } +} diff --git a/examples/android/project.properties b/examples/android/project.properties new file mode 100644 index 000000000..c0442c371 --- /dev/null +++ b/examples/android/project.properties @@ -0,0 +1 @@ +target=android-18 diff --git a/examples/android/res/drawable-hdpi/sfml_logo.png b/examples/android/res/drawable-hdpi/sfml_logo.png new file mode 100644 index 000000000..7bae3335f Binary files /dev/null and b/examples/android/res/drawable-hdpi/sfml_logo.png differ diff --git a/examples/android/res/drawable-ldpi/sfml_logo.png b/examples/android/res/drawable-ldpi/sfml_logo.png new file mode 100644 index 000000000..6552c56b4 Binary files /dev/null and b/examples/android/res/drawable-ldpi/sfml_logo.png differ diff --git a/examples/android/res/drawable-mdpi/sfml_logo.png b/examples/android/res/drawable-mdpi/sfml_logo.png new file mode 100644 index 000000000..87786889e Binary files /dev/null and b/examples/android/res/drawable-mdpi/sfml_logo.png differ diff --git a/examples/android/res/drawable-xhdpi/sfml_logo.png b/examples/android/res/drawable-xhdpi/sfml_logo.png new file mode 100644 index 000000000..ff0d3aa06 Binary files /dev/null and b/examples/android/res/drawable-xhdpi/sfml_logo.png differ diff --git a/examples/android/res/drawable-xxhdpi/sfml_logo.png b/examples/android/res/drawable-xxhdpi/sfml_logo.png new file mode 100644 index 000000000..8a66e84cd Binary files /dev/null and b/examples/android/res/drawable-xxhdpi/sfml_logo.png differ diff --git a/examples/android/res/values/strings.xml b/examples/android/res/values/strings.xml new file mode 100644 index 000000000..acedde694 --- /dev/null +++ b/examples/android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + SFML +