Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Pyrrha

Pages: [1]
1
Graphics / Re: Little Beginner problem
« on: July 05, 2016, 03:23:27 pm »
Welp I removed this , IntRect(400, 300, 32, 32)); it seems to work for some reasons

2
Graphics / Little Beginner problem
« on: July 05, 2016, 02:52:50 pm »
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?

Pages: [1]