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

Pages: [1]
1
I just found out the states.transform exists which works great, and idk why but I couldn't change the texture of a sprite multiple times or it became really buggy whenever I tried it.

2
I have a 64 x 64 sprite of a block and I want to combine them inside the draw(sf::RenderTarget& target, sf::RenderStates states) method to create a texture of a wall of blocks depending on size.

At first I tried just using target.draw to draw each of the sprites individually, but the sprite.move method doesn't effect the target.

[
void Level::draw(sf::RenderTarget& target, sf::RenderStates states){
    sf::Texture Tblock;
    if (!Tblock.loadFromFile("block.png"))
        exit(1);
    sf::Sprite Sblock(Tblock);
    sf::Texture level;

    if (!level.create(getWidth()*64, getHeight()*64)) {
        exit(1);
    }  

    for(int y = 0; y < getHeight(); y++){
        for (int x = 0; x < getWidth(); x++){
            //draw sprite onto texture
            //I don&#39;t know what to do here
        }
    }

    sf::Sprite Level(level);
    target.draw(Level);

}
]

Any help or hints would be appreciated. Thank you.

 

Pages: [1]
anything