DialogState.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef FREESHOP_DIALOGSTATE_HPP
  2. #define FREESHOP_DIALOGSTATE_HPP
  3. #include <cpp3ds/Window/Window.hpp>
  4. #include <TweenEngine/TweenManager.h>
  5. #include "State.hpp"
  6. #include "../TweenObjects.hpp"
  7. #include "../GUI/Scrollable.hpp"
  8. #include "../GUI/ScrollBar.hpp"
  9. namespace FreeShop {
  10. class DialogState: public State, public Scrollable {
  11. public:
  12. enum EventType {
  13. GetText,
  14. GetTitle,
  15. Response,
  16. };
  17. struct Event {
  18. EventType type;
  19. void *data;
  20. };
  21. DialogState(StateStack& stack, Context& context, StateCallback callback);
  22. virtual void renderTopScreen(cpp3ds::Window& window);
  23. virtual void renderBottomScreen(cpp3ds::Window& window);
  24. virtual bool update(float delta);
  25. virtual bool processEvent(const cpp3ds::Event& event);
  26. virtual void setScroll(float position);
  27. virtual float getScroll();
  28. virtual const cpp3ds::Vector2f &getScrollSize();
  29. private:
  30. bool m_isClosing;
  31. bool m_finishedFadeIn;
  32. util3ds::TweenRectangleShape m_overlay;
  33. util3ds::TweenNinePatch m_background;
  34. util3ds::TweenText m_message;
  35. util3ds::TweenText m_title;
  36. TweenEngine::TweenManager m_tweenManager;
  37. util3ds::TweenRectangleShape m_buttonOkBackground;
  38. util3ds::TweenRectangleShape m_buttonCancelBackground;
  39. util3ds::TweenText m_buttonOkText;
  40. util3ds::TweenText m_buttonCancelText;
  41. util3ds::TweenableView m_bottomView;
  42. bool m_isOkButtonTouched;
  43. bool m_isCancelButtonTouched;
  44. ScrollBar m_scrollbar;
  45. cpp3ds::Vector2f m_scrollSize;
  46. float m_scrollPos;
  47. };
  48. } // namespace FreeShop
  49. #endif // FREESHOP_DIALOGSTATE_HPP