mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-24 00:56:42 +00:00
discord rpc test
This commit is contained in:
@@ -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";
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user