// // TimeSliderNode.h // WattsenglishToyApp // // Created by Katarzyna Kalinowska-Górska on 27/12/2019. // #ifndef ToyProgressSliderNode_h #define ToyProgressSliderNode_h #include "cocos2d.h" #include "ToyLayoutObject.h" #include "ToyTimeIndicatorInterface.h" class ToyProgressSliderNode : public cocos2d::Node, public ToyLayoutObject, public ToyTimeIndicatorInterface { public: static ToyProgressSliderNode* create(const std::string& sliderImageFilePath, const std::string& thumbImageFilePath, float minVal, float maxVal); virtual bool init(const std::string& sliderImageFilePath, const std::string& thumbImageFilePath, float minVal, float maxVal); virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, ToyLayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; // ToyScenarioObject virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) override; virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}) override; // slider's own methods virtual void setProgressFrac(float progressFrac) override; virtual void setProgress(float progress) override; virtual float currentProgress() { return _currentValue;}; virtual void startTimeAnimation(float timeDuration) override; virtual void stopTimeAnimation() override; protected: cocos2d::Sprite* _sliderSprite; cocos2d::Sprite* _thumbSprite; float _minValue; float _maxValue; float _currentValue; virtual void updateProgressUI(float value); }; #endif /* TimeSliderNode_h */