AppInfo.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef FREESHOP_APPINFO_HPP
  2. #define FREESHOP_APPINFO_HPP
  3. #include <cpp3ds/Graphics/Drawable.hpp>
  4. #include <cpp3ds/Graphics/Texture.hpp>
  5. #include <cpp3ds/Graphics/Sprite.hpp>
  6. #include <TweenEngine/TweenManager.h>
  7. #include <cpp3ds/Window/Event.hpp>
  8. #include "TweenObjects.hpp"
  9. #include "AppItem.hpp"
  10. namespace FreeShop {
  11. class AppInfo : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  12. public:
  13. static const int ALPHA = 11;
  14. AppInfo();
  15. ~AppInfo();
  16. void drawTop(cpp3ds::Window &window);
  17. bool processEvent(const cpp3ds::Event& event);
  18. void update(float delta);
  19. void loadApp(std::shared_ptr<AppItem> appItem);
  20. const std::shared_ptr<AppItem> getAppItem() const;
  21. void setCurrentScreenshot(int screenshotIndex);
  22. protected:
  23. virtual void draw(cpp3ds::RenderTarget &target, cpp3ds::RenderStates states) const;
  24. virtual void setValues(int tweenType, float *newValues);
  25. virtual int getValues(int tweenType, float *returnValues);
  26. void updateInfo();
  27. private:
  28. void setDescription(const rapidjson::Value &jsonDescription);
  29. void setScreenshots(const rapidjson::Value &jsonScreenshots);
  30. void addScreenshot(int index, const rapidjson::Value &jsonScreenshot);
  31. cpp3ds::Sprite m_icon;
  32. cpp3ds::Text m_textTitle;
  33. cpp3ds::Text m_textDescription;
  34. cpp3ds::Text m_textTitleId;
  35. float m_descriptionVelocity;
  36. cpp3ds::RectangleShape m_fadeTextRect;
  37. bool m_isDemoInstalled;
  38. cpp3ds::Text m_textDemo;
  39. cpp3ds::Text m_textIconDemo;
  40. util3ds::TweenText m_textDownload;
  41. util3ds::TweenText m_textDelete;
  42. util3ds::TweenText m_textExecute;
  43. std::vector<std::unique_ptr<cpp3ds::Texture>> m_screenshotTopTextures;
  44. std::vector<std::unique_ptr<cpp3ds::Texture>> m_screenshotBottomTextures;
  45. std::vector<std::unique_ptr<cpp3ds::Sprite>> m_screenshotTops;
  46. std::vector<std::unique_ptr<cpp3ds::Sprite>> m_screenshotBottoms;
  47. int m_currentScreenshot;
  48. util3ds::TweenSprite m_screenshotTopTop;
  49. util3ds::TweenSprite m_screenshotTopBottom;
  50. util3ds::TweenSprite m_screenshotBottom;
  51. util3ds::TweenText m_arrowLeft;
  52. util3ds::TweenText m_arrowRight;
  53. util3ds::TweenText m_close;
  54. cpp3ds::RectangleShape m_screenshotsBackground;
  55. cpp3ds::Text m_textScreenshotsEmpty;
  56. util3ds::TweenText m_textNothingSelected;
  57. cpp3ds::RectangleShape m_fadeRect;
  58. std::shared_ptr<AppItem> m_appItem;
  59. TweenEngine::TweenManager m_tweenManager;
  60. };
  61. } // namepace FreeShop
  62. #endif // FREESHOP_APPINFO_HPP