Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Working on player input handling.

  • Loading branch information...
commit 25d1f14861e630c7691c7e92f2977477506d061d 1 parent 54c5200
@zzorn authored
View
1  src/main/scala/org/jmespike/controls/EntityControl.scala
@@ -14,6 +14,7 @@ import com.jme3.scene.{Node, Spatial}
* If a conf is supplied, will listen to changes to it and call confUpdated during an update after it is changed.
* NOTE: Should only be used on spatials of type Node.
*/
+// TODO: Should this class handle input actions also?
abstract class EntityControl[T <: ControlConf](conf: T) extends AbstractControl {
private var enabledChanged = true // Call onEnabled during first update.
View
11 src/main/scala/org/jmespike/input/SteeringConf.scala
@@ -0,0 +1,11 @@
+package org.jmespike.input
+
+import org.jmespike.controls.ControlConf
+
+/**
+ *
+ */
+
+class SteeringConf extends ControlConf {
+ def createControl(seed: Int) = new SteeringControl()
+}
View
32 src/main/scala/org/jmespike/input/SteeringControl.scala
@@ -0,0 +1,32 @@
+package org.jmespike.input
+
+import org.jmespike.controls.EntityControl
+import com.jme3.input.controls.ActionListener
+import java.lang.String
+import InputNames._
+
+/**
+ * Receives steering information from user input (via an activity)
+ * or through direct setting by AIs (or remote players).
+ */
+// TODO: Separate the sourcing of input from a player, an AI, the network, etc, and the use of that input to control something
+// Current planned path of user input is:
+// Keyboard -> JME Input handling -> game Activity -> player entity -> steering control -> propulsion control -> physics control
+// Instead, make EntityControl support registering listeners, and do
+// Keyboard -> JME Input handling -> input distributor app state -> entity control -> player steering control -> propulsion control -> physics control
+class SteeringControl extends EntityControl(null) with ActionListener {
+
+ // Desired target orientation
+
+ // Desired speed,
+
+
+ def onAction(name: String, isPressed: Boolean, tpf: Float) {
+ name match {
+ case Up =>
+ case Down =>
+ case _ => // Ignore
+ }
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.