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

Pages: [1]
1
I've gone through many of the tutorials however I have been confused on how vertex arrays work for a while now, you've cleared that confusion up for me so thank you.

2
I've currently made a tilemap that is fed into a vertex array, I used the example from the Vertex Array sfml tutorial. From my understanding, a vertex array is filled with textures which then turn the entire vertex array into one WHOLE texture? so instead of writing to the screen and rendering the entire map with a for loop, it does it once and stores it into an array which can then just be printed to the screen?

I'm trying to understand what a vertex array is actually doing and why it is so nice for tile maps.
Thank you.

3
Thats what I thought. I was trying to save the individual node within an STL List. I wanted to be able to capture the nodes address and edit it, however just using "it" (even though its a pointer..) did not work. On stack overflow someone said you have to do &*it, which yeah makes no sense to me, but it worked.

4
Yeah woops forgot to include that! However I fixed the issue, you need to access it by grabbing the address of it dereferenced.

&*it;

5
I understand that lists don't offer random access [], and you have to use an iterator, but how do you access the properties of that iterator?

For example:
                for (std::list<sf::VertexArray>::iterator it = vertexManager.begin(); it != vertexManager.end(); it++)
                {
                        // DO STUFF HERE
                           
                }
In the //DO STUFF HERE,
  I've tried.... 
- (*it)[0].position
- it[0].position
- it[0]->position
- (*it)[0].position

but I can't seem to access any properties.. thanks!

6
Thanks a ton, I actually understand this now finally

7
Ah okay, so how does it work though if I'm constantly making it use the event handler? (For example I had an event that detected for mouse movement) and I was moving my mouse all over the screen WHILE using WASD to move my character ( which is input being detected outside the loop).

8
Hello,
I'm completely new to SFML and have just begun reading the docs and messing around. I've noticed that I can run my event handler loop and check for events, while outside the loop other things are going on.
How does this loop not stop the program from continuing?

For example:
        // Event handler
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::MouseMoved)
                       
                        {
                                triangle[2].position = sf::Vector2f(event.mouseMove.x, event.mouseMove.y);
                        }
                }

                // Input
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
                        {
                                player.move(0, -speed);
                        }
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
                        {
                                player.move(-speed, 0);
                        }
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
                        {
                                player.move(0, speed);
                        }
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
                        {
                                player.move(speed, 0);
                        }

I can move my mouse around AND control keyboard inputs at the same exact time. How does it read that outside the event loop?

Thanks!

Pages: [1]
anything