|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dualroids.SpatialObject
The common superclass for all spatial objects.
Field Summary | |
static Color[] |
COLOR_TABLE
17 shades of gray ready to use in Asteroid and
SpaceShip objects |
static int |
COLOR_TABLE_BLACK
The index of black in COLOR_TABLE . |
static int |
COLOR_TABLE_GRAY_50
The index of 50% gray in COLOR_TABLE . |
static int |
COLOR_TABLE_WHITE
The index of white in COLOR_TABLE . |
protected GeneralPath |
geometry
The untranslated geometric representation of the spatial object |
protected double |
locationX
The x coordinate of the center of the spatial object at the moment indicated by timestamp . |
protected double |
locationY
The y coordinate of the center of the spatial object at the moment indicated by timestamp . |
protected long |
timestamp
The moment in game (server) time for which the other fields are valid. |
protected AffineTransform |
transform
The AffineTransform used for calculating the translated
geometry. |
protected double |
velocityX
The x component of the valocity of the spatial object at the moment indicated by timestamp . |
protected double |
velocityY
The y component of the valocity of the spatial object at the moment indicated by timestamp . |
Constructor Summary | |
protected |
SpatialObject()
Dummy constructor for keeping the serialization framework happy. |
protected |
SpatialObject(double locationX,
double locationY,
double velocityX,
double velocityY,
long timestamp)
Contructs a new SpatialObject . |
Method Summary | |
abstract Shape |
getTransformedShape(long time)
Returns a properly translated Shape representing
the spatial object at time |
static double |
moveToRangeX(double value)
Moves value to the range
0.0 ...Arena.WIDTH so that the coordinate
wraps around. |
static double |
moveToRangeY(double value)
Moves value to the range
0.0 ...Arena.HEIGHT so that the coordinate
wraps around. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int COLOR_TABLE_BLACK
COLOR_TABLE
.public static final int COLOR_TABLE_WHITE
COLOR_TABLE
.public static final int COLOR_TABLE_GRAY_50
COLOR_TABLE
.public static final Color[] COLOR_TABLE
Asteroid
and
SpaceShip
objectsprotected long timestamp
protected transient GeneralPath geometry
protected double locationX
timestamp
.protected double locationY
timestamp
.protected double velocityX
timestamp
.protected double velocityY
timestamp
.protected transient AffineTransform transform
AffineTransform
used for calculating the translated
geometry. Stored here in order to avoid unnecessary feeding of the GC.Constructor Detail |
protected SpatialObject(double locationX, double locationY, double velocityX, double velocityY, long timestamp)
SpatialObject
.locationX
- the x coordinate of the initial locationlocationY
- the y coordinate of the initial locationvelocityX
- the x component of the velocityvelocityY
- the y component of the velocityangle
- the angle in radianstimestamp
- the moment in game (server) time for which the
other data is validprotected SpatialObject()
Method Detail |
public static final double moveToRangeX(double value)
value
to the range
0.0
...Arena.WIDTH
so that the coordinate
wraps around.value
- the value to wrappublic static final double moveToRangeY(double value)
value
to the range
0.0
...Arena.HEIGHT
so that the coordinate
wraps around.value
- the value to wrappublic abstract Shape getTransformedShape(long time)
Shape
representing
the spatial object at time
time
- the moment in game (server) time for which the
representation is requestedShape
representation at time
or null if the object isn't visible
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Dualroids was written by Oskar Ojala, Yrjö Kari-Koskinen and Henri Sivonen