Redid the entity system a bit to make it more reliable

Now it supports things like parenting elements before they are
added to a window and elements no longer have to constantly check
for a nil entity
This commit is contained in:
2023-04-15 01:14:36 -04:00
parent 5cf0b162c0
commit 437aef0c27
12 changed files with 129 additions and 96 deletions

View File

@@ -24,9 +24,11 @@ type Entity interface {
SetMinimumSize (width, height int)
// DrawBackground asks the parent element to draw its background pattern
// within the specified rectangle. This should be used for transparent
// elements like text labels.
DrawBackground (destination canvas.Canvas, bounds image.Rectangle)
// to a canvas. This should be used for transparent elements like text
// labels. If there is no parent element (that is, the element is
// directly inside of the window), the backend will draw a default
// background pattern.
DrawBackground (canvas.Canvas)
}
// ContainerEntity is given to elements that support the Container interface.