com.threerings.tudey.data
Class InputFrame

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.tudey.data.InputFrame
All Implemented Interfaces:
Streamable, Copyable, Cloneable

public class InputFrame
extends DeepObject
implements Streamable

Represents a single frame of user input.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected  float _direction
          The direction of movement requested by the user.
protected  int _flags
          The user's input flags.
protected  float _rotation
          The rotation requested by the user.
protected  int _timestamp
          The timestamp of the input frame.
protected  Vector2f _translation
          The user's computed translation.
static int LAST_FLAG
          The value of the last flag defined in this class.
static int MOVE
          Indicates that the user wants to move.
 
Constructor Summary
InputFrame()
          No-arg constructor for deserialization.
InputFrame(int timestamp, float rotation, float direction, int flags)
          Creates a new input frame.
 
Method Summary
 int getApproximateSize()
          Returns the approximate size of the frame in bytes (including its two-byte class code).
 float getDirection()
          Returns the direction of movement requested by the user.
 int getFlags()
          Returns the user's input flags.
 float getRotation()
          Returns the rotation requested by the user.
 int getTimestamp()
          Returns the timestamp of this frame.
 Vector2f getTranslation()
          Returns a reference to the computed translation.
 boolean isSet(int flag)
          Determines whether a flag is set.
 void readObject(ObjectInputStream in)
          Custom deserialization method.
 void setTranslation(Vector2f translation)
          Sets the computed translation reference.
 String toString()
           
 void writeObject(ObjectOutputStream out)
          Custom serialization method.
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MOVE

public static final int MOVE
Indicates that the user wants to move.

See Also:
Constant Field Values

LAST_FLAG

public static final int LAST_FLAG
The value of the last flag defined in this class.

See Also:
Constant Field Values

_timestamp

protected int _timestamp
The timestamp of the input frame.


_translation

protected transient Vector2f _translation
The user's computed translation.


_rotation

protected float _rotation
The rotation requested by the user.


_direction

protected float _direction
The direction of movement requested by the user.


_flags

protected int _flags
The user's input flags.

Constructor Detail

InputFrame

public InputFrame(int timestamp,
                  float rotation,
                  float direction,
                  int flags)
Creates a new input frame.


InputFrame

public InputFrame()
No-arg constructor for deserialization.

Method Detail

getTimestamp

public int getTimestamp()
Returns the timestamp of this frame.


setTranslation

public void setTranslation(Vector2f translation)
Sets the computed translation reference. This is done on the client so that the server knows where the client thinks he should be.


getTranslation

public Vector2f getTranslation()
Returns a reference to the computed translation.


getRotation

public float getRotation()
Returns the rotation requested by the user.


getDirection

public float getDirection()
Returns the direction of movement requested by the user.


getFlags

public int getFlags()
Returns the user's input flags.


isSet

public boolean isSet(int flag)
Determines whether a flag is set.


getApproximateSize

public int getApproximateSize()
Returns the approximate size of the frame in bytes (including its two-byte class code).


writeObject

public void writeObject(ObjectOutputStream out)
                 throws IOException
Custom serialization method.

Throws:
IOException

readObject

public void readObject(ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Custom deserialization method.

Throws:
IOException
ClassNotFoundException

toString

public String toString()
Overrides:
toString in class DeepObject