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

View File

@@ -9,13 +9,14 @@
#include <windows.h> #include <windows.h>
#include <shellapi.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); DirPath = DirPath.substr(0, DirPath.find_last_of("\\/") + 1);
Log::Init(); Log::Init();
WindowsInit(); WindowsInit();
} }
Launcher::~Launcher() { Launcher::~Launcher() {
Shutdown = true;
if(DiscordRPC.joinable()) { if(DiscordRPC.joinable()) {
DiscordRPC.join(); DiscordRPC.join();
} }

View File

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