AppInfo.hpp 2.5 KB

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