formatting

This commit is contained in:
Luan Nico
2018-05-21 01:59:07 -03:00
parent 011aff0fff
commit 6be3d28493
10 changed files with 107 additions and 57 deletions

View File

@ -11,7 +11,11 @@ class Sprite {
static final Paint paint = new Paint()..color = Colors.white;
Sprite(String fileName, {double x = 0.0, double y = 0.0, double width = null, double height = null}) {
Sprite(String fileName,
{double x = 0.0,
double y = 0.0,
double width = null,
double height = null}) {
Flame.images.load(fileName).then((img) {
if (width == null) {
width = img.width.toDouble();
@ -24,19 +28,28 @@ class Sprite {
});
}
Sprite.fromImage(this.image, {double x = 0.0, double y = 0.0, double width = null, double height = null}) {
if (width == null) {
width = image.width.toDouble();
}
if (height == null) {
height = image.height.toDouble();
}
this.src = new Rect.fromLTWH(x, y, width, height);
Sprite.fromImage(this.image,
{double x = 0.0,
double y = 0.0,
double width = null,
double height = null}) {
if (width == null) {
width = image.width.toDouble();
}
if (height == null) {
height = image.height.toDouble();
}
this.src = new Rect.fromLTWH(x, y, width, height);
}
static Future<Sprite> loadSprite(String fileName, {double x = 0.0, double y = 0.0, double width = null, double height = null}) async {
static Future<Sprite> loadSprite(String fileName,
{double x = 0.0,
double y = 0.0,
double width = null,
double height = null}) async {
Image image = await Flame.images.load(fileName);
return new Sprite.fromImage(image, x: x, y: y, width: width, height: height);
return new Sprite.fromImage(image,
x: x, y: y, width: width, height: height);
}
bool loaded() {