InstalledItem.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. bool hasUpdates() { return !m_updates.empty(); }
  19. bool hasDLC() { return !m_dlc.empty(); }
  20. std::shared_ptr<AppItem> getAppItem() const;
  21. void setHeight(float height);
  22. float getHeight() const;
  23. std::map<cpp3ds::Uint64, bool> &getUpdates() { return m_updates; };
  24. std::map<cpp3ds::Uint64, bool> &getDLC() { return m_dlc; };
  25. void processEvent(const cpp3ds::Event& event);
  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. private:
  31. float m_height;
  32. cpp3ds::Uint64 m_titleId;
  33. gui3ds::NinePatch m_background;
  34. std::map<cpp3ds::Uint64, bool> m_updates;
  35. std::map<cpp3ds::Uint64, bool> m_dlc;
  36. size_t m_updateInstallCount;
  37. size_t m_dlcInstallCount;
  38. cpp3ds::Text m_textTitle;
  39. util3ds::TweenText m_textWarningUpdate;
  40. util3ds::TweenText m_textWarningDLC;
  41. std::shared_ptr<AppItem> m_appItem;
  42. };
  43. } // namespace FreeShop
  44. #endif // FREESHOP_INSTALLEDITEM_HPP