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
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103

#include "fsCInputManager.h"
#include "../../src/fsCInputPoint.h"

#include <raylib.h>


void fsCInputManager::pollKeys()
{
	auto pos = ::GetMousePosition();
	if (pos.x != mLastPos.x || pos.y != mLastPos.y)
	{
		mLastPos = pos;
		mInputPoints[0]->onMoveEvent(
			fsPoint(pos.x, pos.y));
	}

	if (::IsMouseButtonPressed(0))
	{
		mInputPoints[0]->onUpDownEvent(
            fsPoint(pos.x, pos.y), true);
	}

	if (::IsMouseButtonReleased(0))
	{
		mInputPoints[0]->onUpDownEvent(
            fsPoint(pos.x, pos.y), false);
	}

	if (auto key = ::GetCharPressed())
	{
		mTypedChars.push_back(key);
	}
	return;
}

fsBool fsCInputManager::hasPhysicalKeyboardGet() const
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
	return true;
#else
	return false;
#endif
}

fsS32 fsCInputManager::pointerTypeGet() const
{
#if defined fsDesktop
	return ePOINTER_TYPE_MOUSE;
#else
	return ePOINTER_TYPE_MULTI_TOUCH;
#endif
}

#if defined fsDesktop

#endif

fsBool fsCInputManager::keyDecodeDo(fsS32& pKeyCode)
{
	return true;
}


#if defined fsDesktop

void fsCInputManager::mouseListenerCreate()<--- Either there is a missing 'override', or the member function 'fsCInputManager::mouseListenerCreate' can be static.
{
}

#endif

void fsCInputManager::keyboardListenerCreate()<--- Either there is a missing 'override', or the member function 'fsCInputManager::keyboardListenerCreate' can be static.
{
}

void fsCInputManager::touchListenerCreate()<--- Either there is a missing 'override', or the member function 'fsCInputManager::touchListenerCreate' can be static.
{
}

void fsCInputManager::initialiseDo()
{
	mMaxInputPoints = 2;

#if defined fsDesktop
	mouseListenerCreate();
#endif

	keyboardListenerCreate();
	touchListenerCreate();
}

void fsCInputManager::uninitialiseDo()
{
}

fsCInputManager::fsCInputManager()
{
}

fsCInputManager::~fsCInputManager()
{
}