HTouchInterceptingLayer.h 1.32 KB
//
//  HTouchInterceptingLayer.hpp
//  SteveMaggieCpp
//
//  Created by Katarzyna Kalinowska-Górska on 12.05.2017.
//
//

#ifndef HTouchInterceptingLayer_h
#define HTouchInterceptingLayer_h

#include <stdio.h>
#include "cocos2d.h"

class HTouchInterceptingLayer : public cocos2d::LayerColor {

    public:
    
        static const int TouchEventListenerPriority = -100;
    
        // create
        static HTouchInterceptingLayer * create(const cocos2d::Color4B& color, bool sceneGraphPriority = true);

        // init
        virtual bool initWithColor(const cocos2d::Color4B& color, bool sceneGraphPriority = true);
        virtual void configureTouchListener(bool sceneGraphPriority = true);
    
        // setters
        virtual void setOnTouchCallback(const std::function<void(cocos2d::Touch*)>& onTouchCallback);
        virtual void setOnTouchMovedCallback(const std::function<void(cocos2d::Touch*)>& onTouchCallback);
        virtual void setOnTouchEndedCallback(const std::function<void(cocos2d::Touch*)>& onTouchCallback);
        virtual void clearTouchHandlers();

    protected:
    
        std::function<void(cocos2d::Touch*)> _onTouchCallback;
        std::function<void(cocos2d::Touch*)> _onTouchMovedCallback;
        std::function<void(cocos2d::Touch*)> _onTouchEndedCallback;

};

#endif /* HTouchInterceptingLayer_hpp */