Selaa lähdekoodia

coderay test.

mitm 5 vuotta sitten
vanhempi
commit
525b612aba
2 muutettua tiedostoa jossa 80 lisäystä ja 2 poistoa
  1. 1 0
      lib/emoji-inline-macro/twemoji-awesome.css
  2. 79 2
      src/docs/asciidoc/wiki/emoji.adoc

+ 1 - 0
lib/emoji-inline-macro/twemoji-awesome.css

@@ -1,4 +1,5 @@
 @import url(asciidoctor.css);
+@import url(coderay-asciidoctor.css);
 .twa{display:inline-block;height:1em;width:1em;margin:0 .05em 0 .1em;vertical-align:-.1em;background-repeat:no-repeat;background-position:center center;background-size:1em 1em}
 .twa-lg{height:1.33em;width:1.33em;margin:0 .0665em 0 .133em;vertical-align:-.133em;background-size:1.33em 1.33em}
 .twa-2x{height:2em;width:2em;margin:0 .1em 0 .2em;vertical-align:-.2em;background-size:2em 2em}

+ 79 - 2
src/docs/asciidoc/wiki/emoji.adoc

@@ -21,6 +21,83 @@ emoji:heart[2x] // the "[2x]" is a size modifier
 emoji:rage[]
 ```
 
+[source,java]
+----
+
+package jme3test.helloworld;
+
+import com.jme3.animation.AnimChannel;
+import com.jme3.animation.AnimControl;
+import com.jme3.animation.AnimEventListener;
+import com.jme3.animation.LoopMode;
+import com.jme3.app.SimpleApplication;
+import com.jme3.input.KeyInput;
+import com.jme3.input.controls.ActionListener;
+import com.jme3.input.controls.KeyTrigger;
+import com.jme3.light.DirectionalLight;
+import com.jme3.math.ColorRGBA;
+import com.jme3.math.Vector3f;
+import com.jme3.scene.Node;
+
+/** Sample 7 - how to load an OgreXML model and play an animation,
+ * using channels, a controller, and an AnimEventListener. */
+public class HelloAnimation extends SimpleApplication
+  implements AnimEventListener {
+  private AnimChannel channel;
+  private AnimControl control;
+  Node player;
+  public static void main(String[] args) {
+    HelloAnimation app = new HelloAnimation();
+    app.start();
+  }
+
+  @Override
+  public void simpleInitApp() {
+    viewPort.setBackgroundColor(ColorRGBA.LightGray);
+    initKeys();
+    DirectionalLight dl = new DirectionalLight();
+    dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());
+    rootNode.addLight(dl);
+    player = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
+    player.setLocalScale(0.5f);
+    rootNode.attachChild(player);
+    control = player.getControl(AnimControl.class);
+    control.addListener(this);
+    channel = control.createChannel();
+    channel.setAnim("stand");
+  }
+
+  public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
+    if (animName.equals("Walk")) {
+      channel.setAnim("stand", 0.50f);
+      channel.setLoopMode(LoopMode.DontLoop);
+      channel.setSpeed(1f);
+    }
+  }
+
+  public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
+    // unused
+  }
+
+  /** Custom Keybinding: Map named actions to inputs. */
+  private void initKeys() {
+    inputManager.addMapping("Walk", new KeyTrigger(KeyInput.KEY_SPACE));
+    inputManager.addListener(actionListener, "Walk");
+  }
+  private ActionListener actionListener = new ActionListener() {
+    public void onAction(String name, boolean keyPressed, float tpf) {
+      if (name.equals("Walk") && !keyPressed) {
+        if (!channel.getAnimationName().equals("Walk")) {
+          channel.setAnim("Walk", 0.50f);
+          channel.setLoopMode(LoopMode.Loop);
+        }
+      }
+    }
+  };
+}
+
+----
+
 [NOTE]
 ====
 You can change the icon size with the size modifier `[2x]`.
@@ -137,8 +214,8 @@ a| emoji:anger[] [.small]`+emoji:anger[]+`
 a| emoji:exclamation[] [.small]`+emoji:exclamation[]+`
 
 a| emoji:question[] [.small]`+emoji:question[]+`
-a| grey-exclamation[] [.small]`+emoji:grey-exclamation[]+`
-a| grey-question[] [.small]`+emoji:grey-question[]+`
+a| emoji:grey-exclamation[] [.small]`+emoji:grey-exclamation[]+`
+a| emoji:grey-question[] [.small]`+emoji:grey-question[]+`
 
 a| emoji:zzz[] [.small]`+emoji:zzz[]+`
 a| emoji:dash[] [.small]`+emoji:dash[]+`