InstalledList.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef FREESHOP_INSTALLEDLIST_HPP
  2. #define FREESHOP_INSTALLEDLIST_HPP
  3. #include <TweenEngine/TweenManager.h>
  4. #include <cpp3ds/Window/Event.hpp>
  5. #include <cpp3ds/System/Mutex.hpp>
  6. #include "InstalledItem.hpp"
  7. #include "InstalledOptions.hpp"
  8. #include "GUI/Scrollable.hpp"
  9. #include "States/BrowseState.hpp"
  10. namespace FreeShop {
  11. class InstalledList : public cpp3ds::Drawable, public Scrollable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  12. public:
  13. static InstalledList &getInstance();
  14. void refresh();
  15. void update(float delta);
  16. bool processEvent(const cpp3ds::Event& event);
  17. virtual void setScroll(float position);
  18. virtual float getScroll();
  19. virtual const cpp3ds::Vector2f &getScrollSize();
  20. static bool isInstalled(cpp3ds::Uint64 titleId);
  21. std::vector<std::unique_ptr<InstalledItem>> &getList() { return m_installedItems; }
  22. protected:
  23. InstalledList();
  24. virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
  25. void repositionItems();
  26. void expandItem(InstalledItem *item);
  27. private:
  28. cpp3ds::Mutex m_mutexRefresh;
  29. bool m_cardInserted;
  30. std::vector<cpp3ds::Uint64> m_installedTitleIds;
  31. std::vector<std::unique_ptr<InstalledItem>> m_installedItems;
  32. TweenEngine::TweenManager m_tweenManager;
  33. float m_scrollPos;
  34. cpp3ds::Vector2f m_size;
  35. InstalledItem *m_expandedItem;
  36. InstalledOptions m_options;
  37. };
  38. } // namespace FreeShop
  39. #endif // FREESHOP_INSTALLEDLIST_HPP