Rise
The Vieneo Province
Loading...
Searching...
No Matches
SteamRichPresence.cpp
Go to the documentation of this file.
1#include "SteamRichPresence.h"
3#include "Logger.h"
5
10
11void SteamRichPresence::Update(const char* details, const char* state, const char* screen)
12{
13 if (!enabled)
14 return;
15
16 auto friends = SteamFriends();
17 const bool result = friends && RiseSteam::PublishPresence(*friends, RiseSteam::BuildPresence(details, state, screen));
18 if (!hasResult || result != lastResult)
19 {
20 logger->Log(result ? "Steam: Rich Presence accepted" : "Steam: Could not update Rich Presence",
22 hasResult = true;
23 lastResult = result;
24 }
25}
26
28{
29 // DiscordIntegration is destroyed before HMI shuts down the Steam API.
30 if (enabled)
31 {
32 if (auto friends = SteamFriends())
33 friends->ClearRichPresence();
34 }
35}
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
@ Info
Definition Logger.h:25
@ Warn
Definition Logger.h:26
SteamRichPresence(bool enabled, Logger *logger)
void Update(const char *details, const char *state, const char *screen=nullptr)
ISteamFriends * SteamFriends()
bool PublishPresence(Friends &friends, const PresencePayload &payload)
PresencePayload BuildPresence(const char *details, const char *state, const char *screen=nullptr)