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

Author Topic: How to load multiple textures and sprites efficiently?  (Read 2588 times)

0 Members and 1 Guest are viewing this topic.

StrengthSauce

  • Newbie
  • *
  • Posts: 3
    • View Profile
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);
« Last Edit: April 27, 2015, 09:29:00 pm by StrengthSauce »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to load multiple textures and sprites efficiently?
« Reply #1 on: April 27, 2015, 10:09:07 pm »
Error handling... You should really read SFML's tutorials and documentation.

And your use of the comma operator indicates that you also lack some C++ knowledge... Maybe having another look at a good C++ book before delving into SFML is a good idea.

Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything