blob: 074c6df53541a0b51d52e0a0e1b957de6f7270ad (
plain)
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
|
#pragma once
#include "StarThread.hpp"
#include "StarApplication.hpp"
#include "StarStatisticsService.hpp"
#include "StarP2PNetworkingService.hpp"
#include "StarUserGeneratedContentService.hpp"
#include "StarDesktopService.hpp"
#ifdef STAR_ENABLE_STEAM_INTEGRATION
#include "steam/steam_api.h"
#endif
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
#include "discord/discord.h"
#endif
namespace Star {
STAR_CLASS(PcPlatformServices);
STAR_STRUCT(PcPlatformServicesState);
struct PcPlatformServicesState {
PcPlatformServicesState();
~PcPlatformServicesState();
#ifdef STAR_ENABLE_STEAM_INTEGRATION
STEAM_CALLBACK(PcPlatformServicesState, onGameOverlayActivated, GameOverlayActivated_t, callbackGameOverlayActivated);
bool steamAvailable = false;
#endif
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
bool discordAvailable = false;
// Must lock discordMutex before accessing any of the managers when not inside
// a discord callback.
Mutex discordMutex;
unique_ptr<discord::Core> discordCore;
Maybe<discord::User> discordCurrentUser;
ThreadFunction<void> discordEventThread;
atomic<bool> discordEventShutdown;
#endif
bool overlayActive = false;
};
class PcPlatformServices {
public:
// Any command line arguments that start with '+platform' will be stripped
// out and passed here
static PcPlatformServicesUPtr create(String const& path, StringList platformArguments);
StatisticsServicePtr statisticsService() const;
P2PNetworkingServicePtr p2pNetworkingService() const;
UserGeneratedContentServicePtr userGeneratedContentService() const;
DesktopServicePtr desktopService() const;
// Will return true if there is an in-game overlay active. This is important
// because the cursor must be visible when such an overlay is active,
// regardless of the ApplicationController setting.
bool overlayActive() const;
void update();
private:
PcPlatformServices() = default;
PcPlatformServicesStatePtr m_state;
StatisticsServicePtr m_statisticsService;
P2PNetworkingServicePtr m_p2pNetworkingService;
UserGeneratedContentServicePtr m_userGeneratedContentService;
DesktopServicePtr m_desktopService;
};
}
|