discord_game_sdk-d ~main
Static D bindings for the Discord Game SDK
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Discord Game SDK D Bindings
This library provides D language static @nogc nothrow
bindings for the Discord Game SDK v3.2.1. For more details on what Discord Game SDK can do, refer to the official documentation: Discord Game SDK Documentation.
Usage
To start using bindings in your D application, follow these steps:
1. Add the Library to Your Project
First, add the discord_game_sdk.dll.lib
to your project's dub.sdl
or dub.json
file:
libs "discord_game_sdk.dll"
2. Ensure the Library is in Your Project's Path
Ensure that the discord_game_sdk.dll
(or the appropriate shared library for your platform) is available in your project's library path. This typically involves placing the DLL or shared library in the same directory as your executable or ensuring it's in your system's library search paths.
3. Import the Bindings
Import the bindings into your D application by including the following line in your source code:
import discord_game_sdk;
4. Example: Initializing the Discord SDK
Here’s a simple example of how to initialize the Discord Game SDK in your D application:
import discord_game_sdk;
import std.stdio;
void main()
{
// Create and set up the parameters for Discord initialization
DiscordCreateParams params;
DiscordCreateParamsSetDefault(¶ms);
params.clientId = 123456789012345678; // Replace with your actual Discord Client ID (Application ID)
params.flags = DiscordCreateFlags.Default;
IDiscordCore* core;
DiscordResult result = DiscordCreate(DISCORD_VERSION, ¶ms, &core);
if (result == DiscordResult.Ok)
{
writeln("Discord SDK initialized successfully.");
// Example: Running callbacks in a loop
while (true)
{
result = core.runCallbacks();
if (result != DiscordResult.Ok)
{
writeln("Failed to run callbacks.");
break;
}
// Sleep or perform other tasks...
}
// Cleanup
core.destroy();
}
else
{
writeln("Failed to initialize Discord SDK. Error code: ", result);
}
}
- Registered by Bagomot
- ~main released 2 months ago
- LightHouseSoftware/discord_game_sdk-d
- MIT
- Copyright © 2024, LightHouse Software
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.0 2024-Sep-05 ~main 2024-Sep-05 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
0 downloads total
-
- Score:
- 0.7
- Short URL:
- discord_game_sdk-d.dub.pm