mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 04:18:25 +08:00
Renaming remove to markToRemove
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
## [next]
|
## [next]
|
||||||
- Adding BaseGame#remove
|
- Adding BaseGame#markToRemove
|
||||||
- Upgrade tiled and flutter_svg dependencies
|
- Upgrade tiled and flutter_svg dependencies
|
||||||
|
|
||||||
## 0.22.1
|
## 0.22.1
|
||||||
|
|||||||
@ -45,7 +45,7 @@ A very simple `BaseGame` implementation example can be seen below:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To remove components from the list on a `BaseGame` the `remove` can be used.
|
To remove components from the list on a `BaseGame` the `markToRemove` method can be used.
|
||||||
|
|
||||||
## Flutter Widgets and Game instances
|
## Flutter Widgets and Game instances
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class MyGame extends BaseGame with DoubleTapDetector, TapDetector {
|
|||||||
components.forEach((c) {
|
components.forEach((c) {
|
||||||
if (c is PositionComponent && c.toRect().overlaps(touchArea)) {
|
if (c is PositionComponent && c.toRect().overlaps(touchArea)) {
|
||||||
handled = true;
|
handled = true;
|
||||||
remove(c);
|
markToRemove(c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ mixin ComposedComponent on Component, HasGameRef, Tapable {
|
|||||||
components.add(c);
|
components.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(Component component) {
|
void markToRemove(Component component) {
|
||||||
_removeLater.add(component);
|
_removeLater.add(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -89,8 +89,8 @@ class BaseGame extends Game {
|
|||||||
_addLater.add(c);
|
_addLater.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes a component from the components list
|
/// Marks a component to be removed from the components list on the next game loop cycle
|
||||||
void remove(Component c) {
|
void markToRemove(Component c) {
|
||||||
_removeLater.add(c);
|
_removeLater.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user