InstalledItem.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef FREESHOP_INSTALLEDITEM_HPP
  2. #define FREESHOP_INSTALLEDITEM_HPP
  3. #include <TweenEngine/TweenManager.h>
  4. #include <cpp3ds/Window/Event.hpp>
  5. #include "TweenObjects.hpp"
  6. #include "GUI/NinePatch.hpp"
  7. #include "AppItem.hpp"
  8. namespace FreeShop {
  9. class InstalledItem : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  10. public:
  11. static const int HEIGHT = 11; // for tweening
  12. InstalledItem(cpp3ds::Uint64 titleId);
  13. cpp3ds::Uint64 getTitleId() const;
  14. void setUpdateStatus(cpp3ds::Uint64 titleId, bool installed);
  15. void setDLCStatus(cpp3ds::Uint64 titleId, bool installed);
  16. bool getUpdateStatus(cpp3ds::Uint64 titleId) { m_updates[titleId]; }
  17. bool getDLCStatus(cpp3ds::Uint64 titleId) { m_dlc[titleId]; }
  18. std::shared_ptr<AppItem> getAppItem() const;
  19. void setHeight(float height);
  20. float getHeight() const;
  21. std::map<cpp3ds::Uint64, bool> &getUpdates() { return m_updates; };
  22. std::map<cpp3ds::Uint64, bool> &getDLC() { return m_dlc; };
  23. void processEvent(const cpp3ds::Event& event);
  24. protected:
  25. virtual void draw(cpp3ds::RenderTarget &target, cpp3ds::RenderStates states) const;
  26. virtual void setValues(int tweenType, float *newValues);
  27. virtual int getValues(int tweenType, float *returnValues);
  28. private:
  29. float m_height;
  30. cpp3ds::Uint64 m_titleId;
  31. gui3ds::NinePatch m_background;
  32. std::map<cpp3ds::Uint64, bool> m_updates;
  33. std::map<cpp3ds::Uint64, bool> m_dlc;
  34. size_t m_updateInstallCount;
  35. size_t m_dlcInstallCount;
  36. cpp3ds::Text m_textTitle;
  37. util3ds::TweenText m_textWarningUpdate;
  38. util3ds::TweenText m_textWarningDLC;
  39. std::shared_ptr<AppItem> m_appItem;
  40. };
  41. } // namespace FreeShop
  42. #endif // FREESHOP_INSTALLEDITEM_HPP