mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 20:13:50 +08:00
fix some apis
This commit is contained in:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user