// // ToyPaletteComponentSprite.h // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 17.05.2017. // // #ifndef ToyPaletteComponentSprite_h #define ToyPaletteComponentSprite_h #include "ToyPlainSprite.h" class ToyPaletteComponentSprite : public ToyPlainSprite { public: static ToyPaletteComponentSprite* createWithFile(std::string filePath, bool swallowTouches = false); virtual bool initWithFile(std::string filePath, bool swallowTouches = false); virtual bool isChosen(); virtual bool setChosen(bool chosen, bool animated = false, bool silent = false, bool notifyParentPalette = true); virtual void setEnabled(bool isEnabled, bool adjustOpacity, bool animated); virtual cocos2d::Rect getTouchArea(); //warning: only good fo anchor point 0.5,0.5 virtual cocos2d::Color3B getColour(); virtual float getBrushSize(); virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, ToyLayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; // virtual void onEnter() 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; virtual std::string getPropertyAsString(std::string propertyName = "") override; protected: bool _enabled; bool _pressed; bool _chosen; bool _allowChoosing; float _chosenScale; float _pressedScale; float _normalScale; float _chosenRotation; float _normalRotation; int _chosenDepth; int _pressedDepth; int _normalDepth; // TODO this should be a more generic piece of data cocos2d::Color3B _colour; float _brushSize; cocos2d::Size _touchSize; std::string _soundPath; virtual void configureTouchListeners(bool swallowTouches); virtual void notifyParentPalette(); }; #endif /* ToyPaletteComponentSprite_h */