-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTouchable.h
More file actions
37 lines (30 loc) · 790 Bytes
/
Touchable.h
File metadata and controls
37 lines (30 loc) · 790 Bytes
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
#ifndef Touchable_hpp
#define Touchable_hpp
#include "cocos2d.h"
#include "CocosGUI.h"
#include "NonCopyable.h"
USING_NS_CC;
using namespace cocos2d::ui;
class Touchable : NonCopyable<Touchable>
{
protected:
static constexpr auto DISABLE_TOUCH_LAYER = "disableTouchLayer";
typedef std::function<void(Ref* ref)> Callback;
static const std::string LONG_TOUCH_KEY;
static const float LONG_TOUCH_SEC;
Touchable()
: _dt(0.0)
{
}
virtual ~Touchable()
{
}
void onLongTouch(Widget* widget, const Callback& action);
void onTouch(Widget* widget, const Callback& action);
void useTouchMaker(Node* node);
void disableTouch(Layer* layer);
void enableTouch(Layer* layer);
private:
float _dt;
};
#endif /* Touchable_h */