Fission FSN
Loading...
Searching...
No Matches
fsIHardware.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 31/3/2014 11:03
4*
5* File: fsIHardware.h
6*
7* Author: Mick Waites
8*
9* Purpose: Hardware / platform related api
10*
11*********************************************************************/
12
13#ifndef fsIHardwarehdr
14#define fsIHardwarehdr
15
16#include <memory>
17#include <string>
18
19#include <fsCore/fsStr.h>
20#include <fsCore/fsPoint.h>
21
22struct fsDisplayInfo;
23class fsCResourceName;
24
26{
27public:
28
36
37#if defined fsDesktop
38 virtual void hardwareCursorInit() = 0;
39 virtual void hardwareCursorUninit() = 0;
40 virtual void hardwareCursorChange(const fsStr& pID) = 0;
41 virtual void appMinimize() = 0;
42 virtual void appMaximize() = 0;
43 virtual void windowedDisplayModeSet(fsS32 pWidth, fsS32 pHeight, fsS32 pRefresh, fsBool pFullScreen) {};
44 virtual void windowedDisplayModesEnumerate(fsDisplayInfo*& pAvailableModeList, fsS32& pNumModesInList) = 0;
45
46 virtual void appHideEnable() {}
47#endif
48
49 virtual void cursorPosSet(const fsVec2d& pPos) {};
50
51 virtual void hardwareCursorEnabledSet(fsBool pEnabled) const = 0;
52
53 virtual void hardwareCursorSet(const fsCResourceName& pFilename, fsBool pFlipped) {};
54
55 void freeMemoryReset();
57
58 // True once the desktop shows the picture; false where it failed or there is no desktop.
59 fsBool wallpaperApply(const fsCResourceName& pWallpaper);
60 // The same for a picture made at run time (PNG or JPEG bytes). pName names the file the desktop is given;
61 // desktops cache pictures by path, so a different picture needs a different name.
62 fsBool wallpaperBytesApply(const fsStr& pName, const std::string& pBytes);
63 // The main desktop's size in pixels, for a wallpaper made to fit it; (0, 0) where unknown.
64 virtual fsPoint desktopResolutionGet() const { return fsPoint(0, 0); }
65
66 void update(fsS32 pDeltaMs);
67
68
69 virtual void timeScaleSet(fsF32 pScale) = 0;
70
71 virtual void engineCacheFlush() const {};
72
73 virtual fsS32 volumeGet() const { return 0; }
74
75 virtual fsPoint currentDisplayModeResolutionGet() const { return fsPoint(0, 0); }
76
77 virtual fsBool smallDeviceGet() const = 0;
78
79 virtual fsU64 utcTimeGet() const = 0;
80 virtual ePlatform platformGet() const = 0;
81
82 virtual fsStr sdkVersionStringGet() const = 0;
83
84 virtual fsStr appDataFolderGet() const = 0;
85 virtual fsBool multipleAppInstances() const = 0;
86 virtual fsBool processRunning(const fsStr& pProcessName) const = 0;
87
88 virtual void browserLaunch(const fsStr& pUrl) const = 0;
89 virtual fsBool windowedModePossibleGet() const = 0;
90
91 static std::unique_ptr<fsIHardware> create();
92
93 virtual ~fsIHardware();
94
95protected:
96
97 virtual fsU32 freeMemoryResetDo() { return 0; }
98 virtual fsU32 freeMemoryPercentageGetDo() const { return 0; }
99
100#if defined fsDesktop
101 virtual fsBool wallpaperApplyDo(const fsCResourceName& pWallpaper) = 0;
102 virtual fsBool wallpaperBytesApplyDo(const fsStr& pName, const std::string& pBytes) { (void)pName; (void)pBytes; return false; }
103#endif
104
105 virtual void rndSeedDo() const = 0;
106
107 virtual void updateDo(fsS32 pDeltaMs) {}
108
109 fsIHardware();
110
111private:
112
113 void rndSeed() const;
114
115 fsU32 mLowestFreeMemory;
116};
117
118#endif
Definition fsCResourceName.h:32
fsBool wallpaperBytesApply(const fsStr &pName, const std::string &pBytes)
Definition fsIHardware.cpp:48
virtual void hardwareCursorEnabledSet(fsBool pEnabled) const =0
virtual ~fsIHardware()
Definition fsIHardware.cpp:89
fsIHardware()
Definition fsIHardware.cpp:85
void freeMemoryReset()
Definition fsIHardware.cpp:24
virtual void updateDo(fsS32 pDeltaMs)
Definition fsIHardware.h:107
virtual fsS32 volumeGet() const
Definition fsIHardware.h:73
virtual fsStr sdkVersionStringGet() const =0
virtual fsPoint desktopResolutionGet() const
Definition fsIHardware.h:64
virtual void timeScaleSet(fsF32 pScale)=0
virtual fsBool smallDeviceGet() const =0
virtual fsBool multipleAppInstances() const =0
virtual void engineCacheFlush() const
Definition fsIHardware.h:71
virtual fsBool windowedModePossibleGet() const =0
ePlatform
Definition fsIHardware.h:30
@ eOSX
Definition fsIHardware.h:32
@ eMOBILE
Definition fsIHardware.h:33
@ eWINDOWS
Definition fsIHardware.h:31
@ eWINUWP
Definition fsIHardware.h:34
void update(fsS32 pDeltaMs)
Definition fsIHardware.cpp:59
virtual fsBool processRunning(const fsStr &pProcessName) const =0
virtual fsStr appDataFolderGet() const =0
fsU32 freeMemoryPercentageGet()
Definition fsIHardware.cpp:29
virtual void rndSeedDo() const =0
virtual void hardwareCursorSet(const fsCResourceName &pFilename, fsBool pFlipped)
Definition fsIHardware.h:53
virtual fsU32 freeMemoryResetDo()
Definition fsIHardware.h:97
virtual void browserLaunch(const fsStr &pUrl) const =0
static std::unique_ptr< fsIHardware > create()
Definition fsIHardware.cpp:64
virtual ePlatform platformGet() const =0
virtual fsU64 utcTimeGet() const =0
fsBool wallpaperApply(const fsCResourceName &pWallpaper)
Definition fsIHardware.cpp:38
virtual fsPoint currentDisplayModeResolutionGet() const
Definition fsIHardware.h:75
virtual void cursorPosSet(const fsVec2d &pPos)
Definition fsIHardware.h:49
virtual fsU32 freeMemoryPercentageGetDo() const
Definition fsIHardware.h:98
Definition fsStr.h:23
unsigned int fsU32
Definition fsBaseTypes.h:21
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
float fsF32
Definition fsBaseTypes.h:28
unsigned long long fsU64
Definition fsBaseTypes.h:24
Definition fsPoint.h:17
Definition fsVec2d.h:16