Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated more samples (ResizableMKCircleOverlay, SpeakHere, LibGDX, SimpleChart) #4

Draft
wants to merge 10 commits into
base: moe-svm
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions LibGDXMissileCommand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ Environment setup for LibGDX
In case of an error during building libGDX, try to update the JDK.

- Install Ant and Maven
- Install Multi-OS Engne version 1.0.648 or later
- Clone libGDX master branch from github repository:
``` sh
git clone https://github.com/libgdx/libgdx.git
```
- Build libGDX libraries using the following commands:
``` sh
ant -f fetch.xml
mvn install
```
- Clone moe-java-samples repo and create "moe-java-samples/LibGDXMissileCommand/ios/build/xcode/LibGDXMissileCommand.xcodeproj" folder:
``` sh
mkdir -p LibGDXMissileCommand/ios/build/xcode/LibGDXMissileCommand.xcodeproj
```
- Import LibGDXMissileCommand sample in Android Studio (as a gradle project), create "Multi-OS Engine iOS Application" build configuration and build the project.
- Install Multi-OS Engne version 2.0.0 or later
- Clone moe-java-samples repo:
- Import LibGDXMissileCommand sample in Android Studio (as a gradle project), create "Multi-OS Engine iOS Application" build configuration and build the project. Or open the project in xcode and run the project.
6 changes: 4 additions & 2 deletions LibGDXMissileCommand/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ buildscript {
version = '1.0'
ext {
appName = "my-gdx-game"
gdxVersion = '1.9.11'
gdxVersion = '1.10.1-SNAPSHOT'
roboVMVersion = '2.3.12'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
gdxControllersVersion = '2.1.0'
}
repositories {
mavenLocal()
mavenCentral()
google()
}
Expand All @@ -29,7 +30,7 @@ allprojects {
version = '1.0'
ext {
appName = "my-gdx-game"
gdxVersion = '1.9.11'
gdxVersion = '1.10.1-SNAPSHOT'
roboVMVersion = '2.3.12'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
Expand All @@ -42,6 +43,7 @@ allprojects {
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
Expand Down
10 changes: 6 additions & 4 deletions LibGDXMissileCommand/ios/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
buildscript {
repositories {
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
Expand All @@ -21,7 +20,7 @@ task copyNatives {
def LD_FLAGS = "LIBGDX_NATIVES = "
configurations.natives.files.each { jar ->
def outputDir = null
if (jar.name.endsWith("natives-ios.jar")) outputDir = file("xcode/native/ios")
if (jar.name.matches(".*natives-ios.*")) outputDir = file("xcode/native/ios")
if (outputDir != null) {
FileCollection fileCollection = zipTree(jar)
for (File libFile : fileCollection) {
Expand Down Expand Up @@ -52,12 +51,15 @@ dependencies {

compile project(":common")

compile "com.badlogicgames.gdx:gdx-backend-moe:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile "io.github.berstanio:gdx-backend-moe-metalangle:$gdxVersion"
natives "io.github.berstanio:gdx-platform:$gdxVersion:natives-ios-metalangle"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
}

moe {
nativeImage {
options = ["--features=com.badlogic.gdx.backends.svm.ConfigCollectionFeatureBase"]
}
xcode {
project 'xcode/LibGDXMissileCommand.xcodeproj'
mainTarget 'LibGDXMissileCommand'
Expand Down
29 changes: 0 additions & 29 deletions LibGDXMissileCommand/ios/jni-config.json

This file was deleted.

29 changes: 0 additions & 29 deletions LibGDXMissileCommand/ios/reflection-config.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.moe.libgdxmissilecommand.common.MissileCommand;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.RegisterOnStartup;
import org.moe.natj.objc.ann.ObjCClassName;
import org.moe.natj.objc.ann.Selector;

import java.lang.reflect.InvocationTargetException;
Expand All @@ -48,7 +49,7 @@
import apple.uikit.protocol.UIApplicationDelegate;

@RegisterOnStartup
public class Main extends NSObject implements UIApplicationDelegate {
public class Main extends IOSApplication.Delegate {

public static void main(String[] args) {
UIKit.UIApplicationMain(0, null, null, Main.class.getName());
Expand All @@ -57,72 +58,13 @@ public static void main(String[] args) {
@Selector("alloc")
public static native Main alloc();

protected Main(Pointer peer) {
super(peer);
}

private MyIOSApplication app;

@Override
public boolean applicationDidFinishLaunchingWithOptions(UIApplication application, NSDictionary launchOptions) {
protected IOSApplication createApplication() {
IOSApplicationConfiguration configuration = new IOSApplicationConfiguration();
app = new MyIOSApplication(new MissileCommand(), configuration);
app.setApplicationLogger(new MyLogger());
try {
Method method = IOSApplication.class.getDeclaredMethod("didFinishLaunching", UIApplication.class, NSDictionary.class);
method.setAccessible(true);
method.invoke(app, application, launchOptions);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return true;
}
@Override
public void applicationDidBecomeActive (UIApplication application) {
try {
Method method = IOSApplication.class.getDeclaredMethod("didBecomeActive", UIApplication.class);
method.setAccessible(true);
method.invoke(app, application);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}

@Override
public void applicationWillEnterForeground (UIApplication application) {
try {
Method method = IOSApplication.class.getDeclaredMethod("willEnterForeground", UIApplication.class);
method.setAccessible(true);
method.invoke(app, application);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return new IOSApplication(new MissileCommand(), configuration);
}

@Override
public void applicationWillResignActive (UIApplication application) {
try {
Method method = IOSApplication.class.getDeclaredMethod("willResignActive", UIApplication.class);
method.setAccessible(true);
method.invoke(app, application);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}

@Override
public void applicationWillTerminate (UIApplication application) {
try {
Method method = IOSApplication.class.getDeclaredMethod("willTerminate", UIApplication.class);
method.setAccessible(true);
method.invoke(app, application);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}

@Override
public UIWindow window () {
return app.getUIWindow();
protected Main(Pointer peer) {
super(peer);
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
LIBGDX_NATIVES = -force_load ${SRCROOT}/native/ios/libObjectAL.a -force_load ${SRCROOT}/native/ios/libgdx.a -force_load ${SRCROOT}/native/ios/libgdx-box2d.a
LIBGDX_NATIVES = -force_load ${SRCROOT}/native/ios/libMetalANGLE_static.a -force_load ${SRCROOT}/native/ios/libObjectAL.a -force_load ${SRCROOT}/native/ios/libgdx.a -force_load ${SRCROOT}/native/ios/libgdx-box2d.a
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ The following samples are available for the Multi-OS Engine:
| **Calculator** | OK | A cross platform calculator. Demonstrates simple techniques: work with buttons, performing actions. |
| **CurrencyConverter** | OK | Demonstrates how to open an URL and retrieve the content of that URL just using built-in Java* classes. |
| **FastJNI** | OK | Demonstrates the usage of Android's FastJNI. |
| **HelloMaven** | OK | Demonstrates how to use Multi-OS Engine in Maven environment. |
| **InAppPurchase** | PARTIAL | Demonstrates how to make purchases in your applications. <br />**Notes:** Android module does not compile, iOS works. |
| **HelloMaven** | OUTDATED | Demonstrates how to use Multi-OS Engine in Maven environment. <br />**Notes:** The Maven plugin seems to not be supported any more. |
| **InAppPurchase** | NOT TESTED | Demonstrates how to make purchases in your applications. <br />**Notes:** Android module does not compile, iOS works. |
| **LibGDXMissileCommand** | OK | Shows how to implement libGDX game. |
| **LocalizedString** | OK | Shows how to use iOS's localization APIs. |
| **MOEBenchmark** | PARTIAL | Run different Benchmarks. <br />**Notes:** Some doesn't seem work. |
| **MuseumMap** | OK | Sample is based on SimpleMap sample. This application demonstrates how to work with SQL DB. <br />**Notes:** Requires Google Maps API Key |
| **OpenGLBox** | OK | Demonstrates working with OpenGL and shaders. |
| **Planets** | OK | Demonstrates working with UI Kit graphics. |
| **ResizableMKCircleOverlay** | OK | Demonstrates working with Map Kit. |
| **RssReader** | OK | Demonstrates use of HTTP and HTTPS using Java* API |
| **SimpleChart** | OK | A simple application displaying a chart using the Charts pod |
| **SimpleChart** | FAIL | A simple application displaying a chart using the Charts pod.<br />**Notes:** There seems to be some misconfiguration with the pods. |
| **SpeakHere** | OK | Demonstate how to record and play audio. |
| **Taxi** | FAIL | A template for taxi app that allows to select an address on Google Map <br />**Notes:** Multiple issues, needs update. |
| **TheElements** | OK | Demonstrates reading content from XML file. Works with UITableView, adding cells, using scrolling. Example of Master-Detail view, loading images from assets, reacting to taps in views, flipping view content from front to back |
| **TicTacToe** | OK | Demonstrates a simple game creation technique without sprites. Using buttons and performing actions. |
8 changes: 7 additions & 1 deletion ResizableMKCircleOverlay/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ buildscript {
repositories {
jcenter()
mavenLocal()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
// Multi-OS Engine plugin
classpath group: 'org.multi-os-engine', name: 'moe-gradle', version: '1.4.+'
classpath group: 'org.multi-os-engine', name: 'moe-gradle', version: '2.0.0-SNAPSHOT'
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 1, 'seconds'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
8 changes: 4 additions & 4 deletions ResizableMKCircleOverlay/src/main/java/org/moe/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

package org.moe;

import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.RegisterOnStartup;
import org.moe.natj.objc.ann.Selector;

import apple.NSObject;
import apple.foundation.NSDictionary;
import apple.uikit.UIApplication;
import apple.uikit.UIWindow;
import apple.uikit.c.UIKit;
import apple.uikit.protocol.UIApplicationDelegate;

import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.RegisterOnStartup;
import org.moe.natj.objc.ann.Selector;

@RegisterOnStartup
public class Main extends NSObject implements UIApplicationDelegate {

Expand Down
Loading