ToyProgressSliderNode.h
1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// 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<void()> 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 */