5daad4bc
xiaoyu
游戏源码添加编译(现存问题:游戏内...
|
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
//
// IMapControlInterface.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 17.05.2017.
//
//
#ifndef IMapControlInterface_h
#define IMapControlInterface_h
#include "cocos2d.h"
class IMapControl;
class IMapControlInterface {
friend class IMapControl;
public:
struct IMapControlEventData {
IMapControlEventData(int p_eventId) : eventId(p_eventId){};
int eventId {-1};
};
struct IMapControlSingleXYEventData : IMapControlEventData {
IMapControlSingleXYEventData(int p_eventId, cocos2d::Point p_touchPoint, cocos2d::Point p_previousTouchPoint, cocos2d::Point p_initialPoint) : IMapControlEventData(p_eventId), screenPointPrevious(p_previousTouchPoint), screenPointCurrent(p_touchPoint), screenPointInitial(p_initialPoint){}
cocos2d::Point screenPointPrevious;
cocos2d::Point screenPointCurrent;
cocos2d::Point screenPointInitial;
};
typedef int IMapControlSwipeDirection;
struct IMapControlSwipeEventData : IMapControlEventData {
IMapControlSwipeEventData(int p_eventId, cocos2d::Point p_startLocation, cocos2d::Point p_endLocation, cocos2d::Vec2 p_speed, IMapControlSwipeDirection p_directionX, IMapControlSwipeDirection p_directionY) : IMapControlEventData(p_eventId), startLocation(p_startLocation), endLocation(p_endLocation), speed(p_speed), directionX(p_directionX), directionY(p_directionY){}
cocos2d::Point startLocation;
cocos2d::Point endLocation;
cocos2d::Vec2 speed;
IMapControlSwipeDirection directionX; // > 0 for right
IMapControlSwipeDirection directionY; // > 0 for up
};
virtual void handleCommandSingleXYPress(const IMapControlSingleXYEventData& eventData) = 0;
virtual void handleCommandSingleXYMove(const IMapControlSingleXYEventData& eventData) = 0;
virtual void handleCommandSingleXYRelease(const IMapControlSingleXYEventData& eventData) = 0;
virtual void handleCommandMultipleXYPress(const std::vector<IMapControlSingleXYEventData>& eventData) = 0;
virtual void handleCommandMultipleXYMove(const std::vector<IMapControlSingleXYEventData>& eventData) = 0;
virtual void handleCommandMultipleXYRelease(const std::vector<IMapControlSingleXYEventData>& eventData) = 0;
virtual void handleCommandSingleXYLongPress(const IMapControlSingleXYEventData& eventData) = 0;
virtual void handleCommandSingleXYTap(const IMapControlSingleXYEventData& eventData) = 0;
virtual void handleCommandFastSwipe(const IMapControlSwipeEventData& eventData) = 0;
virtual void handleCommandTicklingStarted() = 0;
virtual void handleCommandTicklingContinued() = 0;
virtual void handleCommandTicklingEnded() = 0;
virtual ~IMapControlInterface(){};
protected:
IMapControl* m_mapControl {nullptr};
};
using IMapControlEventData = IMapControlInterface::IMapControlEventData;
using IMapControlSingleXYEventData = IMapControlInterface::IMapControlSingleXYEventData;
using IMapControlSwipeEventData = IMapControlInterface::IMapControlSwipeEventData;
#endif /* IMapControlInterface_h */
|