Hey all,
I have some trouble importing a sprite from this code
#include <SFML/Graphics.hpp>
using namespace sf;
RenderWindow fen;
Texture lucina;
Sprite lucinasprite;
int main()
{
lucina.loadFromFile("Lucina.png", IntRect(400, 300, 32, 32));
lucinasprite.setTexture(lucina);
//Création de la fenêtre
RenderWindow fen(VideoMode(800, 600), "Learning SFML");
fen.setPosition(Vector2i(0, 0));
fen.setFramerateLimit(60);
//Création d'un Rectangle
RectangleShape rectangle(Vector2f(32, 32));
rectangle.setFillColor(Color::Red);
rectangle.setPosition(400, 300);
//tant que la fenêtre est ouverte
while (fen.isOpen())
{
Vector2i MousePos = Mouse::getPosition(fen);
if (Mouse::isButtonPressed(Mouse::Left))
{
// left mouse button is pressed: shoot
rectangle.setPosition(int(MousePos.x), int(MousePos.y));
}
//association des évènements de la fenêtre à un évènement sur une boucle
Event WindowEvent;
while (fen.pollEvent(WindowEvent))
{
if (WindowEvent.type == Event::Closed)
fen.close();
}
fen.clear(Color::Cyan);
fen.draw(rectangle);
fen.draw(lucinasprite);
fen.display();
}
return 0;
I have this error : Failed to create the texture, it's internal size is too high (BignumberxBignumber)
but my image is only 32x32 tall xD
And what should I put in this lucina.loadFromFile("Lucina.png", to aim a custom folder?