The drawing part of the Entity class has been separated into a new derived abstract class called DrawableEntity, which all the drawn entities derive.
This lifts the requirement that all entities have something to draw. The Entity class can now be directly instantiated if we want to use it just as a placement container for other entities. Or we can derive the Entity class if we want to extend that logic without needing to draw something at the top level.
The main incentive for this change was making it less awkward to have a World class wrapping our player and tiles, without requiring the World to have its own vertices to draw.
All the drawing logic previously living in the game loop is now in a DrawableEntity method called draw().
In the future this could lend itself to entities being able to call their own children entities' draw methods if we decide to restructure how drawing works (could be easier moving forward).
isHidden() on Entity now has cascading effect (child looks up if itself, or its parent, is hidden). This might end up being pointless if parents become responsible for drawing children in the future, but it's probably good for now?
Main changes:
Entity
class has been separated into a new derived abstract class calledDrawableEntity
, which all the drawn entities derive.Entity
class can now be directly instantiated if we want to use it just as a placement container for other entities. Or we can derive theEntity
class if we want to extend that logic without needing to draw something at the top level.World
class wrapping our player and tiles, without requiring theWorld
to have its own vertices to draw.DrawableEntity
method calleddraw()
.draw
methods if we decide to restructure how drawing works (could be easier moving forward).isHidden()
onEntity
now has cascading effect (child looks up if itself, or its parent, is hidden). This might end up being pointless if parents become responsible for drawing children in the future, but it's probably good for now?