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

Pages: [1]
1
Graphics / Std::Map texture not wokring
« on: June 28, 2018, 05:37:13 am »
For the following code even though nametext = "card001" and when I hard code card001.Art it works. When I don't it gives me the normal white square. This is really confusing me.  ;D

       

struct tempCard {
        sf::Texture Art;

        std::string Texture;
        //"Sprites/BasicCard.png"
        void loadArt() {
                if (!Art.loadFromFile(Texture) ){
                        // error...
                }
        }
};

.....
for (int i = 0; i < Player.handMax;i++) {
                if (Player.Hand[i] != 0) {
                        sf::RectangleShape Card(sf::Vector2f(80.0f, 128.0f));

                        std::string nametext = function_cardTexture(Player.Hand[i]);
                                std::cout << nametext;
                        sf::Texture texture = Vars[nametext].Art;
                       
                        Card.setTexture(&texture);
                        window.draw(Card);
                }
 

Pages: [1]