TestProgressBar.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include "test.h"
  3. #include "ProgressBar.h"
  4. class TestProgressBar: public Test
  5. {
  6. public:
  7. spProgressBar bar;
  8. TestProgressBar()
  9. {
  10. addButton("0", "dir: 0");
  11. addButton("90", "dir: 90");
  12. addButton("180", "dir: 180");
  13. addButton("270", "dir: 270");
  14. addButton("radial_cw", "dir: radial_cw");
  15. //addButton("radial_ccw", "dir: radial_ccw");
  16. bar = new ProgressBar();
  17. bar->setResAnim(resources.getResAnim("bg"));
  18. bar->setAnchor(Vector2(0.5f, 0.5f));
  19. bar->setPosition(getSize() / 2);
  20. //bar->setSize(600, 200);
  21. content->addChild(bar);
  22. }
  23. void clicked(string id)
  24. {
  25. bar->setProgress(0);
  26. if (id == "0")
  27. {
  28. bar->setDirection(ProgressBar::dir_0);
  29. }
  30. if (id == "90")
  31. {
  32. bar->setDirection(ProgressBar::dir_90);
  33. }
  34. if (id == "180")
  35. {
  36. bar->setDirection(ProgressBar::dir_180);
  37. }
  38. if (id == "270")
  39. {
  40. bar->setDirection(ProgressBar::dir_270);
  41. }
  42. /*
  43. if (id == "radial_ccw")
  44. {
  45. bar->setDirection(ProgressBar::dir_radial_ccw);
  46. }
  47. */
  48. if (id == "radial_cw")
  49. {
  50. bar->setDirection(ProgressBar::dir_radial_cw);
  51. }
  52. bar->addTween(ProgressBar::TweenProgress(1.0f), 1000);
  53. }
  54. };