Parcourir la source

Updated content to jme3.2

mitm il y a 7 ans
Parent
commit
4611754ce3
1 fichiers modifiés avec 117 ajouts et 34 suppressions
  1. 117 34
      src/docs/asciidoc/jme3/simpleapplication_from_the_commandline.adoc

+ 117 - 34
src/docs/asciidoc/jme3/simpleapplication_from_the_commandline.adoc

@@ -1,4 +1,4 @@
-= Starting a JME3 application from the Commandline
+= Starting a JME3 application from the command-line
 :author:
 :revnumber:
 :revdate: 2016/03/17 20:48
@@ -9,7 +9,116 @@
 ifdef::env-github,env-browser[:outfilesuffix: .adoc]
 
 
-Although we recommend the jMonkeyEngine <<sdk#,SDK>> for developing JME3 games, you can use any IDE (integrated development environment) such as <<jme3/setting_up_netbeans_and_jme3#,NetBeans>> or <<jme3/setting_up_jme3_in_eclipse#,Eclipse>>, and even work freely from the commandline. Here is a generic IDE-independent "`getting started`" tutorial.
+Although we recommend the jMonkeyEngine <<sdk#,SDK>> for developing JME3 games, you can use any IDE (integrated development environment) such as <<jme3/setting_up_netbeans_and_jme3#,NetBeans>> or <<jme3/setting_up_jme3_in_eclipse#,Eclipse>>, and even work freely from the command-line. Here is a generic IDE-independent "`getting started`" tutorial.
+
+
+== Installing the JME3 Framework
+
+There are many ways to install the JME framework from the command-line, but for this tutorial we will narrow it down to two, the easy way and the hard way.
+
+== Installing with Git (easy way)
+
+You can build JME3 from the sources. (Recommended for JME3 developers.) This example expects link:https://help.github.com/articles/set-up-git/[Git] to be installed on your system.
+
+[source]
+----
+mkdir jme3
+cd jme3
+
+// if you have a rsa key configured
+git clone [email protected]:jMonkeyEngine/jmonkeyengine.git
+// or
+// if you don't, but you'll be asked for credential after the next command
+git clone https://github.com/jMonkeyEngine/jmonkeyengine.git
+//can take a while
+
+// build the engine and install it in your local maven repo.
+./gradlew install
+
+----
+
+TIP: What is an link:https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/[RSA key]?
+
+The install command will install the built jars into your local maven repositories org.jmonkeyengine folder, which on Linux is ~/.m2, and on Windows might be in AppData, or in your home directory.
+
+To use the engine in a game project, you can use link:https://hub.jmonkeyengine.org/t/bootmonkey-bootstrap-your-jme-project/37141[bootmonkey] or clone a template project from GitHub.
+
+To use the template, first create a folder for your project:
+
+[source]
+----
+cd ..
+mkdir HelloJME3
+cd HelloJME3
+----
+
+Next, clone one of these templates:
+
+*  link:https://github.com/Simsilica/Examples/tree/master/simple-jme[Simsilica/Examples]
+*  link:https://github.com/Nehon/base-jme[Nehon/base-jme]
+
+After cloning, open the `build.gradle` file and uncomment the local maven repository, change the version variable, and uncomment any dependencies you will need:
+
+[source]
+----
+repositories {
+    //This is where jme3 dependencies are stored.
+    jcenter()
+
+    //Uncomment this if you install local dependencies.
+    mavenLocal()
+
+    //Uncomment this if you use external dependencies
+    //mavenCentral()
+
+    //Uncomment this if you use jme3-niftygui
+    //maven{url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'}
+
+}
+
+ext.jmeVersion = "[3.2,)"
+
+...
+
+dependencies {
+
+    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
+    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
+    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
+
+    //Those are jme3 additional library uncomment the ones you need
+    //compile "org.jmonkeyengine:jme3-android-native:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-android:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-bullet-native-android:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-blender:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-bullet-native:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-bullet:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-jogl:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-networking:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
+    //compile "org.jmonkeyengine:jme3-terrain:$jmeVersion"
+
+    //You need to uncomment nifty repository in the repositories section if you use this dependency
+    //compile "org.jmonkeyengine:jme3-niftygui:$jmeVersion"
+
+    runtime project(':assets')
+}
+...
+
+----
+
+For a detailed description of the separate jar files see <<jme3/jme3_source_structure#structure_of_jmonkeyengine3_jars,this list>>.
+
+Thats it, you're done. After the clone you will have a project that contains a source package with a default blue cube JME3 app and a subproject that has the proper asset directory structure for your assets.
+
+Build and run your project and you should see a blue cube.
+
+
+== Manual Download (hard way)
+
 
 This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries.
 
@@ -29,9 +138,6 @@ HelloJME3/src
 ...
 ----
 
-
-== Installing the JME3 Framework
-
 To install the development version of jme3, download the latest  link:https://github.com/jMonkeyEngine/jmonkeyengine/releases[stable release], unzip the folder into a directory named `jme3`. The filenames here are just an example, but they will always be something like `jME3.x-stable`.
 
 [source]
@@ -40,33 +146,21 @@ To install the development version of jme3, download the latest  link:https://gi
 mkdir jme3
 cd jme3
 unzip jME3.2-stable.zip
-
-----
-
-Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.)
-
-[source]
-----
-svn checkout https://jmonkeyengine.googlecode.com/svn/branches/3.0final/engine jme3
-cd jme3
-ant run
 cd ..
 ----
 
