Skip to content

Added template resources for iOS (MultiOsEngine) #10

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
"usesJmeVersion" : true,
"artifacts" : [ { "groupId" : "org.jmonkeyengine", "artifactId" : "jme3-android" } ]
},
{
"key": "JME_IOSMOE",
"displayName": "JME iOS using Multi-OS-Engine",
"category" : "JME_PLATFORM",
"descriptionText" : "iOS Multi-OS-Engine Game development",
"usesJmeVersion" : true,
"artifacts" : [ { "groupId" : "org.jmonkeyengine", "artifactId" : "jme3-ios" } ]
},
{
"key": "JME_EFFECTS",
"displayName": "JME Effects",
Expand Down Expand Up @@ -111,4 +119,4 @@
"artifacts" : [ { "groupId" : "com.onemillionworlds", "artifactId" : "tamarin" } ],
"requiredPlatforms": ["JME_VR"]
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ buildscript {

}

allprojects {
repositories {
google()
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Expand All @@ -25,4 +32,4 @@ task buildAllDistributions {
println(" #### Check the individual modules build/distributions folders for distributable zips etc #### ")
}
}
[/IF=WINDOWS|LINUX|MACOS]
[/IF=WINDOWS|LINUX|MACOS]
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.enableJetifier=true
# MOE release
multiOsEngineVersion=1.10.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.multi-os-engine:moe-gradle:$multiOsEngineVersion"
}
}

apply plugin: 'moe'

// Exclude all files from Gradle's test runner
test { exclude '**' }

// Copy all xcframeworks to xcode/native/ios
// They need to be picked up from there for linking in XCode
task copyNatives {
doLast {
file("xcode/native/ios/").mkdirs();
def subDir = "META-INF/robovm/ios/libs/"
configurations.natives.files.each { jar ->
copy {
from zipTree(jar)
include "$subDir/*.xcframework/**"
into("xcode/native/ios/")
eachFile { file ->
file.path = file.path.replaceFirst("^$subDir", '')
}
includeEmptyDirs(false)
}
}

def LD_FLAGS = ""
def outFlags = file("xcode/ios-moe/custom.xcconfig");
outFlags.write LD_FLAGS

def proguard = file("proguard.append.cfg")
}
}

configurations { natives }

ext.jmonkeyengineVersion = '[JME_VERSION]'

dependencies {
implementation project(':game')

implementation "org.jmonkeyengine:jme3-ios:" + jmonkeyengineVersion
natives "org.jmonkeyengine:jme3-ios-native:" + jmonkeyengineVersion
}

// Setup Multi-OS Engine
moe {
xcode {
project 'xcode/ios-moe.xcodeproj'
mainTarget 'ios-moe'
testTarget 'ios-moe-Test'
}
}

moeMainReleaseIphoneosXcodeBuild.dependsOn copyNatives
moeMainDebugIphoneosXcodeBuild.dependsOn copyNatives
moeMainReleaseIphonesimulatorXcodeBuild.dependsOn copyNatives
moeMainDebugIphonesimulatorXcodeBuild.dependsOn copyNatives

