fix some apis

This commit is contained in:
Luan Nico
2018-04-15 10:00:18 -03:00
parent 6871b2993a
commit 879b358ad3
7 changed files with 42 additions and 30 deletions

View File

@ -29,20 +29,20 @@ abstract class PositionComponent extends Component {
double x = 0.0, y = 0.0, angle = 0.0;
double width = 0.0, height = 0.0;
Position get position => new Position(x, y);
void set position(Position position) {
Position toPosition() => new Position(x, y);
void setByPosition(Position position) {
this.x = position.x;
this.y = position.y;
}
Position get size => new Position(width, height);
void set size(Position size) {
Position toSize() => new Position(width, height);
void setBySize(Position size) {
this.width = size.x;
this.height = size.y;
}
Rect get rect => new Rect.fromLTWH(x, y, width, height);
void set rect(Rect rect) {
Rect toRect() => new Rect.fromLTWH(x, y, width, height);
void setByRect(Rect rect) {
this.x = rect.left;
this.y = rect.top;
this.width = rect.width;
@ -50,7 +50,7 @@ abstract class PositionComponent extends Component {
}
double angleBetween(PositionComponent c) {
return (atan2(c.x - this.x, this.y - c.y) - PI / 2) % (2 * PI);
return (atan2(c.x - this.x, this.y - c.y) - pi / 2) % (2 * pi);
}
double distance(PositionComponent c) {