AI for Games 1.1.1
|
Public Member Functions | |
Domain (double lowX, double lowY, double highX, double highY) | |
Domain (Domain d) | |
void | setDomain_xywh (double lowX, double lowY, double width, double height) |
void | move_centre_xy_to (double wx, double wy) |
void | move_centre_x_to (double wx) |
void | move_centre_y_to (double wy) |
void | move_centre_xy_by (double wx, double wy) |
void | move_centre_x_by (double wx) |
void | move_centre_y_by (double wy) |
boolean | contains (Vector2D p) |
boolean | contains (Vector2D p, double scale) |
boolean | contains (double px, double py) |
String | toString () |
Public Attributes | |
double | lowX |
double | highX |
double | lowY |
double | highY |
final Vector2D | centre |
double | width |
double | height |
Objects of this class represent a rectangular region of the world. It can also used to store the viewport or display area of the screen. They can be used to constrain moving entities to particular regions.
WARNING although the attributes are public, this is for speed of reading and they should only be changed using the methods provided in this class.
game2dai.Domain.Domain | ( | double | lowX, |
double | lowY, | ||
double | highX, | ||
double | highY | ||
) |
Create a Domain object given the top-left and bottom-right coordinates.
lowX | |
lowY | |
highX | |
highY |
game2dai.Domain.Domain | ( | Domain | d | ) |
Create a Domain that is a copy of another one.
d | domain to be copied |
boolean game2dai.Domain.contains | ( | double | px, |
double | py | ||
) |
See if this point is within the domain
px | x position of point to test |
py | position of point to test |
boolean game2dai.Domain.contains | ( | Vector2D | p | ) |
See if this point is within the domain
p | the point to test |
boolean game2dai.Domain.contains | ( | Vector2D | p, |
double | scale | ||
) |
See if this point is within a box scaled by the second parameter.
fraction must be >0 otherwise the function always returns false. A value of 1 will test against the full size domain and a value of 0.5 means the point p must be in the middle half both horizontally and vertically.
p | the point to test |
scale | the scale of the domain to consider |
void game2dai.Domain.move_centre_x_by | ( | double | wx | ) |
Move the domain centre horizontally by the world distance given.
wx | world x centre position |
void game2dai.Domain.move_centre_x_to | ( | double | wx | ) |
Centre the domain about the given horizontal position.
wx | world x position |
void game2dai.Domain.move_centre_xy_by | ( | double | wx, |
double | wy | ||
) |
Centre the domain about the given position.
wx | world x centre position |
wy | world y centre position |
void game2dai.Domain.move_centre_xy_to | ( | double | wx, |
double | wy | ||
) |
Centre the domain about the given world position.
wx | world x position |
wy | world y position |
void game2dai.Domain.move_centre_y_by | ( | double | wy | ) |
Move the domain centre vertically by the world distance given.
wy | world y centre position |
void game2dai.Domain.move_centre_y_to | ( | double | wy | ) |
Centre the domain about the given vertical position.
wy | world y position |
void game2dai.Domain.setDomain_xywh | ( | double | lowX, |
double | lowY, | ||
double | width, | ||
double | height | ||
) |
Set the domain size.
lowX | top-left x coordinate |
lowY | top-left y coordinate |
width | domain width |
height | domain height |
String game2dai.Domain.toString | ( | ) |
Return the Domain as a String