Order files
This commit is contained in:
9
android/tools/love-android-sdl2/.classpath
Normal file
9
android/tools/love-android-sdl2/.classpath
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
53
android/tools/love-android-sdl2/.project
Normal file
53
android/tools/love-android-sdl2/.project
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>love_android_sdl2</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/[Löve] Generate Internal Scripts.launch</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/ndk-build.launch</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
71
android/tools/love-android-sdl2/AndroidManifest.xml
Normal file
71
android/tools/love-android-sdl2/AndroidManifest.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="love.to.android1104181206"
|
||||
android:versionCode="15"
|
||||
android:versionName="0.9.2"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="Game 1104181206"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="Game 1104181206"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="tv.ouya.intent.category.GAME"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="application/x-love-game" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:pathPattern=".*\\.love" />
|
||||
<data android:host="*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="DownloadActivity"
|
||||
android:noHistory="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http"
|
||||
android:host="*"
|
||||
android:pathPrefix="*"
|
||||
android:mimeType="*/*"
|
||||
android:pathPattern=".*\\.love" />
|
||||
<data android:scheme="https"
|
||||
android:host="*"
|
||||
android:pathPrefix="*"
|
||||
android:mimeType="*/*"
|
||||
android:pathPattern=".*\\.love" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<!-- Android 2.3.3 -->
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
</manifest>
|
140
android/tools/love-android-sdl2/README.md
Normal file
140
android/tools/love-android-sdl2/README.md
Normal file
@ -0,0 +1,140 @@
|
||||
Android Port of LÖVE, the awesome 2D game engine LÖVE (http://love2d.org)
|
||||
Copyright (c) 2013-2014 Martin Felis <martin@fysx.org>
|
||||
|
||||
Instructions:
|
||||
-------------
|
||||
|
||||
For detailed instructions please refer to the wiki at [https://bitbucket.org/MartinFelis/love-android-sdl2/wiki/Home](https://bitbucket.org/MartinFelis/love-android-sdl2/wiki/Home).
|
||||
|
||||
Download:
|
||||
---------
|
||||
|
||||
You can download pre-built Android packages from
|
||||
[https://bitbucket.org/MartinFelis/love-android-sdl2/downloads](https://bitbucket.org/MartinFelis/love-android-sdl2/downloads)
|
||||
that allow you to run .love files by opening them using a file manager of
|
||||
your choice.
|
||||
|
||||
Quick Start:
|
||||
------------
|
||||
|
||||
Install the Android NDK and the Android SDK with SDK API 12 and run
|
||||
|
||||
ndk-build -j4
|
||||
|
||||
and after that
|
||||
|
||||
ant debug
|
||||
|
||||
in the root folder of this project or load the project using Eclipse and
|
||||
compile/run it using Eclipse.
|
||||
|
||||
This should give you a .apk file in the bin/ subdirectory that you can then
|
||||
install on your phone.
|
||||
|
||||
Bugs:
|
||||
-----
|
||||
|
||||
Bugs and feature requests should be reported to the issue tracker at [https://bitbucket.org/MartinFelis/love-android-sdl2/issues?status=new&status=open](https://bitbucket.org/MartinFelis/love-android-sdl2/issues?status=new&status=open).
|
||||
|
||||
Changelog:
|
||||
----------
|
||||
|
||||
0.9.1b:
|
||||
|
||||
* added love.system.vibrate(seconds)
|
||||
* print statements are now redirected to logcat. Output is prefixed with "[LOVE] "
|
||||
* removed DevIL, libpng, libjpeg, libmng, and libtiff
|
||||
* pngs are loaded using lodepng and jpegs using libturbo-jpeg
|
||||
* repeatedly fixed a bug which caused Release builds to crash
|
||||
* update to latest mobile-common branch
|
||||
|
||||
0.9.1a:
|
||||
|
||||
* using latest SDL\_androidgl.c (fixes some random performance issues)
|
||||
* using latest love-android @ changeset 8659be0e75a3 (adds support for
|
||||
compressed textures)
|
||||
|
||||
0.9.1:
|
||||
|
||||
* uses 0.9.1 API
|
||||
* fixed crash on Moto G (and possibly other devices). This was a nasty bug that would just show a blue screen without an error message. The bug was resolved using the help of headchant
|
||||
* fixed loading of jpegs (it probably hasn't worked up to now)
|
||||
* fixed issues with looping over active touches. This fix was sponsored by slime!
|
||||
|
||||
beta2:
|
||||
|
||||
* fixed bug with canvases
|
||||
* fixed writing of files when no identity in conf.lua was set
|
||||
* added file association (somewhat experimental)
|
||||
|
||||
beta1:
|
||||
|
||||
* fixed nasty crash on startup bug
|
||||
* fixed love.filesystem.getDirectoryItems()
|
||||
|
||||
alpha9:
|
||||
|
||||
* Packaged games do not get duplicated for loading, instead are loaded from memory (!!!)
|
||||
* Using inofficial physfs 2.1
|
||||
* Removed love.android.getDisplayMetrics(), instead use love.window.getPixelScale()
|
||||
* Properly link LGPL libraries dynamically. Everything else is linked statically
|
||||
* Added an icon (design by @josefnpat)
|
||||
* Fixed crash on startup on OUYA (and possibly other devices)
|
||||
|
||||
alpha8:
|
||||
|
||||
* Exposing DisplayMetrics in love.android.getDisplayMetrics())
|
||||
* Accelerometer is now available as a joystick
|
||||
* enabled armv6 compilation (larger files, better compatibility with Tegra2 devices)
|
||||
* updated to latest mobile-common branch (including (very) basic multi-touch gesture tracking)
|
||||
* updated OpenAL from 1.13 to 1.15.1
|
||||
* updated jpeg library from 8c to 9a
|
||||
* updated lcms from 2.2 to 2.5
|
||||
* updated libogg from 1.3.0 to 1.3.1
|
||||
* updated libvorbis from 1.3.2 to 1.3.4
|
||||
* updated mpg123 from 1.13.4 to 1.17.0
|
||||
|
||||
alpha7:
|
||||
|
||||
* love.system.getOS() now returns "Android"
|
||||
* hardware search key is reported as "search"
|
||||
* switched to mobile-common branch
|
||||
* using new love.touch module (love.touchpressed(id,x,y,p), love.touchmoved(id,x,y,p), love.touchmoved(id,x,y,p))
|
||||
* added LOVE_ANDROID define
|
||||
|
||||
License:
|
||||
--------
|
||||
|
||||
This project contains code from multiple projects using various licenses.
|
||||
Please look into the folders of jni/<projectname>/ for the respective
|
||||
licenses. A possibly incomplete overview of dependent and included
|
||||
libraries and licenses is the following:
|
||||
|
||||
* FreeType2 (FreeType Project License)
|
||||
* libjpeg-turbo (custom license)
|
||||
* libmodplug (public domain)
|
||||
* libogg (BSD License)
|
||||
* libvorbis (BSD License)
|
||||
* LuaJIT (MIT License)
|
||||
* mpg123 (LGPL 2.1 License)
|
||||
* openal-soft (LGPL 2 License)
|
||||
* physfs (zlib License)
|
||||
* SDL2 (zlib License)
|
||||
|
||||
This project also includes LÖVE, which itself is licensed under the zlib
|
||||
license but includes the following libraries that are subject to other
|
||||
licenses:
|
||||
|
||||
* modified Box2D (original Box2D license is zlib)
|
||||
* ddsparse (MIT License)
|
||||
* enet (MIT License)
|
||||
* glad (MIT License)
|
||||
* lodepng (zlib License)
|
||||
* luasocket (MIT License)
|
||||
* SimplexNoise1234 (public domain)
|
||||
* stb_image (public domain)
|
||||
* utf8 (Boost License)
|
||||
* wuff (public domain)
|
||||
|
||||
As for the other code, modifications to LÖVE, and build system files are
|
||||
are published under the zlib license (same as LÖVE).
|
17
android/tools/love-android-sdl2/ant.properties
Normal file
17
android/tools/love-android-sdl2/ant.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
BIN
android/tools/love-android-sdl2/assets/game.love
Normal file
BIN
android/tools/love-android-sdl2/assets/game.love
Normal file
Binary file not shown.
71
android/tools/love-android-sdl2/bin/AndroidManifest.xml
Normal file
71
android/tools/love-android-sdl2/bin/AndroidManifest.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="love.to.android1104181206"
|
||||
android:versionCode="15"
|
||||
android:versionName="0.9.2"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="Game 1104181206"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="Game 1104181206"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="tv.ouya.intent.category.GAME"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="application/x-love-game" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:pathPattern=".*\\.love" />
|
||||
<data android:host="*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="DownloadActivity"
|
||||
android:noHistory="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http"
|
||||
android:host="*"
|
||||
android:pathPrefix="*"
|
||||
android:mimeType="*/*"
|
||||
android:pathPattern=".*\\.love" />
|
||||
<data android:scheme="https"
|
||||
android:host="*"
|
||||
android:pathPrefix="*"
|
||||
android:mimeType="*/*"
|
||||
android:pathPattern=".*\\.love" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<!-- Android 2.3.3 -->
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
</manifest>
|
@ -0,0 +1,2 @@
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/AndroidManifest.xml : \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/AndroidManifest.xml \
|
10
android/tools/love-android-sdl2/bin/build.prop
Normal file
10
android/tools/love-android-sdl2/bin/build.prop
Normal file
@ -0,0 +1,10 @@
|
||||
#Last build type
|
||||
#Fri, 04 Nov 2016 18:12:11 +0100
|
||||
|
||||
build.last.target=debug
|
||||
|
||||
build.last.is.instrumented=false
|
||||
|
||||
build.last.is.packaging.debug=true
|
||||
|
||||
build.last.is.signing.debug=true
|
BIN
android/tools/love-android-sdl2/bin/classes.dex
Normal file
BIN
android/tools/love-android-sdl2/bin/classes.dex
Normal file
Binary file not shown.
31
android/tools/love-android-sdl2/bin/classes.dex.d
Normal file
31
android/tools/love-android-sdl2/bin/classes.dex.d
Normal file
@ -0,0 +1,31 @@
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes.dex : \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/BuildConfig.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/LtaActivity.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/R$attr.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/R$drawable.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/R.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/DummyEdit.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$1.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$2.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$3.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$4.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$5.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$6.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$SDLCommandHandler.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$ShowTextInputTask.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLGenericMotionListener_API12.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLInputConnection.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLJoystickHandler.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLJoystickHandler_API12$RangeComparator.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLJoystickHandler_API12$SDLJoystick.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLJoystickHandler_API12.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLMain.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLSurface$1.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLSurface.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/love2d/android/DownloadActivity.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/love2d/android/DownloadRequestSettings_API11.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/love2d/android/DownloadService$1.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/love2d/android/DownloadService.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/love2d/android/GameActivity$1.class \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/love2d/android/GameActivity.class \
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/love_android_sdl2-debug-unaligned.apk : \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/love_android_sdl2.ap_ \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes.dex \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi/libgnustl_shared.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi/liblove.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi/libmpg123.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi/libopenal.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi-v7a/libgnustl_shared.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi-v7a/liblove.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi-v7a/libmpg123.so \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/libs/armeabi-v7a/libopenal.so \
|
BIN
android/tools/love-android-sdl2/bin/love_android_sdl2-debug.apk
Normal file
BIN
android/tools/love-android-sdl2/bin/love_android_sdl2-debug.apk
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/bin/love_android_sdl2.ap_
Normal file
BIN
android/tools/love-android-sdl2/bin/love_android_sdl2.ap_
Normal file
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/love_android_sdl2.ap_ \
|
||||
: /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/res/drawable-xxhdpi/ic_launcher.png \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/res/drawable-xxhdpi/ic_launcher.png \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/assets/game.love \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/AndroidManifest.xml \
|
9
android/tools/love-android-sdl2/bin/proguard.txt
Normal file
9
android/tools/love-android-sdl2/bin/proguard.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# view AndroidManifest.xml #generated:45
|
||||
-keep class love.to.android1104181206.DownloadActivity { <init>(...); }
|
||||
|
||||
# view AndroidManifest.xml #generated:17
|
||||
-keep class love.to.android1104181206.DownloadService { <init>(...); }
|
||||
|
||||
# view AndroidManifest.xml #generated:18
|
||||
-keep class love.to.android1104181206.LtaActivity { <init>(...); }
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
17
android/tools/love-android-sdl2/build.properties
Normal file
17
android/tools/love-android-sdl2/build.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
93
android/tools/love-android-sdl2/build.xml
Normal file
93
android/tools/love-android-sdl2/build.xml
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This should be changed to the name of your project -->
|
||||
<project name="love_android_sdl2" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
11
android/tools/love-android-sdl2/default.properties
Normal file
11
android/tools/love-android-sdl2/default.properties
Normal file
@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
3
android/tools/love-android-sdl2/gen/R.java.d
Normal file
3
android/tools/love-android-sdl2/gen/R.java.d
Normal file
@ -0,0 +1,3 @@
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/gen/love/to/android1104181206/R.java \
|
||||
: /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/res/drawable-xxhdpi/ic_launcher.png \
|
||||
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/AndroidManifest.xml \
|
@ -0,0 +1,6 @@
|
||||
/** Automatically generated file. DO NOT MODIFY */
|
||||
package love.to.android1104181206;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = true;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package love.to.android1104181206;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int ic_launcher=0x7f020000;
|
||||
}
|
||||
}
|
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi-v7a/liblove.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi-v7a/liblove.so
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi-v7a/libmpg123.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi-v7a/libmpg123.so
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi-v7a/libopenal.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi-v7a/libopenal.so
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi/libgnustl_shared.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi/libgnustl_shared.so
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi/liblove.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi/liblove.so
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi/libmpg123.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi/libmpg123.so
Normal file
Binary file not shown.
BIN
android/tools/love-android-sdl2/libs/armeabi/libopenal.so
Normal file
BIN
android/tools/love-android-sdl2/libs/armeabi/libopenal.so
Normal file
Binary file not shown.
71
android/tools/love-android-sdl2/original/AndroidManifest.xml
Normal file
71
android/tools/love-android-sdl2/original/AndroidManifest.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="love.to.android"
|
||||
android:versionCode="15"
|
||||
android:versionName="0.9.2"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="loveToAndroid Game"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="loveToAndroid Game"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="tv.ouya.intent.category.GAME"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="application/x-love-game" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:pathPattern=".*\\.love" />
|
||||
<data android:host="*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="DownloadActivity"
|
||||
android:noHistory="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http"
|
||||
android:host="*"
|
||||
android:pathPrefix="*"
|
||||
android:mimeType="*/*"
|
||||
android:pathPattern=".*\\.love" />
|
||||
<data android:scheme="https"
|
||||
android:host="*"
|
||||
android:pathPrefix="*"
|
||||
android:mimeType="*/*"
|
||||
android:pathPattern=".*\\.love" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<!-- Android 2.3.3 -->
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
</manifest>
|
@ -0,0 +1,4 @@
|
||||
package love.to.android;
|
||||
import org.love2d.android.GameActivity;
|
||||
|
||||
public class LtaActivity extends GameActivity {}
|
14
android/tools/love-android-sdl2/project.properties
Normal file
14
android/tools/love-android-sdl2/project.properties
Normal file
@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
@ -0,0 +1,4 @@
|
||||
package love.to.android1104181206;
|
||||
import org.love2d.android.GameActivity;
|
||||
|
||||
public class LtaActivity extends GameActivity {}
|
1676
android/tools/love-android-sdl2/src/org/libsdl/app/SDLActivity.java
Normal file
1676
android/tools/love-android-sdl2/src/org/libsdl/app/SDLActivity.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
package org.love2d.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class DownloadActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Uri uri = this.getIntent().getData();
|
||||
|
||||
if (uri.getScheme().equals("http")) {
|
||||
String url = uri.toString();
|
||||
Intent intent = new Intent(this, DownloadService.class);
|
||||
intent.putExtra("url", url);
|
||||
startService(intent);
|
||||
};
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package org.love2d.android;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.app.IntentService;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
public class DownloadService extends IntentService {
|
||||
public DownloadService() {
|
||||
super("DownloadService");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.d("DownloadService", "destroying");
|
||||
unregisterReceiver(downloadReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
Log.d ("DownloadService", "service started");
|
||||
|
||||
String url = intent.getStringExtra("url");
|
||||
Uri uri = Uri.parse(url);
|
||||
|
||||
Log.d("DownloadService", "Downloading from url: " + url + "file = " + uri.getLastPathSegment());
|
||||
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setDescription("LÖVE Game Download");
|
||||
request.setTitle(uri.getLastPathSegment());
|
||||
request.setMimeType ("application/x-love-game");
|
||||
|
||||
// in order for this if to run, you must use the android 3.2 to compile your app
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
DownloadRequestSettings_API11 settings = new DownloadRequestSettings_API11();
|
||||
settings.setup (request);
|
||||
}
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, uri.getLastPathSegment());
|
||||
// get download service and enqueue file
|
||||
|
||||
Log.d("DownloadActivity", "creating manager");
|
||||
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
Log.d("DownloadActivity", "enqueuing download");
|
||||
manager.enqueue(request);
|
||||
|
||||
Log.d("DownloadActivity", "download receiver = " + downloadReceiver);
|
||||
IntentFilter intentFilter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
|
||||
registerReceiver(downloadReceiver, intentFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context used to check the device version and DownloadManager information
|
||||
* @return true if the download manager is available
|
||||
*/
|
||||
public static boolean isDownloadManagerAvailable(Context context) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
|
||||
return false;
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
intent.setClassName("com.android.providers.downloads.ui", "com.android.providers.downloads.ui.DownloadList");
|
||||
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
return list.size() > 0;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("DownloadActivity", "downloadReceiver intent called");
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class DownloadRequestSettings_API11 {
|
||||
public static void setup (DownloadManager.Request request) {
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
}
|
||||
}
|
@ -0,0 +1,253 @@
|
||||
package org.love2d.android;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DownloadManager;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.ResultReceiver;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.widget.Toast;
|
||||
import android.view.*;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
public class GameActivity extends SDLActivity {
|
||||
private static DisplayMetrics metrics = new DisplayMetrics();
|
||||
private static String gamePath = "";
|
||||
private static Context context;
|
||||
private static Vibrator vibrator = null;
|
||||
private static boolean immersiveActive = false;
|
||||
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
return new String[] {
|
||||
"gnustl_shared",
|
||||
"mpg123",
|
||||
"openal",
|
||||
"love",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.d("GameActivity", "started");
|
||||
|
||||
context = this.getApplicationContext();
|
||||
|
||||
String permission = "android.permission.VIBRATE";
|
||||
int res = context.checkCallingOrSelfPermission(permission);
|
||||
if (res == PackageManager.PERMISSION_GRANTED) {
|
||||
vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
} else {
|
||||
Log.d("GameActivity", "Vibration disabled: could not get vibration permission.");
|
||||
}
|
||||
|
||||
handleIntent (this.getIntent());
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent (Intent intent) {
|
||||
Log.d("GameActivity", "onNewIntent() with " + intent);
|
||||
handleIntent (intent);
|
||||
resetNative();
|
||||
startNative();
|
||||
};
|
||||
|
||||
protected void handleIntent (Intent intent) {
|
||||
Uri game = intent.getData();
|
||||
if (game != null) {
|
||||
if (game.getScheme().equals ("file")) {
|
||||
Log.d("GameActivity", "Received intent with path: " + game.getPath());
|
||||
|
||||
// If we were given the path of a main.lua then use its
|
||||
// directory. Otherwise use full path.
|
||||
List<String> path_segments = game.getPathSegments();
|
||||
if (path_segments.get(path_segments.size() - 1).equals("main.lua")) {
|
||||
gamePath = game.getPath().substring(0, game.getPath().length() - "main.lua".length());
|
||||
} else {
|
||||
gamePath = game.getPath();
|
||||
}
|
||||
} else {
|
||||
copyGameToCache (game);
|
||||
}
|
||||
|
||||
Log.d("GameActivity", "new gamePath: " + gamePath);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (vibrator != null) {
|
||||
Log.d("GameActivity", "Cancelling vibration");
|
||||
vibrator.cancel();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (vibrator != null) {
|
||||
Log.d("GameActivity", "Cancelling vibration");
|
||||
vibrator.cancel();
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (immersiveActive) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
}
|
||||
|
||||
public void setImmersiveMode (boolean immersive_mode) {
|
||||
if (android.os.Build.VERSION.SDK_INT < 11) {
|
||||
// The API getWindow().getDecorView().setSystemUiVisibility() was
|
||||
// added in Android 11 (a.k.a. Honeycomb, a.k.a. 3.0.x). If we run
|
||||
// on this we do nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
immersiveActive = immersive_mode;
|
||||
|
||||
final Object lock = new Object();
|
||||
final boolean immersive_enabled = immersive_mode;
|
||||
synchronized (lock) {
|
||||
runOnUiThread (new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (lock) {
|
||||
if (immersive_enabled) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
} else {
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
}
|
||||
|
||||
lock.notify();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public boolean getImmersiveMode () {
|
||||
return immersiveActive;
|
||||
}
|
||||
|
||||
public static String getGamePath() {
|
||||
Log.d ("GameActivity", "called getGamePath(), game path = " + gamePath);
|
||||
return gamePath;
|
||||
}
|
||||
|
||||
public static DisplayMetrics getMetrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
public static void vibrate (double seconds) {
|
||||
if (vibrator != null) {
|
||||
vibrator.vibrate((long) (seconds * 1000.));
|
||||
}
|
||||
}
|
||||
|
||||
public static void openURL (String url) {
|
||||
Log.d ("GameActivity", "opening url = " + url);
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(url));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
}
|
||||
|
||||
void copyGameToCache (Uri sourceuri)
|
||||
{
|
||||
String destinationFilename = this.getCacheDir().getPath()+"/downloaded.love";
|
||||
gamePath = destinationFilename;
|
||||
|
||||
BufferedOutputStream bos = null;
|
||||
try {
|
||||
bos = new BufferedOutputStream(new FileOutputStream(destinationFilename, false));
|
||||
} catch (IOException e) {
|
||||
Log.d ("GameActivity", "Could not open destination file:" + e.getMessage());
|
||||
}
|
||||
|
||||
int chunk_read = 0;
|
||||
int bytes_written = 0;
|
||||
|
||||
BufferedInputStream bis = null;
|
||||
if (sourceuri.getScheme().equals("content")) {
|
||||
try {
|
||||
bis = new BufferedInputStream(getContentResolver().openInputStream(sourceuri));
|
||||
} catch (IOException e) {
|
||||
Log.d ("GameActivity", "Could not open game file:" + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
Log.d ("GameActivity", "Unsupported scheme: " + sourceuri.getScheme());
|
||||
}
|
||||
|
||||
if (bis != null) {
|
||||
// actual copying
|
||||
try {
|
||||
byte[] buf = new byte[1024];
|
||||
chunk_read = bis.read(buf);
|
||||
do {
|
||||
bos.write(buf, 0, chunk_read);
|
||||
bytes_written += chunk_read;
|
||||
chunk_read = bis.read(buf);
|
||||
} while(chunk_read != -1);
|
||||
} catch (IOException e) {
|
||||
Log.d ("GameActivity", "Copying failed:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// close streams
|
||||
try {
|
||||
if (bis != null) bis.close();
|
||||
if (bos != null) bos.close();
|
||||
} catch (IOException e) {
|
||||
Log.d ("GameActivity", "Copying failed: " + e.getMessage());
|
||||
}
|
||||
|
||||
Log.d("GameActivity", "Copied " + bytes_written + " bytes");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user