AniTouchInterceptingLayer.h
1.33 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
//
//  AniTouchInterceptingLayer.hpp
//  SteveMaggieCpp
//
//  Created by Katarzyna Kalinowska-Górska on 12.05.2017.
//
//
#ifndef AniTouchInterceptingLayer_h
#define AniTouchInterceptingLayer_h
#include <stdio.h>
#include "cocos2d.h"
class AniTouchInterceptingLayer : public cocos2d::LayerColor {
    public:
    
        static const int TouchEventListenerPriority = -100;
    
        // create
        static AniTouchInterceptingLayer * 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 /* AniTouchInterceptingLayer_hpp */
