mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 20:13:50 +08:00
Fix up some typos in the docs
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
# Looping Background Music
|
# Looping Background Music
|
||||||
|
|
||||||
The `Bgm` class with the management of loooping background music tracks with regards to application (or game) lifecycle state changes.
|
The `Bgm` class with the management of looping background music tracks with regards to application (or game) lifecycle state changes.
|
||||||
|
|
||||||
When the application is paused, terminated, or sent to background, `Bgm` will automatically pause the currently playing music track. Similarly, when the application is resumed, `Bgm` will resume the background music. Manual pause and resume is also supported.
|
When the application is paused, terminated, or sent to background, `Bgm` will automatically pause the currently playing music track. Similarly, when the application is resumed, `Bgm` will resume the background music. Manual pause and resume is also supported.
|
||||||
|
|
||||||
|
|||||||
@ -201,9 +201,9 @@ A example of how to use the API can be found [here](/doc/examples/tiled).
|
|||||||
|
|
||||||
A Nine Tile Box is a rectangle drawn using a grid sprite.
|
A Nine Tile Box is a rectangle drawn using a grid sprite.
|
||||||
|
|
||||||
The grid sprite is a 3x3 grid and with 9 blocks, representing the 4 courners, the 4 sides and the middle.
|
The grid sprite is a 3x3 grid and with 9 blocks, representing the 4 corners, the 4 sides and the middle.
|
||||||
|
|
||||||
The corners are drawn at the same size, the sides are streched on the side direction and the middle is expanded both ways.
|
The corners are drawn at the same size, the sides are stretched on the side direction and the middle is expanded both ways.
|
||||||
|
|
||||||
Using this, you can get a box/rectangle that expands well to any sizes. This is useful for making panels, dialogs, borders.
|
Using this, you can get a box/rectangle that expands well to any sizes. This is useful for making panels, dialogs, borders.
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ All of these methods are basically a mirror from the callbacks available on the
|
|||||||
|
|
||||||
```dart
|
```dart
|
||||||
class MyGame extends Game with TapDetector {
|
class MyGame extends Game with TapDetector {
|
||||||
// Other methods ommited
|
// Other methods omitted
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onTapDown(TapDownDetails details) {
|
void onTapDown(TapDownDetails details) {
|
||||||
@ -123,7 +123,7 @@ class TapableComponent extends PositionComponent with Tapable {
|
|||||||
|
|
||||||
Flame provides a simple way to access Flutter's features regarding accessing Keyboard input events.
|
Flame provides a simple way to access Flutter's features regarding accessing Keyboard input events.
|
||||||
|
|
||||||
To use it just add the `KeyboardEvents` mixin to your game class. By doing so you will need to implement the `onKeyEvent` method, this method is called everytime a keyboard event happens, and it receives an instance of the Flutter class `RawKeyEvent`, which can be used to get information about the event, like if it was a key down or key up event, the pressed key and etc.
|
To use it just add the `KeyboardEvents` mixin to your game class. By doing so you will need to implement the `onKeyEvent` method, this method is called every time a keyboard event happens, and it receives an instance of the Flutter class `RawKeyEvent`, which can be used to get information about the event, like if it was a key down or key up event, the pressed key and etc.
|
||||||
|
|
||||||
Minimal example:
|
Minimal example:
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ When using `Particle` with custom `Game` implementation, please ensure that `Par
|
|||||||
|
|
||||||
Main approaches to implement desired particle effects:
|
Main approaches to implement desired particle effects:
|
||||||
* Composition of existing behaviors
|
* Composition of existing behaviors
|
||||||
* Use behavior chaining (just a syntaxic sugar over first one)
|
* Use behavior chaining (just a syntactic sugar over first one)
|
||||||
* Using `ComputedParticle`
|
* Using `ComputedParticle`
|
||||||
|
|
||||||
Composition works in a similar fashion to those of Flutter widgets by defining the effect from top to bottom. Chaining allows to express same composition trees more fluently by defining behaviors from bottom to top. Computed particles in their turn fully delegate implementation of the behavior to your code. Any of the approaches, though, could be used in conjunction with existing behaviors, where needed.
|
Composition works in a similar fashion to those of Flutter widgets by defining the effect from top to bottom. Chaining allows to express same composition trees more fluently by defining behaviors from bottom to top. Computed particles in their turn fully delegate implementation of the behavior to your code. Any of the approaches, though, could be used in conjunction with existing behaviors, where needed.
|
||||||
@ -101,7 +101,7 @@ You can find more examples of using different built-int particles in various com
|
|||||||
|
|
||||||
## Lifecycle
|
## Lifecycle
|
||||||
|
|
||||||
Behavior common to all `Particle`s is that all of them accept `lifespan` parameter. This value is used to make `ParticleCoponent` self-destoy, once its internal `Particle` has reached the end of its life. Time within the `Particle` itself is tracked using the Flame `Timer`. It could be configured with `double`, representing seconds (with microsecond precision)by passing it into the corresponding `Particle` constructor.
|
Behavior common to all `Particle`s is that all of them accept `lifespan` parameter. This value is used to make `ParticleCoponent` self-destroy, once its internal `Particle` has reached the end of its life. Time within the `Particle` itself is tracked using the Flame `Timer`. It could be configured with `double`, representing seconds (with microsecond precision)by passing it into the corresponding `Particle` constructor.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
Particle(lifespan: .2); // will live for 200ms
|
Particle(lifespan: .2); // will live for 200ms
|
||||||
@ -357,7 +357,7 @@ game.add(
|
|||||||
## Nesting behavior
|
## Nesting behavior
|
||||||
|
|
||||||
Flame's implementation of particles follows same pattern of extreme composition as Flutter widgets. That
|
Flame's implementation of particles follows same pattern of extreme composition as Flutter widgets. That
|
||||||
is achieved by incapsulating small pieces of behavior in every of particles and then nesting these behaviors together to achieve desired visual effect.
|
is achieved by encapsulating small pieces of behavior in every of particles and then nesting these behaviors together to achieve desired visual effect.
|
||||||
|
|
||||||
Two entities allowing `Particle` to nest each other are: `SingleChildParticle` mixin and `ComposedParticle` class.
|
Two entities allowing `Particle` to nest each other are: `SingleChildParticle` mixin and `ComposedParticle` class.
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,9 @@ You can also see all the widgets showcased inside a [Dashbook](https://github.co
|
|||||||
|
|
||||||
A Nine Tile Box is a rectangle drawn using a grid sprite.
|
A Nine Tile Box is a rectangle drawn using a grid sprite.
|
||||||
|
|
||||||
The grid sprite is a 3x3 grid and with 9 blocks, representing the 4 courners, the 4 sides and the middle.
|
The grid sprite is a 3x3 grid and with 9 blocks, representing the 4 corners, the 4 sides and the middle.
|
||||||
|
|
||||||
The corners are drawn at the same size, the sides are streched on the side direction and the middle is expanded both ways.
|
The corners are drawn at the same size, the sides are stretched on the side direction and the middle is expanded both ways.
|
||||||
|
|
||||||
The `NineTileBox` widget implements a Container using that standard. This pattern is also implemented in game by the `NineTileBoxComponent` where you can use this same feature, but directly into the game Canvas, to know more about this, check the component docs [here](doc/components.md#nine-tile-box-component).
|
The `NineTileBox` widget implements a Container using that standard. This pattern is also implemented in game by the `NineTileBoxComponent` where you can use this same feature, but directly into the game Canvas, to know more about this, check the component docs [here](doc/components.md#nine-tile-box-component).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user