discord rpc test

This commit is contained in:
Anonymous275
2022-01-18 14:27:20 +02:00
parent af29edb301
commit 656e0e540f
3 changed files with 6 additions and 3 deletions

View File

@@ -5,13 +5,13 @@
#include <discord_rpc.h>
#include "Launcher.h"
#include "Logger.h"
void Launcher::richPresence() {
Discord_Initialize("629743237988352010", nullptr, 1,nullptr);
while(!Shutdown) {
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
if(DiscordMessage.empty()) DiscordMessage = "Playing with friends!";
discordPresence.state = DiscordMessage.c_str();
discordPresence.startTimestamp = 0;
discordPresence.largeImageKey = "mainlogo";

View File

@@ -9,13 +9,14 @@
#include <windows.h>
#include <shellapi.h>
Launcher::Launcher(int argc, char* argv[]) : DirPath(argv[0]) {
Launcher::Launcher(int argc, char* argv[]) : DirPath(argv[0]), DiscordMessage("Just launched") {
DirPath = DirPath.substr(0, DirPath.find_last_of("\\/") + 1);
Log::Init();
WindowsInit();
}
Launcher::~Launcher() {
Shutdown = true;
if(DiscordRPC.joinable()) {
DiscordRPC.join();
}

View File

@@ -7,9 +7,11 @@
#include "Logger.h"
int main(int argc, char* argv[]) {
Launcher launcher(argc, argv);
launcher.runDiscordRPC();
launcher.loadConfig();
launcher.checkKey();
//UI call
std::this_thread::sleep_for(std::chrono::seconds(50));
LOG(INFO) << "Shutting down";
return 0;
}