I just noticed a thing when I tried to render a PNG image. What I expected was this image:
But what I got was this:
Don't mind the red background, just me trying something out.
Anyway I don't understand why the transparency doesn't work and why the edges are cut off? Is it something I've done wrong?
I noticed this when I for the first time tried rendering something trough my game engine. The code for my test class looks like this:
class ImageEntity : public GraphicalEntity
{
public:
static ImageEntity *New()
{
ImageEntity *object = new ImageEntity();
object->Init();
return object;
}
protected:
void Init()
{
GraphicalEntity::Init();
myImage.LoadFromFile("data/test.png");
mySprite.SetImage(myImage);
}
void InitReceiver()
{
myReceiver = new ImageReceiver(*this);
}
void Render(sf::RenderTarget &target, sf::Renderer &renderer) const
{
target.Draw(mySprite);
}
sf::Image myImage;
sf::Sprite mySprite;
};
There's a lot of more code involved but the engine is getting quite huge and has a asynchronous design so it's kinda hard to show all the relevant code.