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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/********************************************************************
*
*	File:		fsCInputManager.h
*
*	Purpose:	cocos2dx input manager impl
*
*********************************************************************/

#ifndef fsCInputManagerhdr
#define fsCInputManagerhdr

#include <fsCore/fsBaseTypes.h>

#ifdef AXMOL_V3

#include "v3/fsCInputManager.h"

#else

#include <base/EventListenerMouse.h>
#include <base/EventListenerKeyboard.h>
#include <base/EventListenerTouch.h>
#include <base/EventListenerController.h>
#include <base/EventController.h>

#include "../../fsIInputManager.h"
#include <fsCore/fsStr.h>


class fsCInputManager : public fsIInputManager
{
	friend class fsIInputManager;

public:

	fsS32 pointerTypeGet() const override;
	fsBool hasPhysicalKeyboardGet() const override;

protected:

	void pollKeys() override;

	virtual void stolenInputDo()
	{
	}

	void initialiseDo() override;
	void uninitialiseDo() override;
	fsBool keyDecodeDo(fsS32& pKeyCode) override;

	fsCInputManager();
	virtual ~fsCInputManager();<--- Destructor in derived class

private:

#if (defined(fsDesktop) || defined(fsWeb))
	void mouseListenerCreate();
	fsBool mouseButtonDownEventCallback(axmol::EventMouse* pEvent);
	fsBool mouseButtonUpEventCallback(axmol::EventMouse* pEvent);
	fsBool mouseMoveEventCallback(axmol::EventMouse* pEvent);
    axmol::EventListenerMouse* mMouseListener;
#endif


	void controllerKeyUpEventCallback(ax::Controller* pController, int pKeyCode, axmol::Event* pEvent);
	void controllerKeyDownEventCallback(ax::Controller* pController, int pKeyCode, axmol::Event* pEvent);
	void gamePadListenerCreate();
	
	void keyboardListenerCreate();
	void keyUpEventCallback(axmol::EventKeyboard::KeyCode pKeyCode, axmol::Event* pEvent);
	void keyDownEventCallback(axmol::EventKeyboard::KeyCode pKeyCode, axmol::Event* pEvent);

	void touchListenerCreate();
	fsBool touchStartEventCallback(axmol::Touch* pTouch, axmol::Event* pEvent);
	void touchEndEventCallback(axmol::Touch* pTouch, axmol::Event* pEvent);
	void touchMoveEventCallback(axmol::Touch* pTouch, axmol::Event* pEvent);

	axmol::EventListenerKeyboard* mKeyboardListener;
	axmol::EventListenerTouchOneByOne* mTouchListener;
	axmol::EventListenerController* mGamePadListener;

};

#endif

#endif