if (System.getenv('PLATFORM_NAME') != null) {
moeXcodeInternal.dependsOn copyNatives
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#-dontshrink
#-dontoptimize
#-dontusemixedcaseclassnames
#-dontskipnonpubliclibraryclasses
#-dontskipnonpubliclibraryclassmembers
#-dontpreverify
# Issue : (Index 39424 out of bounds for length 635)
#-keep class com.** { *; }
#-keep enum com.** { *; }

# All jme3
-keep class com.jme3.** {*;}
-keep enum com.jme3.** {*;}
-keep class de.lessvoid.nifty.** {*;}
-keep enum de.lessvoid.nifty.** {*;}

# Previous jme3 related classes
-keep public class com.jme3.system.ios.*{public *;}
-keep public class * extends com.jme3.system.ios.IosHarness{public *;}
-keep public class * extends com.jme3.app.Application{public *;}
-keep public class * extends com.jme3.system.JmeSystemDelegate{public *;}
-keep public class * extends com.jme3.scene.control.*{public *;}
-keep public class * extends com.jme3.scene.Node{public *;}
-keep public class * implements com.jme3.renderer.Renderer{public *;}
-keep public class * implements com.jme3.asset.AssetLoader{public *;}
-keep public class * implements com.jme3.asset.AssetLocator{public *;}
-keep public class * implements de.lessvoid.nifty.screen.ScreenController{public *;}
-keep public class de.lessvoid.nifty.loaderv2.types.** { public *;}
-keep public class de.lessvoid.nifty.controls.** { public *; }
-keep public class de.lessvoid.nifty.input.** { public *; }
-keep public class de.lessvoid.nifty.effects.impl.** { public *;}
-keepclassmembers class com.jme3.audio.plugins.NativeVorbisFile{public *;}
-keep public class * implements javax.xml.parsers.SAXParserFactory{public *;}
-keep public class com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
-keep public class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl
-keep public class sun.nio.fs.MacOSXFileSystemProvider
-keep public class * extends java.nio.charset.Charset { *; }
-keep public class java.util.zip.Deflater { *; }
-keep public class java.io.FileNotFoundException { *; }
-keep public class java.lang.reflect.Proxy { *; }
-keep public class java.lang.reflect.InvocationHandler { *; }
-keep public class java.util.logging.ConsoleHandler
-keep public class java.util.logging.FileHandler
-keep public class java.util.logging.SimpleFormatter
-keep public class java.util.logging.LogManager { *; }
-keep public class org.xmlpull.mxp1.MXParserFactory { *; }
-keep public class mf.org.** { *; }

# Base java
-keep class java.lang.** {*;}
-keep class java.net.** {*;}
-keep class java.nio.Bits {*;}

# Minie
-keep class vhacd4.** {*;}
-keep class vhacd.** {*;}
-keep class jme3utilities.** {*;}

# Keep all native methods, their classes and any classes in their descriptors
-keepclasseswithmembers,includedescriptorclasses class ** {
native <methods>;
long nativeHandle;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package [GAME_PACKAGE];

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.corefoundation.struct.CGRect;
import apple.uikit.UIApplication;
import apple.uikit.UIColor;
import apple.uikit.UIImage;
import apple.uikit.UINavigationController;
import apple.uikit.UIScreen;
import apple.uikit.UIViewController;
import apple.uikit.UIWindow;
import apple.uikit.c.UIKit;
import apple.uikit.enums.UIBarStyle;
import apple.uikit.protocol.UIApplicationDelegate;

@RegisterOnStartup
public class DummyMain extends NSObject implements UIApplicationDelegate
{
public static void main(String[] args) {
UIKit.UIApplicationMain(0, null, null, DummyMain.class.getName());
}

@Selector("alloc")
public static native DummyMain alloc();

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

private UIWindow window;

@Override
public boolean applicationDidFinishLaunchingWithOptions(UIApplication application, NSDictionary launchOptions) {
UIScreen screen = UIScreen.mainScreen();
CGRect bounds = screen.bounds();
window = UIWindow.alloc().initWithFrame(bounds);

UIViewController vc = MoeIosJmeAppHarness.alloc().init();

// Initialization with navigation bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be commented out?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I left it as an example on how to add a top bar. I think most, if not all, people will use fullscreen without any bar, but just in case

/*
UINavigationController navigationController = UINavigationController.alloc().init();
UIColor moeBlue = UIColor.alloc().initWithRedGreenBlueAlpha(0.0, 113/255.f, 197/255.f, 1.0);
navigationController.initWithRootViewController(vc);
window.setRootViewController(navigationController);

navigationController.navigationBar().setBarStyle(UIBarStyle.Black);
navigationController.navigationBar().setBarTintColor(moeBlue);
navigationController.navigationBar().setShadowImage(UIImage.alloc().init());
navigationController.navigationBar().setTranslucent(false);
navigationController.navigationBar().setTintColor(UIColor.whiteColor());
*/

// New initialization, only glwindow
window.setRootViewController(vc);

window.makeKeyAndVisible();

System.out.println("DummyMain applicationDidFinishLaunchingWithOptions");

return true;
}

@Override
public void setWindow(UIWindow value) {
window = value;
}

@Override
public UIWindow window() {
return window;
}
}
Loading