[Android] Added the example

This commit is contained in:
Jonathan De Wachter 2013-11-27 11:11:49 +01:00
parent 860c232507
commit 6e57380e4f
15 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sfml"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature android:glEsVersion="0x00010001" />
<application android:label="@string/app_name"
android:icon="@drawable/sfml_logo"
android:hasCode="false"
android:allowBackup="true"
android:debuggable="true">
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:icon="@drawable/sfml_logo"
android:configChanges="keyboardHidden|screenSize">
<meta-data android:name="android.app.lib_name" android:value="sfml-activity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="17" />
</manifest>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Binary file not shown.

View File

@ -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)

View File

@ -0,0 +1,4 @@
APP_PLATFORM := android-17
APP_STL := stlport_shared
APP_ABI := armeabi-v7a
APP_MODULES := sfml-activity sfml-example

View File

@ -0,0 +1,48 @@
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
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();
}
}

View File

@ -0,0 +1 @@
target=android-18

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SFML</string>
</resources>