-If you see a Test Chooser application open now, the build was successful.
 
-TIP: Use just ant instead of ant run to build the libraries without running the demos.
 
 == Sample Project Directory Structure
 
-First we set up the directory and source package structure for your game project. Note that the game project directory `HelloJME3` is on the same level as your `jme3` checkout. In this example, we create a Java package that we call `hello` in the source directory.
+First we set up the directory and source package structure for your game project. Note that the game project directory `HelloJME3` is on the same level as your `jme3` folder. In this example, we create a Java package that we call `mygame` in the source directory.
 
 [source]
 ----
 
 mkdir HelloJME3
 mkdir HelloJME3/src
-mkdir HelloJME3/src/hello
+mkdir HelloJME3/src/mygame
 
 ----
 
@@ -84,26 +178,15 @@ cp jme3/lib/*.* HelloJME3/lib
 
 ----
 
-If you have built JME3 from the sources, then the copy paths are different:
-
-[source]
-----
-
-mkdir HelloJME3/build
-mkdir HelloJME3/lib
-cp jme3/dist/*.* HelloJME3/lib
-
-----
-
 
 === Sample Code
 
-To test your setup, create the file `HelloJME3/src/hello/HelloJME3.java` with any text editor, paste the following sample code, and save.
+To test your setup, create the file `HelloJME3/src/mygame/HelloJME3.java` with any text editor, paste the following sample code, and save.
 
 [source,java]
 ----
 
-package hello;
+package mygame;
 
 import com.jme3.app.SimpleApplication;
 import com.jme3.material.Material;
@@ -141,7 +224,7 @@ We build the sample application into the build directory…
 ----
 
 cd HelloJME3
-javac -d build -cp "lib/eventbus-1.4.jar:lib/j-ogg-oggd.jar:lib/j-ogg-vorbisd.jar:lib/jME3-lwjgl-natives.jar:lib/jbullet.jar:lib/jinput.jar:lib/lwjgl.jar:lib/stack-alloc.jar:lib/vecmath.jar:lib/xmlpull-xpp3-1.1.4c.jar:lib/jME3-blender.jar:lib/jME3-core.jar:lib/jME3-desktop.jar:lib/jME3-jogg.jar:lib/jME3-plugins.jar:lib/jME3-terrain.jar:lib/jME3-testdata.jar:lib/jME3-niftygui.jar:lib/nifty-default-controls.jar:lib/nifty-examples.jar:lib/nifty-style-black.jar:lib/nifty.jar:." src/hello/HelloJME3.java
+javac -d build -cp "lib/eventbus.jar:lib/j-ogg-all.jar:lib/jme3-lwjgl.jar:lib/jme3-bullet.jar:lib/jinput.jar:lib/lwjgl.jar:lib/stack-alloc.jar:lib/vecmath.jar:lib/xpp3.jar:lib/jme3-blender.jar:lib/jme3-core.jar:lib/jme3-desktop.jar:lib/jme3-jogg.jar:lib/jme3-plugins.jar:lib/jme3-terrain.jar:lib/jme3-testdata.jar:lib/jme3-niftygui.jar:lib/nifty-default-controls.jar:lib/nifty-examples.jar:lib/nifty-style-black.jar:lib/nifty.jar:." src/mygame/HelloJME3.java
 
 ----
 
@@ -151,7 +234,7 @@ javac -d build -cp "lib/eventbus-1.4.jar:lib/j-ogg-oggd.jar:lib/j-ogg-vorbisd.ja
 ----
 
 cd build
-java -cp "../lib/eventbus-1.4.jar:../lib/j-ogg-oggd.jar:../lib/j-ogg-vorbisd.jar:../lib/jME3-lwjgl-natives.jar:../lib/jbullet.jar:../lib/jinput.jar:../lib/lwjgl.jar:../lib/stack-alloc.jar:../lib/vecmath.jar:../lib/xmlpull-xpp3-1.1.4c.jar:../lib/jME3-blender.jar:../lib/jME3-core.jar:../lib/jME3-desktop.jar:../lib/jME3-jogg.jar:../lib/jME3-plugins.jar:../lib/jME3-terrain.jar:../lib/jME3-testdata.jar:../lib/jME3-niftygui.jar:../lib/nifty-default-controls.jar:../lib/nifty-examples.jar:../lib/nifty-style-black.jar:../lib/nifty.jar:." hello/HelloJME3
+java -cp "../lib/eventbus.jar:../lib/j-ogg-all.jar:../lib/jme3-lwjgl.jar:../lib/jme3-bullet.jar:../lib/jinput.jar:../lib/lwjgl.jar:../lib/stack-alloc.jar:../lib/vecmath.jar:../lib/xpp3.jar:../lib/jme3-blender.jar:../lib/jme3-core.jar:../lib/jme3-desktop.jar:../lib/jme3-jogg.jar:../lib/jme3-plugins.jar:../lib/jme3-terrain.jar:../lib/jme3-testdata.jar:../lib/jme3-niftygui.jar:../lib/nifty-default-controls.jar:../lib/nifty-examples.jar:../lib/nifty-style-black.jar:../lib/nifty.jar:." mygame/HelloJME3
 ----
 
 NOTE: If you use Windows, the classpath separator is kbd:[\ ]  instead of kbd:[/].