|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttouchscreen.Touch
public class Touch
Represents one hand touching a screen. Has a current position and size, status, and an ArrayList of Points representing the path the hand moved on.
| Field Summary | |
|---|---|
int |
h
height of box around this touch |
int |
id
a unique id for this Touch - can be used as a key for data in your application |
static int |
IS_DRAGGING
this Touch went down in the past and is dragging across the screen - akin to mouseDragged |
static int |
JUST_WENT_DOWN
this Touch just started - akin to mousePressed |
static int |
JUST_WENT_UP
this Touch ended last frame - the user's hand left the screen - akin to mouseReleased |
static java.lang.String[] |
STATUS_MAP
maps the status variables to their textual representations (ie 2="IS_DRAGGING") |
int |
w
width of box around this touch |
int |
x
current position, top left corner |
int |
y
current position, top left corner |
| Constructor Summary | |
|---|---|
Touch()
|
|
Touch(int x,
int y,
int w,
int h,
int id)
|
|
| Method Summary | |
|---|---|
float[] |
getCenter()
returns the center point of a Touch box as an array of floats {x, y} |
int |
getID()
|
java.util.ArrayList |
getPath()
get a list of Points that this Touch traveled on (essentially, a history of x,y,w,h) |
int |
getStatus()
What the hand is doing. |
boolean |
matches(Touch that)
determines if a touch is close enough to another touch to be considered IS_DRAGGING |
void |
setID(int id)
|
void |
setStatus(int status)
You never need to use this. |
java.lang.String |
toString()
|
void |
update(int x,
int y,
int w,
int h,
int status)
You never need to use this. |
void |
update(Touch t,
int status)
You never need to use this. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int JUST_WENT_DOWN
public static final int IS_DRAGGING
public static final int JUST_WENT_UP
public static final java.lang.String[] STATUS_MAP
public int x
public int y
public int w
public int h
public int id
| Constructor Detail |
|---|
public Touch()
public Touch(int x,
int y,
int w,
int h,
int id)
| Method Detail |
|---|
public void update(int x,
int y,
int w,
int h,
int status)
public void update(Touch t,
int status)
public void setStatus(int status)
public int getStatus()
1 : JUST_WENT_DOWN : this Touch just started.
2 : IS_DRAGGING : this Touch has existed in the past, and is dragging along the screen.
3 : JUST_WENT_UP : this Touch existed last frame, but the person took her hand off the screen.
use it like:
if (someTouch.getStatus() == Touch.JUST_WENT_UP) { doSomething(); }
public void setID(int id)
public int getID()
public boolean matches(Touch that)
public float[] getCenter()
public java.util.ArrayList getPath()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||