The JmePower Project is about promoting the jMonkeyEngine (JME) game engine.
It contains 3 subprojects:
- JmePowerLibrary: the JmePower startup library for jMonkeyEngine applications
- JmePowerAssets: generate assets included in the library
- JmePowerExamples: sample applications using the library
Complete source code (in Java) is provided under a 3-clause BSD license.
The source code has a BSD 3-Clause license.
The Jamie model has a BSD 3-Clause license.
- Install a Java Development Kit (JDK), if you don't already have one.
- Point the
JAVA_HOME
environment variable to your JDK installation: (In other words, set it to the path of a directory/folder containing a "bin" that contains a Java executable. That path might look something like "C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot" or "/usr/lib/jvm/java-17-openjdk-amd64/" or "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home" .)
- using Bash or Zsh:
export JAVA_HOME="
path to installation"
- using Fish:
set -g JAVA_HOME "
path to installation"
- using Windows Command Prompt:
set JAVA_HOME="
path to installation"
- using PowerShell:
$env:JAVA_HOME = '
path to installation'
- Download and extract the JmePower source code from GitHub:
- using Git:
git clone https://github.com/stephengold/JmePower.git
cd JmePower
git checkout -b latest 1.1.1
- using a web browser:
- browse to the latest release
- follow the "Source code (zip)" link
- save the ZIP file
- extract the contents of the saved ZIP file
cd
to the extracted directory/folder
- Run the Gradle wrapper:
- using Bash or Fish or PowerShell or Zsh:
./gradlew build
- using Windows Command Prompt:
.\gradlew build
After a successful build,
Maven artifacts will be found in JmePowerLibrary/build/libs
.
You can install the artifacts to your local Maven repository:
- using Bash or Fish or PowerShell or Zsh:
./gradlew install
- using Windows Command Prompt:
.\gradlew install
You can restore the project to a pristine state:
- using Bash or Fish or PowerShell or Zsh:
./gradlew clean
- using Windows Command Prompt:
.\gradlew clean
Adding JmePower to an existing jMonkeyEngine project should be a simple 3-step process:
- Add the appropriate libraries to the classpaths.
- Add code to instantiate and attach an
AppState
. - Add code to await completion.
The JmePower library depends on the standard jme3-core library and the Heart library.
For projects built using Maven or Gradle, the build tools should automatically resolve the compile-time dependencies.
Add to the project’s "build.gradle" or "build.gradle.kts" file:
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.stephengold:JmePower:1.1.1")
}
Instantiate a JmeLoadingState
.
The AppState
constructor takes an array of objects
to be preloaded into the application's asset cache.
If there are none, the array can be empty.
Depending on the application's structure, the instance might be
attached explicitly in simpleInitApp()
:
JmeLoadingState loading = new JmeLoadingState(preloadArray);
stateManager.attach(loading);
or it might be passed to the application's constructor:
private MyApplication() {
super(
// other appstates, if desired ...
new JmeLoadingState(preloadArray)
);
}
The appstate takes indicates completion by disabling itself.
A SimpleApplication
might check for completion in simpleUpdate()
:
@Override
public void simpleUpdate(float tpf) {
AppState loading = stateManager.getState(JmeLoadingState.class);
if (loading != null && !loading.isEnabled()) {
getStateManager().detach(loading);
// additional startup, if desired ...
}
}