Move from Position to Vector2

This commit is contained in:
Lukas Klingsbo
2020-09-10 01:16:25 +02:00
parent 113e0db074
commit 5edd5f0fbd
54 changed files with 403 additions and 521 deletions

View File

@ -7,10 +7,11 @@ import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame/palette.dart';
import 'package:flame/text_config.dart';
import 'package:flame/vector.dart';
import 'package:flutter/material.dart';
void main() async {
final Size size = await Flame.util.initialDimensions();
final Vector2 size = await Flame.util.initialDimensions();
runApp(MyGame(size).widget);
}
@ -34,27 +35,27 @@ class MyTextBox extends TextBoxComponent {
}
class MyGame extends BaseGame {
MyGame(Size screenSize) {
MyGame(Vector2 screenSize) {
size = screenSize;
add(TextComponent('Hello, Flame', config: regular)
..anchor = Anchor.topCenter
..x = size.width / 2
..x = size.x / 2
..y = 32.0);
add(TextComponent('center', config: tiny)
..anchor = Anchor.center
..x = size.width / 2
..y = size.height / 2);
..x = size.x / 2
..y = size.y / 2);
add(TextComponent('bottomRight', config: tiny)
..anchor = Anchor.bottomRight
..x = size.width
..y = size.height);
..x = size.x
..y = size.y);
add(MyTextBox(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget ligula eu lectus lobortis condimentum.',
)
..anchor = Anchor.bottomLeft
..y = size.height);
..y = size.y);
}
}