1
General discussions / about inheriting sf::Drawable and sf::Sprite as property.
« on: January 12, 2022, 04:10:55 am »
Hello
I'm following the "SFML Game Development" book from Packt, in its example it creates a scenenode class that inherits from sf::Drawable.. that's good, as I understand it serves to draw my scenenode as simply typing
it has so much sense..!
but then, there is a spritenode class that inherits from scenenode class... but spritenode has a sf::Sprite property..
when i try to draw mySpriteNode object, the build is success.. but nothing shows on the screen...
but when i draw mySpriteNode.m_sprite (assuming m_sprite is public), then the sprite shows on the screen...
is this the expected behaviour ?...
I'm following the "SFML Game Development" book from Packt, in its example it creates a scenenode class that inherits from sf::Drawable.. that's good, as I understand it serves to draw my scenenode as simply typing
myRenderWindow.draw(mySceneNode);
it has so much sense..!
but then, there is a spritenode class that inherits from scenenode class... but spritenode has a sf::Sprite property..
when i try to draw mySpriteNode object, the build is success.. but nothing shows on the screen...
but when i draw mySpriteNode.m_sprite (assuming m_sprite is public), then the sprite shows on the screen...
is this the expected behaviour ?...