Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #define W 800
- #define H 600
- #define OFF 10
- int main()
- {
- int xx[]={OFF,OFF,W-OFF,W-OFF,OFF};
- int yy[]={OFF,H-OFF,H-OFF,OFF,OFF};
- int i;
- sf::VertexArray linie(sf::Lines);
- for(i=0;i<4;i++){
- linie.append(sf::Vector2f(xx[i],yy[i]));
- linie.append(sf::Vector2f(xx[i+1],yy[i+1]));
- }
- linie.append(sf::Vector2f(OFF,H/2));
- linie.append(sf::Vector2f(W-OFF,H/2));
- linie.append(sf::Vector2f(W/2,H-OFF));
- linie.append(sf::Vector2f(W/2,OFF));
- sf::VertexArray strzalki(sf::Triangles);
- strzalki.append(sf::Vector2f(W/2-10,OFF+10));
- strzalki.append(sf::Vector2f((W/2),OFF));
- strzalki.append(sf::Vector2f((W/2)+10,OFF+10));
- strzalki.append(sf::Vector2f(W-OFF-10,(H/2)+10));
- strzalki.append(sf::Vector2f(W-OFF,H/2));
- strzalki.append(sf::Vector2f(W-OFF-10,(H/2)-10));
- // Create the main window
- sf::RenderWindow window(sf::VideoMode(W,H), "SFML window");
- // Start the game loop
- while (window.isOpen())
- {
- // Process events
- sf::Event event;
- while (window.pollEvent(event))
- {
- // Close window : exit
- if (event.type == sf::Event::Closed)
- window.close();
- }
- // Clear screen
- window.clear();
- window.draw(linie);
- window.draw(strzalki);
- // Update the window
- window.display();
- }
- return EXIT_SUCCESS;
- }
Add Comment
Please, Sign In to add comment