2017-06-24 01:04:36 +02:00
|
|
|
#pragma once
|
2017-06-29 18:38:07 +02:00
|
|
|
#include <stdint.h>
|
2017-06-24 01:04:36 +02:00
|
|
|
|
2017-07-18 18:47:33 +02:00
|
|
|
//#define DISCORD_DISABLE_IO_THREAD
|
|
|
|
|
2017-06-30 23:31:48 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct {
|
2017-06-29 17:58:38 +02:00
|
|
|
const char* state;
|
|
|
|
const char* details;
|
2017-06-29 18:38:07 +02:00
|
|
|
int64_t startTimestamp;
|
|
|
|
int64_t endTimestamp;
|
2017-06-29 17:58:38 +02:00
|
|
|
const char* largeImageKey;
|
|
|
|
const char* largeImageText;
|
|
|
|
const char* smallImageKey;
|
|
|
|
const char* smallImageText;
|
2017-06-24 01:04:36 +02:00
|
|
|
const char* partyId;
|
2017-06-29 17:58:38 +02:00
|
|
|
int partySize;
|
|
|
|
int partyMax;
|
|
|
|
const char* matchSecret;
|
|
|
|
const char* joinSecret;
|
|
|
|
const char* spectateSecret;
|
2017-06-30 23:31:48 +02:00
|
|
|
int8_t instance;
|
|
|
|
} DiscordRichPresence;
|
2017-06-24 01:04:36 +02:00
|
|
|
|
2017-06-30 23:31:48 +02:00
|
|
|
typedef struct {
|
2017-06-24 01:04:36 +02:00
|
|
|
void (*ready)();
|
2017-07-12 00:59:14 +02:00
|
|
|
void (*disconnected)(int errorCode, const char* message);
|
2017-06-24 01:04:36 +02:00
|
|
|
void (*wantsPresence)();
|
|
|
|
void (*joinGame)(const char* joinSecret);
|
|
|
|
void (*spectateGame)(const char* spectateSecret);
|
2017-06-30 23:31:48 +02:00
|
|
|
} DiscordEventHandlers;
|
2017-06-24 01:04:36 +02:00
|
|
|
|
2017-06-29 17:58:38 +02:00
|
|
|
void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers);
|
|
|
|
void Discord_Shutdown();
|
|
|
|
void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
|
|
|
|
2017-07-07 18:41:20 +02:00
|
|
|
/* checks for incoming messages, dispatches callbacks */
|
2017-07-18 18:47:33 +02:00
|
|
|
void Discord_RunCallbacks();
|
|
|
|
|
|
|
|
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
|
|
|
|
#ifdef DISCORD_DISABLE_IO_THREAD
|
|
|
|
void Discord_UpdateConnection();
|
|
|
|
#endif
|
2017-07-07 18:41:20 +02:00
|
|
|
|
2017-06-30 23:31:48 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|