Skip to content

Commit

Permalink
Upgrade Scala and SBT, switch Android plugin, remove iOS plugin
Browse files Browse the repository at this point in the history
This big commit updates Scala to 2.11.1 and SBT to 0.13.5. It was possible
because of new Android plugin. This template now uses
https://github.com/pfn/android-sdk-plugin plugin.

Directory layout of project was changed to mirror those of official
gdx-setup.jar, though proguard rules are different - they are
merge of rules from old project, gdx-setup.jar template rules and
official android rules from proguard-android.txt.

Proguard rules might still need some polishing, there are warnings,
but they seem not influence normal working of Libgdx, so they
are ignored for now. If something does not work due to bad proguard
rule, open ticket and it will be fixed in template.

Last, but not least, I disabled iOS code for now, due to few reasons:

  - ajhager#78
  - roboscala/sbt-robovm#10
  - default template from gdx-setup.jar looks different (it has three files)
  - I don't have iOS nor Mac to test/fix this stuff

That's why I decided to remove those files and publish what I already got,
and wait for patches from someone who has iOS or Mac and can test/fix
iOS support in new template.
  • Loading branch information
aginiewicz committed Jul 7, 2014
1 parent 8d96b2d commit 5e8ab9c
Show file tree
Hide file tree
Showing 26 changed files with 202 additions and 209 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ Package the desktop project into single jar:

> assembly

Run the android project on a device:
Create Android package in debug mode:

> android/start
> android:packageDebug

Visit [android-plugin](https://github.com/jberkel/android-plugin) for a more in-depth guide to android configuration and usage.

Run the ios project on a device:

> ios/device

Visit [sbt-robovm](https://github.com/ajhager/sbt-robovm) for a more in-depth guide to ios configuration and usage.
Visit [android-sdk-plugin](https://github.com/pfn/android-sdk-plugin) for a more in-depth guide to android configuration and usage.

## Using with popular IDEs

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.11.3
sbt.version=0.13.5
2 changes: 1 addition & 1 deletion project/project/plugins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import sbt._
object PluginDef extends Build {
lazy val root = Project("plugins", file(".")) dependsOn( g8plugin )
lazy val g8plugin =
ProjectRef(uri("git://github.com/n8han/giter8#0.4.5.1"), "giter8-plugin")
ProjectRef(uri("git://github.com/n8han/giter8#0.6.4"), "giter8-plugin")
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="$package$"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="0.1">
package="$package$"
android:versionCode="1"
android:versionName="0.1">

<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="$api_level$" />
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="$api_level$" />

<application android:icon="@drawable/android:star_big_on"
<application android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:debuggable="true">
android:theme="@style/GdxTheme">
<activity android:name=".Main"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-feature android:glEsVersion="0x00020000"/>

<uses-feature android:glEsVersion="0x00020000" />
</manifest>
File renamed without changes.
62 changes: 62 additions & 0 deletions src/main/g8/android/proguard-project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Keep Android backend
-keep class com.badlogic.gdx.backends.android.** { *; }

-keep public class com.badlogic.gdx.backends.android.AndroidVisibilityListener {
public void createListener(com.badlogic.gdx.backends.android.AndroidApplication);
}

# Port from proguard-android.txt

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontoptimize
-dontpreverify

-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable\$Creator *;
}

-keepclassmembers class **.R\$* {
public static <fields>;
}

-dontwarn android.support.**

# Port from proguard-project.txt of Libgdx template

-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication

-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
<init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
}

# Keep Android backend
#-keep class com.badlogic.gdx.backends.android.** { *; }
#
# Uncomment for Libgdx 1.0.0-SNAPSHOT
#-keep public class com.badlogic.gdx.backends.android.AndroidVisibilityListener {
# public void createListener(com.badlogic.gdx.backends.android.AndroidApplication);
#}

14 changes: 14 additions & 0 deletions src/main/g8/android/project.properties
Original file line number Diff line number Diff line change
@@ -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=../core/proguard-project.txt:proguard-project.txt

# Project target.
target=android-$api_level$
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">$name$</string>
</resources>

</resources>
12 changes: 12 additions & 0 deletions src/main/g8/android/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<resources>

<style name="GdxTheme" parent="android:Theme">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFullscreen">true</item>
</style>

</resources>
8 changes: 0 additions & 8 deletions src/main/g8/android/src/main/proguard.cfg

This file was deleted.

1 change: 0 additions & 1 deletion src/main/g8/android/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Main extends AndroidApplication {
config.useCompass = false
config.useWakelock = true
config.hideStatusBar = true
config.useGL20 = true
initialize(new $name;format="Camel"$, config)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,21 @@
-keep public class scala.collection.generic.CanBuildFrom
-keep public class scala.math.Ordering

# port from Libgdx template

-verbose

-dontwarn com.badlogic.gdx.utils.GdxBuild
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
-dontwarn com.badlogic.gdx.jnigen.BuildTarget*

-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long);
void beginContact(long);
void endContact(long);
void preSolve(long, long);
void postSolve(long, long);
boolean reportFixture(long);
float reportRayFixture(long, float, float, float, float, float);
}

5 changes: 3 additions & 2 deletions src/main/g8/default.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name=My Game
package=my.game.pkg
api_level=19
scala_version=2.10.3
libgdx_version=0.9.9
scala_version=2.11.1
libgdx_version=1.2.0
verbatim=*.png
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Main-Class: $package$.Main

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# Keep LWJGL backend
-keep class com.badlogic.gdx.backends.lwjgl.** { *; }
-keep class com.badlogic.gdx.backends.openal.** { *; }
-keep class org.lwjgl.** { *; }

# keep controller related classes
Expand All @@ -30,8 +29,8 @@
# functions. It includes cases like having multiple definitions for GL 1 and 2.
# same goes for libgdx OpenAL audio, that dynamically uses proper decoder for
# music files.
-dontnote org.lwjgl.**
-dontnote com.badlogic.gdx.backends.openal.OpenALAudio
-dontwarn org.lwjgl.**
-dontnote com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio

# Settings mirrored from sbt-android
-dontoptimize
Expand Down
3 changes: 1 addition & 2 deletions src/main/g8/desktop/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ object Main extends App {
val cfg = new LwjglApplicationConfiguration
cfg.title = "$name$"
cfg.height = 480
cfg.width = 320
cfg.useGL20 = true
cfg.width = 800
cfg.forceExit = false
new LwjglApplication(new $name;format="Camel"$, cfg)
}
49 changes: 0 additions & 49 deletions src/main/g8/ios/src/main/Info.plist

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/g8/ios/src/main/scala/Main.scala

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/g8/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.12.4
sbt.version=0.13.5
Loading

0 comments on commit 5e8ab9c

Please sign in to comment.