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 - StrengthSauce

Pages: [1]
1
General / Problems with clickable sprites
« on: May 04, 2015, 11:35:13 pm »
Hello, I want to make a sprite clickable, but when I use the code below, I never have to lift the mouse to navigate. Should I use sf::Event::mouseButtonReleased instead, and can you give an example?

sf::FloatRect bounds = sprite.getGlobalBounds();
        sf::Vector2f mouse = Win.mapPixelToCoords(sf::Mouse::getPosition(Win));
        if (bounds.contains(mouse) && sf::Mouse::isButtonPressed(sf::Mouse::Left))
        {
                // Stuff happens.
        }

2
Audio / How to repeat music?
« on: April 27, 2015, 11:48:18 pm »
Can I repeat the background music of my game forever until I want it to stop?

All I have right now is:
        // Load music and play.
        sf::Music mTheme;
        if (!mTheme.openFromFile("Theme.wav"))
                return -1;
        mTheme.play();

3
Graphics / How to load multiple textures and sprites efficiently?
« on: April 27, 2015, 09:24:31 pm »
Hi, I'm new to SFML, so I'm wondering how you would load multiple textures in the best way possible, and what exactly to put in the brackets in the middle.
What I have so far is:
//Load the textures. Textures start with a t.
        sf::Texture tVillage, tLogo;
        if (!tVillage.loadFromFile("Village.bmp"), (!tLogo.loadFromFile("Logo.png")))
        {
                //What exactly do I put in here?
        }
       
        //Load the sprites. Sprites start with an s.
        sf::Sprite sVillage, sLogo;
        sVillage.setTexture(tVillage), sLogo.setTexture(tLogo);

Pages: [1]