forked from Electrostat-Lab/jme3-Simple-Examples
-
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.
Added hellolemur and hellominie modules
- Loading branch information
1 parent
e20f678
commit eaf5263
Showing
57 changed files
with
1,126 additions
and
0 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
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
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 @@ | ||
/build |
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,50 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 31 | ||
|
||
defaultConfig { | ||
applicationId "com.scrappers.hellolemur" | ||
minSdkVersion 21 | ||
targetSdkVersion 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
configurations.all { | ||
exclude group: "com.google.guava", module: "listenablefuture" | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.4.1' | ||
implementation 'com.google.android.material:material:1.6.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
|
||
/*add the JMonkeyEngine Dependencies*/ | ||
implementation "org.jmonkeyengine:jme3-core:3.4.0-SNAPSHOT" | ||
//noinspection GradleDependency | ||
implementation "org.jmonkeyengine:jme3-effects:3.4.0-SNAPSHOT" | ||
//noinspection GradleDependency | ||
implementation "org.jmonkeyengine:jme3-android-native:3.4.0-SNAPSHOT" | ||
|
||
implementation "com.simsilica:lemur:1.14.0" | ||
} |
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
hellolemur/src/androidTest/java/com/scrappers/hellolemur/ExampleInstrumentedTest.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,26 @@ | ||
package com.scrappers.hellolemur; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("com.scrappers.hellolemur", appContext.getPackageName()); | ||
} | ||
} |
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.scrappers.hellolemur"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Jme3SimpleExamples"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
68 changes: 68 additions & 0 deletions
68
hellolemur/src/main/java/com/scrappers/hellolemur/MainActivity.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,68 @@ | ||
package com.scrappers.hellolemur; | ||
|
||
import android.content.pm.ActivityInfo; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Toast; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.jme3.app.LegacyApplication; | ||
import com.jme3.system.AppSettings; | ||
import com.jme3.view.surfaceview.JmeSurfaceView; | ||
import com.jme3.view.surfaceview.OnExceptionThrown; | ||
import com.jme3.view.surfaceview.OnRendererCompleted; | ||
|
||
public final class MainActivity extends AppCompatActivity implements OnRendererCompleted, OnExceptionThrown { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); | ||
/*define the android view with it's id from xml*/ | ||
final JmeSurfaceView jmeSurfaceView = findViewById(R.id.jmeSurfaceView); | ||
jmeSurfaceView.setDestructionPolicy(JmeSurfaceView.DestructionPolicy.KEEP_WHEN_FINISH); | ||
/*set the jme game*/ | ||
jmeSurfaceView.setLegacyApplication(new MyGame()); | ||
jmeSurfaceView.setOnExceptionThrown(this); | ||
jmeSurfaceView.setOnRendererCompleted(this); | ||
/*start the game*/ | ||
jmeSurfaceView.startRenderer(500); | ||
} | ||
|
||
/** | ||
* Fired when exception/error/(concretes of #{@link Throwable} class) is thrown. | ||
* | ||
* @param e the thrown error or exception | ||
*/ | ||
@Override | ||
public void onExceptionThrown(Throwable e) { | ||
Toast.makeText(MainActivity.this, "User's Delay Finished w/ exception : " + e.getMessage(), Toast.LENGTH_SHORT).show(); | ||
} | ||
/** | ||
* Fired when the user delay in ms is up #{@link JmeSurfaceView#startRenderer(int)}. | ||
* | ||
* @param application the current jme game instance | ||
* @param appSettings the current game settings | ||
*/ | ||
@Override | ||
public void onRenderCompletion(LegacyApplication application, AppSettings appSettings) { | ||
Toast.makeText(MainActivity.this, "User's Delay Finished w/o errors !" + application.getContext() + " " + appSettings.getFrameRate(), Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
/** | ||
* Fired when the screen has/hasNo touch/mouse focus. | ||
* | ||
* @param hasFocus specify whether the current screen has focus or not | ||
*/ | ||
@Override | ||
public void onWindowFocusChanged(boolean hasFocus) { | ||
/*get the view from the current activity*/ | ||
final View decorView = MainActivity.this.getWindow().getDecorView(); | ||
/*hide navigation bar, apply fullscreen, hide status bar, immersive sticky to disable the system bars(nav and status) from showing up when user wipes the screen*/ | ||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | | ||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | | ||
View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
hellolemur/src/main/java/com/scrappers/hellolemur/MyGame.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,72 @@ | ||
package com.scrappers.hellolemur; | ||
|
||
import com.jme3.app.SimpleApplication; | ||
import com.jme3.asset.AssetKey; | ||
import com.jme3.material.Material; | ||
import com.jme3.math.ColorRGBA; | ||
import com.jme3.scene.Geometry; | ||
import com.jme3.scene.shape.Sphere; | ||
import com.simsilica.lemur.Button; | ||
import com.simsilica.lemur.Container; | ||
import com.simsilica.lemur.GuiGlobals; | ||
import com.simsilica.lemur.Insets3f; | ||
import com.simsilica.lemur.Label; | ||
import com.simsilica.lemur.component.QuadBackgroundComponent; | ||
import com.simsilica.lemur.component.TbtQuadBackgroundComponent; | ||
import com.simsilica.lemur.style.Attributes; | ||
import com.simsilica.lemur.style.Styles; | ||
|
||
/** | ||
* Shows a lemur example on android. | ||
* | ||
* @author pavl_g | ||
*/ | ||
public final class MyGame extends SimpleApplication { | ||
|
||
@Override | ||
public void simpleInitApp() { | ||
flyCam.setEnabled(false); | ||
final Sphere mySphere = new Sphere(10, 50, 50); | ||
final Geometry geometry = new Geometry("ball", mySphere); | ||
geometry.setLocalScale(0.05f); | ||
final Material material = new Material(assetManager.loadAsset(new AssetKey<>("Common/MatDefs/Misc/Unshaded.j3md"))); | ||
material.setColor("Color", ColorRGBA.randomColor().mult(2f)); | ||
geometry.setMaterial(material); | ||
rootNode.attachChild(geometry); | ||
|
||
GuiGlobals.initialize(this); | ||
|
||
// Create a simple container for our elements | ||
final Container myWindow = new Container(); | ||
// Put it somewhere that we will see it. | ||
// Note: Lemur GUI elements grow down from the upper left corner. | ||
myWindow.setLocalTranslation(300, 300, 0); | ||
myWindow.setLocalScale(5,5,5); | ||
|
||
guiNode.attachChild(myWindow); | ||
|
||
// Add some elements | ||
myWindow.addChild(new Label("Hello, World.")); | ||
|
||
final Button clickMe = myWindow.addChild(new Button("Click Me")); | ||
clickMe.addClickCommands(source -> ((Label)myWindow.getChild(0)).setText("Hey")); | ||
|
||
final Styles styles = GuiGlobals.getInstance().getStyles(); | ||
final QuadBackgroundComponent bg = new QuadBackgroundComponent(ColorRGBA.randomColor()); | ||
|
||
final float guiScale = 10.0f; | ||
final TbtQuadBackgroundComponent gradient = TbtQuadBackgroundComponent.create( | ||
"/com/simsilica/lemur/icons/bordered-gradient.png", | ||
// "Textures/Gui/radial-gradient.png", | ||
1, 1, 1, 126, 126, | ||
1f,false); | ||
final Attributes attrs = styles.getSelector("button", "glass"); | ||
// button | ||
attrs.set("color", new ColorRGBA(0.8f, 0.9f, 1.0f, 0.85f)); | ||
attrs.set("background", gradient.clone()); | ||
((TbtQuadBackgroundComponent)attrs.get("background")).setColor(new ColorRGBA(0.0f, 0.75f, 0.75f, 0.5f)); | ||
attrs.set("insets", new Insets3f(2 * guiScale,2 * guiScale,2 * guiScale,2 * guiScale)); | ||
|
||
myWindow.setBackground(bg); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
hellolemur/src/main/res/drawable-v24/ic_launcher_foreground.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,30 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="108dp" | ||
android:height="108dp" | ||
android:viewportWidth="108" | ||
android:viewportHeight="108"> | ||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> | ||
<aapt:attr name="android:fillColor"> | ||
<gradient | ||
android:endX="85.84757" | ||
android:endY="92.4963" | ||
android:startX="42.9492" | ||
android:startY="49.59793" | ||
android:type="linear"> | ||
<item | ||
android:color="#44000000" | ||
android:offset="0.0" /> | ||
<item | ||
android:color="#00000000" | ||
android:offset="1.0" /> | ||
</gradient> | ||
</aapt:attr> | ||
</path> | ||
<path | ||
android:fillColor="#FFFFFF" | ||
android:fillType="nonZero" | ||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" | ||
android:strokeWidth="1" | ||
android:strokeColor="#00000000" /> | ||
</vector> |
Oops, something went wrong.