7 Commits

Author SHA1 Message Date
27e4dcb65a chore: Update usages of Dart UI Color to not use deprecated fields and methods [flame_3d] (#3297)
Update usages of Dart UI Color to not use deprecated fields and methods.
On latest main of Flutter these will cause lint errors, [as can be seen
here](https://github.com/flame-engine/flame/actions/runs/10814047130/job/29999530293?pr=3282).

Note: I will update the `flame_3d`-specific violations on a followup.
2024-12-11 14:26:29 -05:00
34f69b953c refactor!: Simplify text rendering pipeline (#2663)
While studying the existing text rendering pipeline and infrastructure, in order to better document it and add some easier user-facing ways to render rich text, I found it to be on a slightly overcomplicated state that seems to me to be an artifact of a migration.

Let me first briefly describe how it works with some diagrams (I am writing docs for everything and will re-use this content but wanted to propose this PR first as it will change how things look like).

We have 3 hierarchies related to rendering:

    renderers: children of TextRenderer, these define how to render text (style). do not include text
    formatters: children of TextFormatter, this also define how to render text (style), but a bit more higher level than TextRenderer.
    elements: these are laid-out, styled and ready-render pieces of text (style + string), created by formatters

Note that the renderers and formatters kinda serve the same purpose, but the renderers are a more low-level API. Here is how it it looks like today:

Not only that but all of our TextRenderer are actually FormatterTextRenderer, which just use a formatter to "comply" with the "renderer" interface. There are no "raw" TextRenderers anymore.

This current structure seems to clearly derive from an unfinished transition into the new, higher level and more flexible "formatter" structure while still supporting the "renderers" while we transition. That transition, though, seems to have completed.

The current state makes things more complicated as our current versions of components (TextComponent and TextBoxComponent), specifically the former, have branching code to support both the raw TextRenderer and the specific FormatterTextRenderer implementation, which breaks the inheritance encapsulation and voids its purpose in the first place.

The purpose of this PR is to simplify this class structure by:

    remove the base TextRenderer
    rename FormatterTextRenderer to TextRenderer: all renderers are formatter-based now
    update all references
    simplify the code of the components by only dealing with (former FormatterTextRenderer) TextRenderers

This is what it looks like now:

Note that while this is a breaking change, it should not affect most users as they should be using much more user-facing classes, like the aforementioned components, instead of the backing implementations. In fact even if they use the renderers, they probably use one of the concrete implementations anyway, TextPaint or SpriteFontRenderer. Notwithstanding, I added migration instructions below.

This is a small step towards a world where we completely combine the converts of renderers and formatters, as, in my eyes, they do the same thing (carry the style information w/o the text).

Possible future (but definitely breaking) changes:

    remove renderers entirely and use formatters directly
    consider renaming formatters to renderers (or not)
    rename TextPaint as the name does not make sense in any hierarchical model we use
    (what I am really interested in): allow the creation of text_ and text_box_ components directly from renderers + elements
2023-08-24 09:58:52 +02:00
843ddc3624 refactor: Move to package imports (#1625)
* refactor: Move to package imports

* Fix local imports

* Removed unused imports
2022-05-15 15:04:35 +00:00
4c68c2b0a2 feat: Add FpsComponent and FpsTextComponent (#1595) 2022-05-11 19:49:14 +02:00
5c47d7f6d7 chore: analyze issues introduced from new dart version (#1196)
* Added Component.childrenFactory

* fix some of the lint warnings

* more lint warnings

* remove changelog entry

* more analyzer warnings

* one more warning

* one more warning

* remove more unused imports

* fix more warnings

* another warning

* one more warning

* a lot more warnings

* some more warnings

* fix warnings in flame_svg

* fix warnings in flame_bloc

* Remove OrderedSet override feature

* Remove testRandom change

* Remove unnecessary type checks

* Re-remove deprecated argument in random_test

Co-authored-by: Pasha Stetsenko <stpasha@google.com>
2021-12-09 15:40:43 +01:00
3cb23ef530 TextPaint to use TextStyle instead of TextPaintConfig (#1086)
* `TextPaint` to use `TextStyle` instead of `TextPaintConfig`

* Update packages/flame/lib/src/text.dart

Co-authored-by: Pasha Stetsenko <stpasha@google.com>

* Removed BaseTextConfig and TextPaintConfig

* Update text docs

* Apply suggestions from code review

Co-authored-by: Erick <erickzanardoo@gmail.com>

* Remove generics

* Update TextBoxExample

* Update text examples variable names

* Fix TextPaint in collision_detection example

Co-authored-by: Pasha Stetsenko <stpasha@google.com>
Co-authored-by: Erick <erickzanardoo@gmail.com>
2021-11-13 16:38:06 +01:00
c015af8bee Added flame_oxygen (#823)
* Added flame_oxygen

* Reworked structure

* Added components and example

* Added particle support

* Updated code

* Update example

* Fixed mistake

* Update

* Updated documentation

* Added system documentation

* Fixed line length

* Added most components docs

* Docs done?

* Update doc/oxygen.md

Co-authored-by: Erick <erickzanardoo@gmail.com>

* Added GameRef

* Fixed GameRef

* Reworked library to not use part system

* Added GameRef docs

* Removed library line

* Updated CHANGELOG

* Added License

* Fixed linting problem

* Update packages/flame_oxygen/example/lib/main.dart

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>

* Update after review from spydon

* Added flipping

* Fixed CI/CD

* Fix

* Update

* Update doc/oxygen.md

Co-authored-by: Renan <6718144+renancaraujo@users.noreply.github.com>

Co-authored-by: Erick <erickzanardoo@gmail.com>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Renan <6718144+renancaraujo@users.noreply.github.com>
2021-09-05 23:44:29 +02:00