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-08-01 00:58:39 +02:00
|
|
|
// clang-format off
|
|
|
|
|
|
|
|
#if defined(DISCORD_DYNAMIC_LIB)
|
|
|
|
# if defined(_WIN32)
|
|
|
|
# if defined(DISCORD_BUILDING_SDK)
|
|
|
|
# define DISCORD_EXPORT __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define DISCORD_EXPORT __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define DISCORD_EXPORT __attribute__((visibility("default")))
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# define DISCORD_EXPORT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// clang-format on
|
|
|
|
|
2017-07-25 18:27:48 +02:00
|
|
|
#ifdef __cplusplus
|
2017-06-30 23:31:48 +02:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-07-20 22:22:11 +02:00
|
|
|
typedef struct DiscordRichPresence {
|
2017-08-01 00:58:39 +02:00
|
|
|
const char* state; /* max 128 bytes */
|
2017-07-29 01:06:46 +02:00
|
|
|
const char* details; /* max 128 bytes */
|
2017-06-29 18:38:07 +02:00
|
|
|
int64_t startTimestamp;
|
|
|
|
int64_t endTimestamp;
|
2017-08-01 00:58:39 +02:00
|
|
|
const char* largeImageKey; /* max 32 bytes */
|
2017-07-29 01:06:46 +02:00
|
|
|
const char* largeImageText; /* max 128 bytes */
|
2017-08-01 00:58:39 +02:00
|
|
|
const char* smallImageKey; /* max 32 bytes */
|
2017-07-29 01:06:46 +02:00
|
|
|
const char* smallImageText; /* max 128 bytes */
|
2017-08-01 00:58:39 +02:00
|
|
|
const char* partyId; /* max 128 bytes */
|
2017-06-29 17:58:38 +02:00
|
|
|
int partySize;
|
|
|
|
int partyMax;
|
2017-08-01 00:58:39 +02:00
|
|
|
const char* matchSecret; /* max 128 bytes */
|
|
|
|
const char* joinSecret; /* max 128 bytes */
|
2017-07-29 01:06:46 +02:00
|
|
|
const char* spectateSecret; /* max 128 bytes */
|
2017-06-30 23:31:48 +02:00
|
|
|
int8_t instance;
|
|
|
|
} DiscordRichPresence;
|
2017-06-24 01:04:36 +02:00
|
|
|
|
2017-07-20 22:22:11 +02:00
|
|
|
typedef struct DiscordEventHandlers {
|
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-07-24 23:58:53 +02:00
|
|
|
void (*errored)(int errorCode, const char* message);
|
2017-06-24 01:04:36 +02:00
|
|
|
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-08-01 00:58:39 +02:00
|
|
|
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
|
|
|
DiscordEventHandlers* handlers,
|
2017-08-31 00:17:47 +02:00
|
|
|
int autoRegister,
|
|
|
|
const char* optionalSteamId);
|
2017-08-01 00:58:39 +02:00
|
|
|
DISCORD_EXPORT void Discord_Shutdown();
|
2017-06-29 17:58:38 +02:00
|
|
|
|
2017-07-07 18:41:20 +02:00
|
|
|
/* checks for incoming messages, dispatches callbacks */
|
2017-08-01 00:58:39 +02:00
|
|
|
DISCORD_EXPORT void Discord_RunCallbacks();
|
2017-07-18 18:47:33 +02:00
|
|
|
|
|
|
|
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
|
|
|
|
#ifdef DISCORD_DISABLE_IO_THREAD
|
2017-08-01 00:58:39 +02:00
|
|
|
DISCORD_EXPORT void Discord_UpdateConnection();
|
2017-07-18 18:47:33 +02:00
|
|
|
#endif
|
2017-07-07 18:41:20 +02:00
|
|
|
|
2017-08-01 00:58:39 +02:00
|
|
|
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
2017-07-21 00:59:15 +02:00
|
|
|
|
2017-07-25 18:27:48 +02:00
|
|
|
#ifdef __cplusplus
|
2017-06-30 23:31:48 +02:00
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|