flame
flame copied to clipboard
Separate debug functionality from the Component class
What could be improved and why
Currently the Component class has certain debug properties + methods, including
bool debugMode;
Color debugColor;
ValueCache<Paint> _debugPaintCache;
ValueCache<TextPaint> _debugTextPaintCache;
int? get debugCoordinatesPrecision;
Paint get debugPaint;
TextPaint get debugTextPaint;
void renderDebugMode(Canvas canvas);
This is a lot of expensive properties, especially since they are carried for every Component in the game, and are completely unused under normal circumstances.
Now, I do believe that having debug mode, debug capabilities, and debug convenience is very important. However, we should think how to accomplish the same without unnecessarily encumbering the regular use-case.
Which of these properties are expensive? 🤔
Color has a complexity of a single int; whereas the two Cache properties contain a pointer and a list each.