forked from richardTingle/jmeinitializer
-
Notifications
You must be signed in to change notification settings - Fork 1
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
joliver82
wants to merge
2
commits into
jMonkeyEngine:master
Choose a base branch
from
joliver82:ios-moe-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
69 changes: 69 additions & 0 deletions
69
src/main/resources/jmetemplate/[IF=MULTIPLATFORM]/ios-moe[IF=JME_IOSMOE]/build.gradle
This file contains hidden or 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,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 | ||
} | ||
|
64 changes: 64 additions & 0 deletions
64
src/main/resources/jmetemplate/[IF=MULTIPLATFORM]/ios-moe[IF=JME_IOSMOE]/proguard.append.cfg
This file contains hidden or 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,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; | ||
} | ||
|
78 changes: 78 additions & 0 deletions
78
...[IF=MULTIPLATFORM]/ios-moe[IF=JME_IOSMOE]/src/main/java/[GAME_PACKAGE]/ios/DummyMain.java
This file contains hidden or 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,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 | ||
/* | ||
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; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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