AlarmItem.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef CLOCK_ALARMITEM_HPP
  2. #define CLOCK_ALARMITEM_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 <cpp3ds/Audio/Sound.hpp>
  8. #include <cpp3ds/Audio/Music.hpp>
  9. #include "TweenObjects.hpp"
  10. #include "Chronometer.hpp"
  11. #include "States/State.hpp"
  12. #include "GUI/ScrollBar.hpp"
  13. #include <TweenEngine/Tween.h>
  14. #include <TweenEngine/TweenManager.h>
  15. #ifndef EMULATION
  16. #include <3ds.h>
  17. #endif
  18. namespace Clock {
  19. class AlarmItem : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  20. public:
  21. void update(float delta);
  22. void processEvent(const cpp3ds::Event& event);
  23. AlarmItem(int defaultHour = 0, int defaultMinute = 0, bool isEnabled = false, int index = 0);
  24. ~AlarmItem();
  25. void setPosition(float posX, float posY);
  26. void setAlarmHour(int hour);
  27. void setAlarmMinute(int minute);
  28. int getAlarmHour();
  29. int getAlarmMinute();
  30. void resetAlarmCheck();
  31. void enableAlarm();
  32. void disableAlarm();
  33. bool isAlarmEnabled();
  34. void setIndex(int index);
  35. int getIndex();
  36. void updateTimeTexts();
  37. protected:
  38. virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
  39. int getNumberFromUser(int defaultNumber);
  40. void updateUnit(int *unit);
  41. private:
  42. util3ds::TweenText m_textTimerHours;
  43. util3ds::TweenText m_textTimerMinutes;
  44. util3ds::TweenText m_textHourTwoPoints;
  45. util3ds::TweenRectangleShape m_separator;
  46. util3ds::TweenRectangleShape m_alarmButton;
  47. util3ds::TweenText m_textResetAlarm;
  48. int m_timeHour;
  49. int m_timeMinute;
  50. bool m_checkAlarm;
  51. bool m_isAlarmEnabled;
  52. cpp3ds::Music m_musicLoop;
  53. cpp3ds::Sound m_soundTimerOver;
  54. bool m_hasCustomMusic;
  55. int m_alarmIndex;
  56. TweenEngine::TweenManager m_tweenManager;
  57. };
  58. } // namespace Clock
  59. #endif // CLOCK_ALARMITEM_HPP