ToyDraggableBrushSprite.h
1.35 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
//
// ToyDraggableBrushSprite.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 17.05.2017.
//
//
#ifndef ToyDraggableBrushSprite_h
#define ToyDraggableBrushSprite_h
#include "ToyPlainSprite.h"
#include "ToyGeometryUtils.h"
class ToyDraggableBrushSprite : public ToyPlainSprite
{
public:
enum BrushMode {
NONE,
HORIZONTAL
};
const float BRUSH_DEMO_VELOCITY = 160;
static ToyDraggableBrushSprite* create(const std::string& filepath);
virtual bool initWithFile(const std::string& filepath) override;
virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, ToyLayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override;
virtual cocos2d::Rect paintingRect();
virtual ToyGeometryUtils::ThickSegment getSegmentToPaintInRect(cocos2d::Rect rect);
virtual std::vector<ToyGeometryUtils::ThickSegment> getSegmentsToPaint(cocos2d::Rect previousRect, cocos2d::Rect currentRect);
protected:
BrushMode _brushMode;
float _brushThickness;
float _brushWidth;
cocos2d::Point _brushPosition;
std::vector<cocos2d::Point> _demoRoute;
friend class ToyColourableSprite;
};
#endif /* ToyDraggableBrushSprite_h */