mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 10:38:17 +08:00
change packages, add Position class and Camera to BaseGame
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flame/sprite.dart';
|
||||
import '../sprite.dart';
|
||||
import '../position.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
|
||||
abstract class Component {
|
||||
@ -41,6 +42,10 @@ abstract class PositionComponent extends Component {
|
||||
canvas.translate(-width/2, -height/2);
|
||||
}
|
||||
|
||||
Position toPosition() {
|
||||
return new Position(x, y);
|
||||
}
|
||||
|
||||
Rect toRect() {
|
||||
return new Rect.fromLTWH(x, y, width, height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user