wiktortokumpel

Untitled

Dec 16th, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6. // create the window
  7. sf::RenderWindow window(sf::VideoMode(800, 600), "Choinka");
  8. //sf::CircleShape shape(20.f, 3);
  9. //shape.setFillColor(sf::Color(100, 250, 50));
  10. sf::CircleShape shape(20,4);
  11. shape.setFillColor(sf::Color(170, 170, 40));
  12. //sf::RectangleShape rectangle(sf::Vector2f(120, 50));???
  13.  
  14. sf::RectangleShape line(sf::Vector2f(150, 5));
  15. line.rotate(0);
  16. // define a triangle
  17. sf::CircleShape triangle(80, 3);
  18.  
  19. // define a square
  20. sf::CircleShape square(80, 4);
  21.  
  22. // define an octagon
  23. sf::CircleShape octagon(80, 8);
  24.  
  25. // run the program as long as the window is open
  26. while (window.isOpen())
  27. {
  28. // check all the window's events that were triggered since the last iteration of the loop
  29. sf::Event event;
  30.  
  31. /////////////////////////////////////////////////////
  32. while (window.pollEvent(event))
  33. {
  34. // "close requested" event: we close the window
  35. if (event.type == sf::Event::Closed)
  36. window.close();
  37. }
  38. //////////////////////////////////////////////////////
  39.  
  40. // clear the window with black color
  41. window.clear(sf::Color::Black);
  42.  
  43. // draw everything here...
  44. shape.setOutlineThickness(10);
  45. shape.setOutlineColor(sf::Color::Green);
  46. shape.setPosition(370, 270);
  47.  
  48. //rectangle.setSize(sf::Vector2f(100, 100));???
  49. window.draw(shape);
  50.  
  51. // window.draw(...);
  52. shape.setPosition(370, 300);
  53. shape.setFillColor(sf::Color::Green);
  54. window.draw(shape);
  55.  
  56.  
  57.  
  58.  
  59.  
  60. // end the current frame
  61. window.display();
  62. }
  63.  
  64. return 0;
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment