Closed zacharyblasczyk closed 3 years ago
This is BaseGame.render
implementation and docs
/// This implementation of render basically calls [renderComponent] for every component, making sure the canvas is reset for each one.
///
/// You can override it further to add more custom behaviour.
/// Beware of however you are rendering components if not using this; you must be careful to save and restore the canvas to avoid components messing up with each other.
@override
@mustCallSuper
void render(Canvas canvas) {
canvas.save();
components.forEach((comp) => renderComponent(canvas, comp));
canvas.restore();
}
I guess you need to do the same job it does saving/restoring canvas or call super.render
but I'm not exactly sure.
You render
method on your base game class is not calling super, you must call super on that method otherwise the rendering of components will not work.
Description
MyTextBox class defined in documentation not rendering if BaseGame Subclass has either render() or update() function defined.
Development environment
Flame version: ^1.0.0-rc5
Flutter doctor:
Runtime
This issue is related to running on which platform? (Select all that apply)
Minimal reproducible code (Required for bugs)
Include a minimal code that reproduces the problem add it inline using code block markdown, or a link to Github repository: Link to sample issue repo with 5 scenarios defined to be uncommented one at a time: zb3119/flame-text-box.
Example "working" code: Displays MyTextBox
Example issue code: