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

Author Topic: Does SFML delete sprites that are drawn over?  (Read 10205 times)

0 Members and 1 Guest are viewing this topic.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #15 on: August 26, 2014, 10:21:39 pm »
There really isn't any sort of limit.  The thing with vertex arrays is that they only work because you draw subsets of a single texture (ie, a spritesheet) many many times in a row.  Since the whole point is you put a lot of related images into one texture, you aren't going to have a huge number of these textures at the end.  For instance, you might have a sprite sheet for all the background tiles, one for the player character, one for each enemy, and so on, and there's nothing wrong with that.  You'd probably run out of things to put in spritesheets long before you had "too many" of them by any standard.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #16 on: August 26, 2014, 10:23:00 pm »
GPUs have a max texture size. That usually bounds the size of your sprite-sheet. 1024x1024 is usually a lower bound you can count on. Newer GPUs have larger limits.
In any case, you can always use multiple textures.

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #17 on: August 27, 2014, 12:59:24 am »
Ah I see, we'll i'm trying to get them to work now, i'm following the tutorial in the documents. I want to draw lines on my grid so the user can see where they're drawing to, I was thinking of drawing a single vertex in the center of each grid but now that I think about it, maybe a single grid texture drawin with a vertexArray would be better, what do you think?

Hapax

  • Hero Member
  • *****
  • Posts: 3357
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Does SFML delete sprites that are drawn over?
« Reply #18 on: August 27, 2014, 01:06:32 am »
For a grid, you could use a single vertex array.
Set its type to sf::Lines and then each pair of vertices form the end points of a line. You can then just draw lines from one side to the other and not need to do each tile individually, all in a single vertex array.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #19 on: August 27, 2014, 01:34:56 am »
Ok cool, I was thinking that same thing as well, but wasn't sure whats better performance wise. Also I'm confused on what to do next on the VertexArray Texture; I have this:

    list<sf::VertexArray> setTile;
    list<sf::VertexArray>::iterator iter;

    sf::VertexArray Square(sf::Quads, 4);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);
 

But I don't know what to put after that, I'm following the tutorial in the docs but i'm just confused as to how to apply it to my current program as i'm not using a class and I dont want to right now.

Full code:

#include <SFML/Graphics.hpp>
#include <iostream>
#include <list>

using namespace std;

sf::Texture spriteSheetTexture;
sf::Sprite spriteSheet;
//if(!spriteSheetTexture.loadFromFile(""))
//{

//}

void LoadSpriteSheet()
{

}

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Tile Editor");
    sf::Event event;
    sf::Mouse mouse;
    sf::View scrollScreen;

    list<sf::VertexArray> setTile;
    list<sf::VertexArray>::iterator iter;

    sf::VertexArray Square(sf::Quads, 4);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);


    scrollScreen.reset(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
    scrollScreen.setViewport(sf::FloatRect(0, 0, 1.0f, 1.0f));

    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {
            switch(event.type)
            {
                case sf::Event::Closed:
                {
                    window.close();
                }break;
                case sf::Event::Resized:
                {
                    sf::FloatRect viewArea(0, 0, event.size.width, event.size.height);
                    window.setView(sf::View(viewArea));
                }
            }
        }
    window.clear(sf::Color::White);

    //Convert Pixels to new screen size
    sf::Vector2i pixel_pos = sf::Mouse::getPosition(window);
    sf::Vector2f coord_pos = window.mapPixelToCoords(pixel_pos);


    sf::Texture blankGridTexture;
    sf::Sprite blankGridSprite;
    if(!blankGridTexture.loadFromFile("Resources/Tiles/Sign.png"))
    {

    }
    blankGridSprite.setTexture(blankGridTexture);
    blankGridSprite.setOrigin(16, 16);

    //Load Grass
    sf::Texture tileTexture;
    sf::Sprite tileSprite;
    if(!tileTexture.loadFromFile("Resources/Tiles/Grass.png"))
    {

    }
    tileSprite.setTexture(tileTexture);
    tileSprite.setOrigin(16, 16);

    sf::Vector2f Grid(30, 30);

    Grid.x = 30;
    Grid.y = 30;

    if(sf::Event::KeyPressed)
    {
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
        {
            scrollScreen.move(-1, 0);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::D))
        {
            scrollScreen.move(1, 0);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::W))
        {
            scrollScreen.move(0, -1);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::S))
        {
            scrollScreen.move(0, 1);
        }
    }

    //Draw Grid
    for(int i = 0; i < Grid.x; i++)
    {
        for(int j = 0; j < Grid.y; j++)
        {
            blankGridSprite.setPosition(j * 32, i * 32); // <- this is causing 1 grass tile and 1 sign tile to appear randomly
            window.draw(blankGridSprite);
        }
    }

    //Set tiles on grid - setMapTileSprite
    if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        //Get Position of the mouse then divide by 32 and round down to integer, then times it by 32 to set grid.
        tileSprite.setPosition(rint(coord_pos.x / 32) * 32, rint(coord_pos.y / 32) * 32);
        blankGridSprite.setTexture(tileTexture);
    }
    setTile.push_back(Square);

    iter = setTile.begin();

    while(iter != setTile.end())
    {
        window.draw(*iter);
        iter++;
    }

    window.setView(scrollScreen);
    window.draw(Square, &tileTexture);
    window.display();
    }

    return 0;
}
 

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #20 on: August 27, 2014, 02:43:19 pm »
Alright I thought this would work but i't didnt, I cant figure out how to get the vertex array to replace the tileSprite since its not a sprite I cant draw it to the screen with the mouse which is what I need to do.

#include <SFML/Graphics.hpp>
#include <iostream>
#include <list>

using namespace std;

sf::Texture spriteSheetTexture;
sf::Sprite spriteSheet;
//if(!spriteSheetTexture.loadFromFile(""))
//{

//}

void LoadSpriteSheet()
{

}

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Tile Editor");
    sf::Event event;
    sf::Mouse mouse;
    sf::View scrollScreen;

    list<sf::VertexArray> setTile;
    list<sf::VertexArray>::iterator iter;

    sf::VertexArray Square(sf::Quads, 4);
    sf::RenderStates states;

    Square[0].position = sf::Vector2f(0, 0);
    Square[1].position = sf::Vector2f(32, 0);
    Square[2].position = sf::Vector2f(32, 32);
    Square[3].position = sf::Vector2f(0, 32);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);


    scrollScreen.reset(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
    scrollScreen.setViewport(sf::FloatRect(0, 0, 1.0f, 1.0f));

    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {
            switch(event.type)
            {
                case sf::Event::Closed:
                {
                    window.close();
                }break;
                case sf::Event::Resized:
                {
                    sf::FloatRect viewArea(0, 0, event.size.width, event.size.height);
                    window.setView(sf::View(viewArea));
                }
            }
        }
    window.clear(sf::Color::White);

    //Convert Pixels to new screen size
    sf::Vector2i pixel_pos = sf::Mouse::getPosition(window);
    sf::Vector2f coord_pos = window.mapPixelToCoords(pixel_pos);


    sf::Texture blankGridTexture;
    sf::Sprite blankGridSprite;
    if(!blankGridTexture.loadFromFile("Resources/Tiles/Sign.png"))
    {

    }
    blankGridSprite.setTexture(blankGridTexture);
    blankGridSprite.setOrigin(16, 16);

    //Load Grass
    sf::Texture tileTexture;
    sf::Sprite tileSprite;
    if(!tileTexture.loadFromFile("Resources/Tiles/Grass.png"))
    {

    }
    tileSprite.setTexture(tileTexture);
    tileSprite.setOrigin(16, 16);

    states.texture = &tileTexture;

    sf::Vector2f Grid(30, 30);

    Grid.x = 30;
    Grid.y = 30;

    if(sf::Event::KeyPressed)
    {
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
        {
            scrollScreen.move(-1, 0);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::D))
        {
            scrollScreen.move(1, 0);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::W))
        {
            scrollScreen.move(0, -1);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::S))
        {
            scrollScreen.move(0, 1);
        }
    }

    //Draw Grid
    for(int i = 0; i < Grid.x; i++)
    {
        for(int j = 0; j < Grid.y; j++)
        {
            blankGridSprite.setPosition(j * 32, i * 32); // <- this is causing 1 grass tile and 1 sign tile to appear randomly
            window.draw(blankGridSprite);
        }
    }

    //Set tiles on grid - setMapTileSprite
    if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        //Get Position of the mouse then divide by 32 and round down to integer, then times it by 32 to set grid.
        tileSprite.setPosition(rint(coord_pos.x / 32) * 32, rint(coord_pos.y / 32) * 32);
        blankGridSprite.setTexture(tileTexture);
    }
    setTile.push_back(Square);

    iter = setTile.begin();

    while(iter != setTile.end())
    {
        window.draw(*iter);
        iter++;
    }

    window.setView(scrollScreen);
    window.draw(Square, states);
    window.display();
    }

    return 0;
}
 

