#pragma once #include class DigitLayerInner : public Pebble::CustomLayer { static constexpr int16_t extraDigits = 2; static constexpr int16_t digitHeight = 56; int16_t digitCount = 10; DigitLayerInner() : Pebble::CustomLayer(Pebble::GRect()) {} static void DrawDigit(const Pebble::GContext& ctx, const Pebble::GRect& bounds, const uint16_t digit); friend class DigitLayer; protected: void OnUpdate(const Pebble::GContext& ctx); }; class DigitLayer : public Pebble::SimpleLayer { DigitLayerInner innerLayer; Pebble::ScrollLayer scrollLayer; public: DigitLayer(); void SetDigitCount(uint16_t cnt = 10) { if (this->innerLayer.digitCount != cnt) { this->innerLayer.digitCount = cnt; this->UpdateLayout(); } } void UpdateLayout(); void RotateTo(uint16_t digit, bool animate=true); private: int16_t ComputeOffset(uint16_t digit); };