I'm currently developing an application that can create and export battle maps for my DnD (and other RPGs) groups. I use Godot as a foundation because it brings a lot of features that support this use case like sprite rendering, polygons, shaders, an amazing UI framework etc.
I have a scene tree that looks roughly as follows:
- Window
- Menu
- ...
- ToolWindow
- SelectionTool
- Polygon Tool
- ...
- Canvas
- ToolSpecificNodes
- SpritePreview
- MapRoot
- Polygon1
- Sprite1
- ToolSpecificNodes
- Menu
Whenever another tool is selected I discard all nodes under "ToolSpecificNodes" and let the selected tool add it's own nodes. Every tool has a select() and deselect() lifecycle-method and a reference to canvas. Every tool also comes with a property window that it manages itself.
My question is how I would integrate the different tools in a way that allows them to be loosely coupled and exchangeable. The planned tools are "select tool", "polygon tool", "line tool", "sprite tool". I'm struggling especially with the "select tool" as it kind of relies on the other tools for handling stuff like polygon deformation, line deformation and sprite scaling.
Is there a well known architecture pattern that covers this use case? Or maybe an example project that shows this without too much added complexity? None-Godot solutions are also welcome as I should be able to apply them to my context.
Aucun commentaire:
Enregistrer un commentaire