smguyk

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: Does SFML delete sprites that are drawn over?
« Reply #21 on: August 27, 2014, 03:14:46 pm »
off-topic but here are a few things I'd like to say

- your sf::Event::Resized case doesn't have a break. also the default statement is missing (it's optional but should always be there and if it's left out on purpose there should be a comment about it)

- is there a reason you are creating the textures/sprites and loading the textures in every loop iteration? put it outside. also there's no error handling

- your input checking is weird. also I recommend you don't mix events and real-time input the way you do in that code

- you should arrange that code better. that includes avoiding global sf variables, using classes / member variables & functions, organising code like input & draw calls instead of scattering it throughout the entire program

- in connection with the above point, in general try to code more object oriented especially in a project like yours

- it's always nice to be consistent in variable naming and code indentation, it will make everything much better. also I personally avoid things like using namespace std, just use std::

if anyone wants to object to any of the above feel free to!
« Last Edit: August 27, 2014, 03:23:01 pm by smguyk »

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #22 on: August 27, 2014, 03:52:04 pm »
"- your sf::Event::Resized case doesn't have a break. also the default statement is missing (it's optional but should always be there and if it's left out on purpose there should be a comment about it)"

Ah, yes thank you for catching that, I always add break and default, but I just threw this together so that i could have an example for them to help me, my actual code looks neat and organized and is in classes.

"- it's always nice to be consistent in variable naming and code indentation, it will make everything much better. also I personally avoid things like using namespace std, just use std:: "

I usually just do using std::cout; etc etc. My code here is pretty sloppy I agree, but like I said I just slapped it together, which is not a good idea but i just did it so I could have a minimal code example to recieve help and once i get what i need working i break it up and neatly integrate it into my programs code, but thank you for your suggestions :)
« Last Edit: August 27, 2014, 03:54:07 pm by Chay Hawk »

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #23 on: August 27, 2014, 04:47:53 pm »
Ok so how do i push this vertex array back into the list? I'm sorry I keep asking for help every single step of the way, usually I can figure stuff out on my own but i'm not working in console anymore so it's a lot harder to do, but the only way to learn, at least for me is to just do it. Having complete working examples helps me to no end as well, because then i can play around with the code and see how it works but the example in the docs section doesnt push anything back into a vector or list so thats why i'm stuck here.

#include <SFML/Graphics.hpp>
#include <iostream>
#include <list>

using namespace std;

sf::Texture spriteSheetTexture;
sf::Sprite spriteSheet;
//if(!spriteSheetTexture.loadFromFile(""))
//{

//}

void LoadSpriteSheet()
{

}

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Tile Editor");
    sf::Event event;
    sf::Mouse mouse;
    sf::View scrollScreen;

    list<sf::VertexArray> setTile;
    list<sf::VertexArray>::iterator iter;


    scrollScreen.reset(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
    scrollScreen.setViewport(sf::FloatRect(0, 0, 1.0f, 1.0f));

    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {
            switch(event.type)
            {
                case sf::Event::Closed:
                {
                    window.close();
                }break;
                case sf::Event::Resized:
                {
                    sf::FloatRect viewArea(0, 0, event.size.width, event.size.height);
                    window.setView(sf::View(viewArea));
                }
            }
        }
    window.clear(sf::Color::White);

    //Convert Pixels to new screen size
    sf::Vector2i pixel_pos = sf::Mouse::getPosition(window);
    sf::Vector2f coord_pos = window.mapPixelToCoords(pixel_pos);

    sf::VertexArray Square(sf::Quads, 4);
    sf::RenderStates states;

    Square[0].position = sf::Vector2f(0, 0);
    Square[1].position = sf::Vector2f(32, 0);
    Square[2].position = sf::Vector2f(32, 32);
    Square[3].position = sf::Vector2f(0, 32);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);


    sf::Texture blankGridTexture;
    sf::Sprite blankGridSprite;
    if(!blankGridTexture.loadFromFile("Resources/Tiles/Sign.png"))
    {

    }
    blankGridSprite.setTexture(blankGridTexture);
    blankGridSprite.setOrigin(0, 0);

    //Load Grass
    sf::Texture tileTexture;
    sf::Sprite tileSprite;
    if(!tileTexture.loadFromFile("Resources/Tiles/Grass.png"))
    {

    }
    tileSprite.setTexture(tileTexture);
    tileSprite.setOrigin(16, 16);

    states.texture = &tileTexture;

    sf::Vector2f Grid(30, 30);

    Grid.x = 30;
    Grid.y = 30;

    if(sf::Event::KeyPressed)
    {
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
        {
            scrollScreen.move(-1, 0);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::D))
        {
            scrollScreen.move(1, 0);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::W))
        {
            scrollScreen.move(0, -1);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::S))
        {
            scrollScreen.move(0, 1);
        }
    }

    //Draw Grid
    for(int i = 0; i < Grid.x; i++)
    {
        for(int j = 0; j < Grid.y; j++)
        {
            blankGridSprite.setPosition(j * 32, i * 32); // <- this is causing 1 grass tile and 1 sign tile to appear randomly
            window.draw(blankGridSprite);
        }
    }

    //Set tiles on grid - setMapTileSprite
    if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        //Get Position of the mouse then divide by 32 and round down to integer, then times it by 32 to set grid.
        states.transform.translate(sf::Vector2f(rint(coord_pos.x / 32) * 32, rint(coord_pos.y / 32) * 32));
        //tileSprite.setPosition(rint(coord_pos.x / 32) * 32, rint(coord_pos.y / 32) * 32);
        blankGridSprite.setTexture(tileTexture);
    }
    setTile.push_back(Square);

    iter = setTile.begin();
    while(iter != setTile.end())
    {
        window.draw(*iter);
        iter++;
    }

    window.setView(scrollScreen);
    window.draw(Square, states);
    window.display();
    }

    return 0;
}
 

Hapax

  • Hero Member
  • *****
  • Posts: 3357
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Does SFML delete sprites that are drawn over?
« Reply #24 on: August 27, 2014, 06:27:41 pm »
What is the list for? The vertex array can display all the tiles, whatever they are (just make sure that all the different tile types are in the same texture/tilesheet), so you just need one vertex array. Have a look at the TileMap example in the tutorial. You can see that every group of four vertices in a vertex array will display a textured quad (assuming you've still set the vertex array's primitive type to sf::Quads).
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #25 on: August 27, 2014, 09:40:06 pm »
Ok I looked at the example, I copied the code into CB and slowly broke it down to try to make it work for me and I couldnt get it working still, the vertex is not drawing to the grid.

#include <SFML/Graphics.hpp>
#include <iostream>
#include <list>

using namespace std;

sf::Texture spriteSheetTexture;
sf::Sprite spriteSheet;
//if(!spriteSheetTexture.loadFromFile(""))
//{

//}

void LoadSpriteSheet()
{

}

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Tile Editor");
    sf::Event event;
    sf::Mouse mouse;
    sf::View scrollScreen;

    scrollScreen.reset(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
    scrollScreen.setViewport(sf::FloatRect(0, 0, 1.0f, 1.0f));


    sf::Texture blankGridTexture;
    sf::Sprite blankGridSprite;
    if(!blankGridTexture.loadFromFile("Sign.png"))
    {

    }
    blankGridSprite.setTexture(blankGridTexture);
    blankGridSprite.setOrigin(0, 0);

    //Load Grass
    sf::Texture tileTexture;
    sf::Sprite tileSprite;
    if(!tileTexture.loadFromFile("Outside_A5.png"))
    {

    }
    tileSprite.setTexture(tileTexture);
    tileSprite.setOrigin(16, 16);

    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {
            switch(event.type)
            {
                case sf::Event::Closed:
                {
                    window.close();
                }break;
                case sf::Event::Resized:
                {
                    sf::FloatRect viewArea(0, 0, event.size.width, event.size.height);
                    window.setView(sf::View(viewArea));
                }
            }
        }
    window.clear(sf::Color::White);

    sf::Vector2i pixel_pos = sf::Mouse::getPosition(window);
    sf::Vector2f coord_pos = window.mapPixelToCoords(pixel_pos);

    sf::VertexArray Square(sf::Quads, 4);
    sf::RenderStates states;

    Square[0].position = sf::Vector2f(0, 0);
    Square[1].position = sf::Vector2f(32, 0);
    Square[2].position = sf::Vector2f(32, 32);
    Square[3].position = sf::Vector2f(0, 32);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);


    states.texture = &tileTexture;

    sf::Vector2f Grid(30, 30);

    if(sf::Event::KeyPressed)
    {
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
        {
            scrollScreen.move(-1, 0);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::D))
        {
            scrollScreen.move(1, 0);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::W))
        {
            scrollScreen.move(0, -1);
        }
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::S))
        {
            scrollScreen.move(0, 1);
        }
    }

    //Draw Grid
    for(int i = 0; i < Grid.x; i++)
    {
        for(int j = 0; j < Grid.y; j++)
        {
            blankGridSprite.setPosition(j * 32, i * 32); // <- this is causing 1 grass tile and 1 sign tile to appear randomly
            window.draw(blankGridSprite);
        }
    }

    //Set tiles on grid - setMapTileSprite
    if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        //Get Position of the mouse then divide by 32 and round down to integer, then times it by 32 to set grid.
        states.transform.translate(sf::Vector2f(rint(coord_pos.x / 32) * 32, rint(coord_pos.y / 32) * 32));
    }

    window.setView(scrollScreen);
    window.draw(Square, states);
    window.display();
    }

    return 0;
}
 
« Last Edit: August 27, 2014, 10:54:15 pm by Chay Hawk »

Hapax

  • Hero Member
  • *****
  • Posts: 3357
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Does SFML delete sprites that are drawn over?
« Reply #26 on: August 27, 2014, 11:55:48 pm »
    Square[0].position = sf::Vector2f(0, 0);
    Square[1].position = sf::Vector2f(32, 0);
    Square[2].position = sf::Vector2f(32, 32);
    Square[3].position = sf::Vector2f(0, 32);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);
 
I assume the second set of Square[] assignments should also be 0, 1, 2, and 3.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #27 on: August 27, 2014, 11:57:07 pm »
Ok i dont think i'm going to use vertex arrays they are just too hard for me right now, also i found out why my program was going slow, it was because i was drawing so many sprites at once. With one click i created 35 sprites and holding it down for 7 seconds i created over 5000 sprites.


EDIT: Yeah I noticed that but changing it did nothing, but thats alright i found a solution to my sprite based tile editor.

Hapax

  • Hero Member
  • *****
  • Posts: 3357
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Does SFML delete sprites that are drawn over?
« Reply #28 on: August 28, 2014, 12:02:14 am »
Vertex arrays are good because they allow you to display multiple things with just one draw() call. They're obviously useful for other reasons too  :P

thats alright i found a solution to my sprite based tile editor.
Are you going to share this solution?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Does SFML delete sprites that are drawn over?
« Reply #29 on: August 28, 2014, 12:11:28 am »
Oh i'm sorry i didnt mean solution i meant problem. I'll upgrade to vertex arrays later, for now sprites are good.

 

anything