CalendarBlock.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef CLOCK_CALENDARBLOCK_HPP
  2. #define CLOCK_CALENDARBLOCK_HPP
  3. #include <cpp3ds/Graphics/Drawable.hpp>
  4. #include <cpp3ds/Graphics/Text.hpp>
  5. #include <cpp3ds/Window/Event.hpp>
  6. #include <cpp3ds/System/Clock.hpp>
  7. #include "TweenObjects.hpp"
  8. #include <TweenEngine/Tween.h>
  9. #include <TweenEngine/TweenManager.h>
  10. #ifndef EMULATION
  11. #include <3ds.h>
  12. #endif
  13. namespace Clock {
  14. class CalendarBlock : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  15. public:
  16. enum PresetDay {
  17. None = 0,
  18. Saturday,
  19. Sunday,
  20. };
  21. void update(float delta);
  22. void setBlockText(cpp3ds::String text);
  23. cpp3ds::String getBlockText();
  24. void setPosition(float posX, float posY);
  25. cpp3ds::Vector2f getPosition();
  26. cpp3ds::Vector2f getSize();
  27. void setSelectedColor(cpp3ds::Color newColor);
  28. cpp3ds::Color getSelectedColor();
  29. void setPreset(PresetDay newPreset);
  30. PresetDay getPreset();
  31. void toggleInverted();
  32. bool isInverted();
  33. void toggleSelected();
  34. bool isSelected();
  35. CalendarBlock();
  36. ~CalendarBlock();
  37. protected:
  38. virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
  39. private:
  40. util3ds::TweenRectangleShape m_calendarBlockDial;
  41. util3ds::TweenRectangleShape m_selectedSquare;
  42. util3ds::TweenText m_textDate;
  43. void changePresets(PresetDay newPreset, bool isInverted);
  44. PresetDay m_presetDay;
  45. bool m_isInverted;
  46. bool m_isSelected;
  47. TweenEngine::TweenManager m_tweenManager;
  48. };
  49. } // namespace Clock
  50. #endif // CLOCK_CALENDARBLOCK_HPP