I am designing the game so the objects I create (Character, Enemy, Enemycast...) can inherit all from
- Collider
- SpineDrawable // Sprite // AnimatedSprite
- D2D // D3D
Both D2D and D3D inherit from virtual sf::Drawable
. D3D also is supossed to apport the functionality of an additional axis. When the object is drawed in screen, the object is scaled and repositioned in (X, Y) with some calculations.
Collider inherits from D3D, because all my colliders are going to have 3 axis, and it creates its own AABB box from D3D interface -to be implemented by the graph type Sprite//SpineDr...-.
I am trying to have two vectors to hold all my graphics, std::vector<D2D*>
and std::vector<D3D*>
, because the D3D ones will need to be sorted depending on their float z
.
The problem arise because D2D///D3D classes inherit virtual sf::Drawable
, and I am using my class Sprite
inheriting from sf::Sprite
, which inherit sf::Drawable
as non-virtual function from in Sprite.hpp of SFML.
So I got two questions
Must I rewrite my sprite function in lower level, so it can inherit sf::Drawable as virtual?
I think my design is poor. Which alternatives are there instead of creating two separated lists of sf::Drawable/s to order the ones which have 3 axis?