AppStats.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef FREESHOP_APPSTATS_HPP
  2. #define FREESHOP_APPSTATS_HPP
  3. #include <cpp3ds/Graphics/Drawable.hpp>
  4. #include <cpp3ds/Graphics/Text.hpp>
  5. #include <cpp3ds/Window/Event.hpp>
  6. #include <cpp3ds/System/Clock.hpp>
  7. #include "TweenObjects.hpp"
  8. #include "TitleKeys.hpp"
  9. #include "AppItem.hpp"
  10. #include <TweenEngine/Tween.h>
  11. #include <TweenEngine/TweenManager.h>
  12. #include <memory>
  13. #ifndef EMULATION
  14. #include <3ds.h>
  15. #endif
  16. namespace FreeShop {
  17. class AppStats : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  18. public:
  19. void drawTop(cpp3ds::Window &window);
  20. bool processEvent(const cpp3ds::Event& event);
  21. void update(float delta);
  22. void loadApp(std::shared_ptr<AppItem> appItem, const rapidjson::Value &jsonStarRating);
  23. void loadPreferences(const rapidjson::Value &jsonPreferences);
  24. void setVisible(bool isVisible);
  25. bool isVisible();
  26. AppStats();
  27. ~AppStats();
  28. protected:
  29. virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
  30. private:
  31. bool m_isVisible;
  32. util3ds::TweenRectangleShape m_overlay;
  33. util3ds::TweenRectangleShape m_topBackground;
  34. util3ds::TweenRectangleShape m_botBackground;
  35. util3ds::TweenableView m_topView;
  36. util3ds::TweenableView m_bottomView;
  37. // Top screen
  38. util3ds::TweenText m_statText;
  39. // Rating related stuff
  40. std::vector<int> m_stars;
  41. std::vector<util3ds::TweenText> m_starsText;
  42. std::vector<util3ds::TweenText> m_ratings;
  43. std::vector<util3ds::TweenRectangleShape> m_progressRatings;
  44. std::vector<util3ds::TweenRectangleShape> m_progressRatingsBackground;
  45. int m_votes;
  46. float m_finalScore;
  47. util3ds::TweenText m_finalScoreText;
  48. util3ds::TweenText m_textAverageScore;
  49. util3ds::TweenText m_voteCount;
  50. util3ds::TweenText m_voteCountUserIcon;
  51. // Bottom screen
  52. util3ds::TweenText m_preferenceText;
  53. // Type of player and play style stuff
  54. util3ds::TweenText m_textPlayerType;
  55. util3ds::TweenRectangleShape m_barEveryone;
  56. util3ds::TweenRectangleShape m_barGamers;
  57. util3ds::TweenText m_textEveryone;
  58. util3ds::TweenText m_textGamers;
  59. int m_percentageEveryone;
  60. int m_percentageGamers;
  61. util3ds::TweenText m_textPlayStyle;
  62. util3ds::TweenRectangleShape m_barCasual;
  63. util3ds::TweenRectangleShape m_barIntense;
  64. util3ds::TweenText m_textCasual;
  65. util3ds::TweenText m_textIntense;
  66. int m_percentageCasual;
  67. int m_percentageIntense;
  68. std::shared_ptr<AppItem> m_appItem;
  69. TweenEngine::TweenManager m_tweenManager;
  70. };
  71. } // namespace FreeShop
  72. #endif // FREESHOP_APPSTATS_HPP