TopInformations.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef FREESHOP_TOPINFORMATIONS_HPP
  2. #define FREESHOP_TOPINFORMATIONS_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 "TitleKeys.hpp"
  9. #include <TweenEngine/Tween.h>
  10. #include <TweenEngine/TweenManager.h>
  11. #ifndef EMULATION
  12. #include <3ds.h>
  13. #endif
  14. namespace FreeShop {
  15. class TopInformations : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  16. public:
  17. void update(float delta);
  18. void setCollapsed(bool collapsed);
  19. void setTextMode(int newMode);
  20. void setModeChangeEnabled(bool newMode);
  21. void resetModeTimer();
  22. void wokeUp();
  23. TopInformations();
  24. ~TopInformations();
  25. protected:
  26. virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
  27. private:
  28. util3ds::TweenText m_textClock;
  29. util3ds::TweenText m_textTwoPoints;
  30. cpp3ds::Texture m_textureBattery;
  31. util3ds::TweenSprite m_batteryIcon;
  32. cpp3ds::Texture m_textureSignal;
  33. util3ds::TweenSprite m_signalIcon;
  34. cpp3ds::Clock m_switchClock;
  35. cpp3ds::Clock m_updateClock;
  36. cpp3ds::Clock m_wokeUpClock;
  37. int m_textClockMode;
  38. int m_batteryPercent;
  39. bool m_isCollapsed;
  40. bool m_isTransitioning;
  41. bool m_canTransition;
  42. TweenEngine::TweenManager m_tweenManager;
  43. void updateIcons(std::string timeTextFmt);
  44. bool m_lowBatteryNotified;
  45. bool m_noInternetNotified;
  46. bool m_justWokeUp;
  47. #ifndef EMULATION
  48. Result PTMU_GetAdapterState(u8 *out);
  49. Result MCUHWC_GetBatteryLevel(u8 *out);
  50. #endif
  51. };
  52. } // namespace FreeShop
  53. #endif // FREESHOP_TOPINFORMATIONS_HPP