Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <SFML/Window.hpp>
- using namespace sf;
- int main(int argc, char** argv[])
- {
- RenderWindow window(sf::VideoMode(800, 600), "Event blocking");
- window.setFramerateLimit(60);
- Texture bgTex;
- bgTex.loadFromFile("background.png");
- RectangleShape bgRect;
- bgRect.setTexture(&bgTex);
- bgRect.setPosition(0, 0);
- Event evt;
- while (window.isOpen())
- {
- while (window.pollEvent(evt))
- {
- if(evt.type == Event::MouseMoved)
- bgRect.setSize(Vector2f(Mouse::getPosition().x, Mouse::getPosition().y));
- }
- window.clear();
- window.draw(bgRect);
- window.display();
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement