refactor!: Make TextElement more usable on its own (#2679)

This is part of my ongoing effort to simplify the text rendering
pipeline.
My ultimate goal is to:
* get rid of renders
* rename formatters to renderers
* make the interface complies to both
All details are specified here:
https://github.com/flame-engine/flame/pull/2663

As a first step to break down that huge PR, this makes a small change to
TextElements to make them more useful

This PR will:
### rename render -> draw

draw becomes the "internal", underlying impl, raw method, that just
draws the element w/ any custom options

### add a new render method that takes in more options

this does not need to be extended by every impl.
this is for end users and accepts parameters like position and anchor to
be more in line with the renderer interface

This is technically a breaking change but should have no effect for
users, unless you are creating your own custom `TextElement`s. In that
case, to migrate:

* rename your `render` method to `draw`
This commit is contained in:
Luan Nico
2023-08-26 09:10:03 -07:00
committed by GitHub
parent 76405daf48
commit 1a64443cca
16 changed files with 32 additions and 32 deletions

View File

@ -250,7 +250,7 @@ class KeyboardKey extends PositionComponent {
void render(Canvas canvas) {
if (visible) {
canvas.drawRRect(rect, borderPaint);
textElement.render(canvas);
textElement.draw(canvas);
}
}
}