Guest User

Untitled

a guest
Feb 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include "AnimationManager.hpp"
  2.  
  3. int main()
  4. {
  5. float yPos = 20;
  6. float ySize = 10;
  7.  
  8. float xSize = 300;
  9.  
  10. sf::RectangleShape back;
  11. back.setSize(sf::Vector2f(xSize, ySize));
  12. back.setPosition(0, yPos);
  13. back.setFillColor(sf::Color(230, 230, 230));
  14. back.setOutlineColor(sf::Color(188, 188, 188));
  15. back.setOutlineThickness(1.0f);
  16.  
  17. sf::RectangleShape shape;
  18. shape.setSize(sf::Vector2f(xSize / 5, ySize));
  19. shape.setPosition(sf::Vector2f(xSize / 5, yPos));
  20. shape.setFillColor(sf::Color(6, 176, 37));
  21.  
  22. sf::RenderWindow window(sf::VideoMode(300, 50), "Loading...");
  23.  
  24. PhysicalAnimator ani;
  25.  
  26. while (window.isOpen())
  27. {
  28. sf::Event event;
  29. while (window.pollEvent(event))
  30. {
  31. if (event.type == sf::Event::EventType::Closed)
  32. {
  33. window.close();
  34. }
  35. }
  36.  
  37. if (ani.tasks.empty())
  38. {
  39. shape.setPosition(sf::Vector2f(-shape.getSize().x, shape.getPosition().y));
  40. ani.addTranslationTask(shape, sf::Vector2f(window.getSize().x, shape.getPosition().y), EaseType::CubicEaseInOut, 2000, false);
  41. }
  42.  
  43. ani.Update();
  44.  
  45. window.clear(sf::Color::White);
  46. window.draw(back);
  47. window.draw(shape);
  48. window.display();
  49. }
  50.  
  51. return 0;
  52. }
Add Comment
Please, Sign In to add comment