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

Pages: [1]
1
Graphics / Re: repeating part of a texture in a vertex array
« on: June 24, 2022, 04:48:52 pm »
thanks for the reply, how would i do this if im using a tileset

2
Graphics / repeating part of a texture in a vertex array
« on: June 24, 2022, 03:27:57 am »
So im pretty new to SFML. i've been trying to get a section of a tileset to repeat in a vertex array but it just stretches it, any one know a solution if so that would be a great help.

sf::Texture tileset;
        tileset.loadFromFile("assets\\platform\\tiles and background_foreground (new)\\tileset.png");
        tileset.setRepeated(true);
       
        sf::VertexArray grass(sf::Quads, 4);
        grass[0].position = sf::Vector2f(0, 500);
        grass[1].position = sf::Vector2f(1024, 500);
        grass[2].position = sf::Vector2f(1024, 720);
        grass[3].position = sf::Vector2f(0, 720);

        grass[0].texCoords = sf::Vector2f(16, 0);
        grass[1].texCoords = sf::Vector2f(32, 0);
        grass[2].texCoords = sf::Vector2f(32, 16);
        grass[3].texCoords = sf::Vector2f(16, 16);

Pages: [1]