The caches Game.images and Game.assets now coincide with the static caches Flame.images and Flame.assets by default.
This aims to avoid the situation where the same image (asset) may be loaded twice into two separate caches without the user noticing.
Added size parameter to testGolden() function, allowing us to reduce the size of the game canvas used. The default size is 2400x1800, as given by the Flutter framework, seems like too much for most tests.
Additional mode "infobox" allows Flutter widgets to be inserted into the generated documentation site as wikipedia-style infoboxes floating on the right. This is useful for presenting content to the user up-front without sacrificing the flow of the exposition. For example, currently the Tap Events demo is "hidden" in the middle of a long page.
We believe that presenting the content in this way would make the user more excited to read about it.
This PR changes the signature of the closeToVector() helper function:
Old: closeToVector(num x, num y, {double epsilon = 1e-15})
New: closeToVector(Vector2 vector, [double epsilon = 1e-15])
A TextFormatter is a class that can take a string of text and convert it into a TextElement.
A TextElement is an object that encapsulates a text string prepared for rendering. This object knows its own dimensions (layout), and is able to render itself on a canvas.
A TextFormatter is different from the current TextRenderer in one crucial respect: whereas TextRenderer takes a string of text and draws it onto the canvas directly (performing the layout and measurement internally), the TextFormatter creates an object that encapsulates the information necessary for rendering.
Thus, TextFormatter's output can be used to prepare the text once, and then render multiple times. In addition, since each TextElement knows its own layout, -- these individual layouts can be collected, manipulated, and arranged into a larger text body necessary for rich text rendering.
In addition, this PR:
Implements a debug version of the standard text renderer, which draws rectangles instead of text;
Re-enables the skipped golden test for the TextBoxComponent (hopefully it'll work this time);
Refactors existing TextRenderers to use the new TextFormatters under the hood.
This PR is a WIP for the Rich Text functionality (#1627).
This simple refactor allows us to write class MyGame extends Game, instead of a more awkward class MyGame with Game. However, using ... with Game still continues to work, so no changes necessary for the users.
When the camera follows a component with world boundaries and zoom, the camera is incorrectly positioned.
I think it is because world boundaries already consider the zoom and it will never be greater than gameSize * zoom.
The componentsAtPoint function allows us to find a component located at a specific position. Usually it is applied to the top-level Game, but there are instances when it could also be useful to apply this function to the World component. This PR enables such functionality.
This PR adds a getter to the FlameBlocListenable mixin. This getter will allow to use FlameBlocListenable as a standalone mixin to react to new states via onNewState(), access the current state, and also add events to the listenable Bloc via the bloc property.
Currently a workaround to give components this functionality is to use FlameBlocListenable and FlameBlocReader in parallel.
Pub gives a warning when using ^3.0.0 since that also implies less than 4.0.0, which your Flutter dependency shouldn't be.
With >= it is an open range instead.
- In Component, we will now avoid adoption queue when setting parent to the same as the current;
- The ButtonComponent avoids swapping button and buttonDown components if buttonDown is null;
The "basic" gesture detectors widget was creating a RawGestureDetector underneath, which resulted in two nested RawGestureDetectors, each with its own gesture arena.
This refactor combines the two gesture detectors into a single one.