Package org.xjge.core

Class Puppet

java.lang.Object
org.xjge.core.Puppet

public final class Puppet
extends java.lang.Object
Component object that enables implementing objects to make use of input actions captured from an input device by coupling interactive components to some meaningful action.

Any object that can be controlled by a player should utilize a puppet object.

Since:
2.0.0
See Also:
Input.setDevicePuppet(int, Puppet), Input.bindPreviousPuppet(int)
  • Field Summary

    Fields
    Modifier and Type Field Description
    java.util.HashMap<Control,​Command> commands
    A collection of command objects the puppet will use.
    java.lang.Object object  
  • Constructor Summary

    Constructors
    Constructor Description
    Puppet​(java.lang.Object object)
    Creates a new puppet object.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • object

      public final java.lang.Object object
    • commands

      public final java.util.HashMap<Control,​Command> commands
      A collection of command objects the puppet will use. Command definitions should exhibit the following structure:
       puppet.commands.put(CROSS,    myCommand1());
       puppet.commands.put(TRIANGLE, myCommand2());
       puppet.commands.put(SQUARE,   myCommand3());
       
  • Constructor Details

    • Puppet

      public Puppet​(java.lang.Object object)
      Creates a new puppet object. It is expected that implementing objects will populate the puppets commands collection inside of its constructor following the puppet objects initialization.
      Parameters:
      object - the implementing object to be controlled with this puppet