forked from aevum/libgdx-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the android backend, fixed some bugs and etc
- Loading branch information
1 parent
a9040c3
commit 323b580
Showing
42 changed files
with
605 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
*~ | ||
include/ | ||
build/ | ||
bin/ | ||
gen/ | ||
libs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/backends/gdx-cpp-backend-android/android_support/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="gen"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
33 changes: 33 additions & 0 deletions
33
src/backends/gdx-cpp-backend-android/android_support/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>ACTIVITY_ENTRY_NAME</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<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> |
15 changes: 15 additions & 0 deletions
15
src/backends/gdx-cpp-backend-android/android_support/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.aevumlab.libgdxcpp" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
<application android:label="@string/app_name" android:icon="@drawable/icon"> | ||
<activity android:name="ACTIVITY_ENTRY_NAME" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
17 changes: 17 additions & 0 deletions
17
src/backends/gdx-cpp-backend-android/android_support/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
79 changes: 79 additions & 0 deletions
79
src/backends/gdx-cpp-backend-android/android_support/build.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="GdxCppAndroidSupport" 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 build.properties file can be created by you and is never touched | ||
by the 'android' tool. This is the place to change some of the | ||
default property values used by the Ant rules. | ||
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'. | ||
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="build.properties" /> | ||
|
||
<!-- The default.properties file is created and updated by the 'android' | ||
tool, as well as ADT. | ||
This file is an integral part of the build system for your | ||
application and should be checked into Version Control Systems. --> | ||
<property file="default.properties" /> | ||
|
||
|
||
<!-- Required pre-setup import --> | ||
<import file="${sdk.dir}/tools/ant/pre_setup.xml" /> | ||
|
||
|
||
<!-- extension targets. Uncomment the ones where you want to do custom work | ||
in between standard targets --> | ||
<!-- | ||
<target name="-pre-build"> | ||
</target> | ||
<target name="-pre-compile"> | ||
</target> | ||
[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}] | ||
<target name="-post-compile"> | ||
</target> | ||
--> | ||
|
||
<!-- Execute the Android Setup task that will setup some properties | ||
specific to the target, and import the build rules files. | ||
The rules file is imported from | ||
<SDK>/tools/ant/ | ||
Depending on the project type it can be either: | ||
- main_rules.xml | ||
- lib_rules.xml | ||
- test_rules.xml | ||
To customize existing targets, there are two options: | ||
- Customize only one target: | ||
- copy/paste the target into this file, *before* the | ||
<setup> task. | ||
- customize it to your needs. | ||
- Customize the whole script. | ||
- copy/paste the content of the rules files (minus the top node) | ||
into this file, *after* the <setup> task | ||
- disable the import of the rules by changing the setup task | ||
below to <setup import="false" />. | ||
- customize to your needs. | ||
--> | ||
<setup /> | ||
|
||
</project> |
12 changes: 12 additions & 0 deletions
12
src/backends/gdx-cpp-backend-android/android_support/default.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 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. | ||
|
||
android.library=true | ||
# Project target. | ||
target=Google Inc.:Google APIs:9 |
10 changes: 10 additions & 0 deletions
10
src/backends/gdx-cpp-backend-android/android_support/local.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must *NOT* be checked in Version Control Systems, | ||
# as it contains information specific to your local configuration. | ||
|
||
# location of the SDK. This is only used by Ant | ||
# For customization when using a Version Control System, please read the | ||
# header note. | ||
sdk.dir=/home/victor/applications/android-sdk-linux_x86 |
36 changes: 36 additions & 0 deletions
36
src/backends/gdx-cpp-backend-android/android_support/proguard.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-optimizationpasses 5 | ||
-dontusemixedcaseclassnames | ||
-dontskipnonpubliclibraryclasses | ||
-dontpreverify | ||
-verbose | ||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* | ||
|
||
-keep public class * extends android.app.Activity | ||
-keep public class * extends android.app.Application | ||
-keep public class * extends android.app.Service | ||
-keep public class * extends android.content.BroadcastReceiver | ||
-keep public class * extends android.content.ContentProvider | ||
-keep public class * extends android.app.backup.BackupAgentHelper | ||
-keep public class * extends android.preference.Preference | ||
-keep public class com.android.vending.licensing.ILicensingService | ||
|
||
-keepclasseswithmembernames class * { | ||
native <methods>; | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
public <init>(android.content.Context, android.util.AttributeSet); | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
public <init>(android.content.Context, android.util.AttributeSet, int); | ||
} | ||
|
||
-keepclassmembers enum * { | ||
public static **[] values(); | ||
public static ** valueOf(java.lang.String); | ||
} | ||
|
||
-keep class * implements android.os.Parcelable { | ||
public static final android.os.Parcelable$Creator *; | ||
} |
Binary file added
BIN
+4.05 KB
src/backends/gdx-cpp-backend-android/android_support/res/drawable-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.68 KB
src/backends/gdx-cpp-backend-android/android_support/res/drawable-ldpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.51 KB
src/backends/gdx-cpp-backend-android/android_support/res/drawable-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
src/backends/gdx-cpp-backend-android/android_support/res/layout/main.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
> | ||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Hello World, ACTIVITY_ENTRY_NAME" | ||
/> | ||
</LinearLayout> | ||
|
4 changes: 4 additions & 0 deletions
4
src/backends/gdx-cpp-backend-android/android_support/res/values/strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">ACTIVITY_ENTRY_NAME</string> | ||
</resources> |
99 changes: 99 additions & 0 deletions
99
...s/gdx-cpp-backend-android/android_support/src/com/aevumlab/gdxcpp/ApplicationManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.aevumlab.gdxcpp; | ||
|
||
import javax.microedition.khronos.egl.EGLConfig; | ||
import javax.microedition.khronos.opengles.GL10; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.opengl.GLSurfaceView; | ||
import android.view.Display; | ||
|
||
public class ApplicationManager { | ||
static native void nativeInitSystem(); | ||
|
||
static native void nativeInitialize(int width, int height); | ||
|
||
static native void nativeCreate(); | ||
|
||
static native void nativeUpdate(); | ||
|
||
static native void nativePause(); | ||
|
||
static native void nativeResume(); | ||
|
||
static native void nativeResize(int widht, int height); | ||
|
||
Activity activity; | ||
|
||
class NativeSurfaceRenderer implements GLSurfaceView.Renderer { | ||
|
||
@Override | ||
public void onDrawFrame(GL10 gl) { | ||
ApplicationManager.nativeUpdate(); | ||
} | ||
|
||
@Override | ||
public void onSurfaceChanged(GL10 gl, int width, int height) { | ||
ApplicationManager.nativeResize(width, height); | ||
ApplicationManager.nativeCreate(); | ||
} | ||
|
||
@Override | ||
public void onSurfaceCreated(GL10 gl, EGLConfig config) { | ||
|
||
Display display = activity.getWindowManager().getDefaultDisplay(); | ||
int width = display.getWidth(); | ||
int height = display.getHeight(); | ||
|
||
ApplicationManager.nativeInitialize(width, height); | ||
} | ||
} | ||
|
||
class NativeSurfaceView extends GLSurfaceView { | ||
|
||
public NativeSurfaceView(Context context) { | ||
super(context); | ||
setFocusable(true); | ||
setFocusableInTouchMode(true); | ||
setRenderer(new NativeSurfaceRenderer()); | ||
} | ||
|
||
// @Override | ||
// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) | ||
// { | ||
// final int width = View.MeasureSpec.getSize(widthMeasureSpec); | ||
// final int height = View.MeasureSpec.getSize(heightMeasureSpec); | ||
// | ||
// setMeasuredDimension( width, height); | ||
// } | ||
} | ||
|
||
public GLSurfaceView createView(Context context) { | ||
return new NativeSurfaceView(context); | ||
} | ||
|
||
public void initializeWithSharedLib(String library) { | ||
System.loadLibrary(library); | ||
nativeInitSystem(); | ||
} | ||
|
||
public void initialize(Activity activity) { | ||
this.activity = activity; | ||
System.loadLibrary("gdx-cpp"); | ||
} | ||
|
||
public void update() { | ||
} | ||
|
||
public void pause() { | ||
nativePause(); | ||
} | ||
|
||
public void resume() { | ||
nativeResume(); | ||
} | ||
|
||
public void unload() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.