Class TouchEvent
java.lang.Object
com.sparshui.common.messages.events.TouchEvent
- All Implemented Interfaces:
Event
,Serializable
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTouchEvent
(byte[] data) Constructs a new TouchEvent from a serialized version - 4 bytes : id - 4 bytes : x - 4 bytes : y - 4 bytes : state - 8 bytes : time - 24 bytes totalTouchEvent
(int id, float x, float y, int state) TouchEvent
(TouchPoint tp) -
Method Summary
-
Constructor Details
-
TouchEvent
public TouchEvent() -
TouchEvent
public TouchEvent(int id, float x, float y, int state) - Parameters:
id
-x
-y
-state
-
-
TouchEvent
-
TouchEvent
public TouchEvent(byte[] data) Constructs a new TouchEvent from a serialized version - 4 bytes : id - 4 bytes : x - 4 bytes : y - 4 bytes : state - 8 bytes : time - 24 bytes total- Parameters:
data
- the serialized version of touchEvent
-
-
Method Details
-
getTouchID
public int getTouchID() -
getTime
public long getTime() -
getX
public float getX() -
getY
public float getY() -
setX
public void setX(float x) -
setY
public void setY(float y) -
getState
public int getState() -
getEventType
public int getEventType()Description copied from interface:Event
Returns the integer value of this event type. Event type values are defined in the enumeration com.sparshui.common.messages.events.EventType.java- Specified by:
getEventType
in interfaceEvent
- Returns:
- The event type
-
serialize
public byte[] serialize()Constructs the data packet with this event data. Message format for this event: - 4 bytes : event type - 4 bytes : id - 4 bytes : x - 4 bytes : y - 4 bytes : state - 8 bytes : time - 28 bytes total -
toString
-