Restructure

This commit is contained in:
CocoSimone
2022-12-22 22:33:43 +01:00
parent ba62db8f12
commit 4adb7a46f8
70 changed files with 554 additions and 582 deletions

42
src/Discord.hpp Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include <discord_rpc.h>
#include <string>
#include <ctime>
namespace util {
enum State {
Idling,
Playing,
Paused
};
inline void UpdateRPC(State state, const std::string& game = "") {
DiscordRichPresence presence{};
std::string textState, textDetails;
switch(state) {
case Idling:
textDetails = "Idling";
break;
case Playing:
textDetails = "In-game";
textState = "Playing \"" + game + "\"";
break;
case Paused:
textDetails = "In-game";
textState = "Playing \"" + game + "\" (Paused)";
break;
}
presence.details = textDetails.c_str();
presence.state = textState.c_str();
presence.startTimestamp = time(nullptr);
presence.largeImageText = "Gadolinium";
presence.largeImageKey = "logo";
Discord_UpdatePresence(&presence);
}
inline void ClearRPC() {
Discord_ClearPresence();
}
}