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
104
105
106
107
108
109
110
111
112
/********************************************************************
*
*	File:		fsCHardware.h
*
*	Purpose:	Cocos2d-x implementation.
*
*********************************************************************/

#ifndef fsCHardwarehdr
#define fsCHardwarehdr

#include "../../fsIHardware.h"

#if defined fsDesktop
struct GLFWwindow;
struct GLFWcursor;
struct GLFWvidmode;

#if defined fsMacStore
        class fsCHardwareImpl;
#endif
#endif

class fsCHardware : public fsIHardware
{
public:

#if defined fsDesktop
	void hardwareCursorInit() override;
	void hardwareCursorUninit() override;
	void hardwareCursorChange(const fsStr& pID) override;
	void windowedDisplayModesEnumerate(fsDisplayInfo*& pAvailableModeList, fsS32& pNumModesInList) override;
	void appMinimize() override;
	void appMaximize() override;
	void appHideEnable() override;
#endif

	void hardwareCursorEnabledSet(fsBool pEnabled) const override;
	void hardwareCursorSet(const fsCResourceName& pFilename, fsBool pFlipped) override;

	void timeScaleSet(fsF32 pScale) override;
	void engineCacheFlush() const override;

	fsU64 utcTimeGet() const override;

	ePlatform platformGet() const override;

	fsBool smallDeviceGet() const override;

	fsStr sdkVersionStringGet() const override;

	fsStr appDataFolderGet() const override;

	fsBool multipleAppInstances() const override;
	fsBool processRunning(const fsStr& pProcessName) const override;

	fsBool windowedModePossibleGet() const override;

	void browserLaunch(const fsStr& pUrl) const override;

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

protected:

#if defined fsDesktop
	void wallpaperApplyDo(const fsCResourceName& pWallpaper) override;
#endif

	void updateDo(fsS32 pDeltaMs) override;
	void rndSeedDo() const override;

private:

	mutable fsStr mWritableFolder;

#if defined fsPCStore
	fsBool mCursorInClientArea;
#endif

#if defined fsDesktop

	static void enterEvent(GLFWwindow* window, int entered);

	void cursorApply();
	void cursorCreate(fsStr const& pFilename, fsBool pFlipped);
	void cursorClear();

	GLFWcursor* mCursor = nullptr;

	struct SCursor
	{
		SCursor(fsStr const& pFilename) : mFilename(pFilename)
		{
		}

		~SCursor();
		const fsStr mFilename;
		GLFWcursor* mCursor = nullptr;
	};

	fsS32 mWindowWWidth;
	fsS32 mWindowHeight;
	fsBool mWindowFullscreen;

#if defined fsMacStore
        std::unique_ptr<fsCHardwareImpl> mImpl;
#endif
#endif
};

#endif