diff --git a/build.py b/build.py new file mode 100644 index 0000000..5d3e072 --- /dev/null +++ b/build.py @@ -0,0 +1,3 @@ +import os + +os.system("scons && cd project && godot project.godot")#ask if editor or game should be opened \ No newline at end of file diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll index 8a64688..cd80cb9 100644 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll and b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll differ diff --git a/project/addons/discord-rpc-gd/loadaddon.gd b/project/addons/discord-rpc-gd/loadaddon.gd new file mode 100644 index 0000000..9d3b941 --- /dev/null +++ b/project/addons/discord-rpc-gd/loadaddon.gd @@ -0,0 +1,11 @@ +extends Node + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + DiscordSDK.update() diff --git a/project/addons/discord-rpc-gd/plugin.cfg b/project/addons/discord-rpc-gd/plugin.cfg new file mode 100644 index 0000000..59773e5 --- /dev/null +++ b/project/addons/discord-rpc-gd/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="DiscordRPC" +description="Takes the activity manager part from the discord-game-sdk and adds GDscript functionality." +author="vaporvee" +version="0.1" +script="plugin.gd" diff --git a/project/addons/discord-rpc-gd/plugin.gd b/project/addons/discord-rpc-gd/plugin.gd new file mode 100644 index 0000000..4a95998 --- /dev/null +++ b/project/addons/discord-rpc-gd/plugin.gd @@ -0,0 +1,8 @@ +@tool +extends EditorPlugin + +func _enter_tree(): + add_autoload_singleton("Discord", "res://addons/discord-rpc-gd/loadaddon.gd") + +func disable_plugin(): + remove_autoload_singleton("Discord") diff --git a/project/main.gd b/project/main.gd index c8a4f31..0302425 100644 --- a/project/main.gd +++ b/project/main.gd @@ -4,6 +4,3 @@ extends Node # Called when the node enters the scene tree for the first time. func _ready(): DiscordSDK.debug() - -func _process(_delta): - DiscordSDK.updatedebug() diff --git a/project/project.godot b/project/project.godot index f87c843..75a1301 100644 --- a/project/project.godot +++ b/project/project.godot @@ -17,10 +17,18 @@ boot_splash/bg_color=Color(0.341176, 0.415686, 0.929412, 1) boot_splash/image="res://assets/Logo_V2.png" config/icon="res://assets/Logo_V2.png" +[autoload] + +Discord="*res://addons/discord-rpc-gd/loadaddon.gd" + [dotnet] project/assembly_name="GDExtension Test Project" +[editor_plugins] + +enabled=PackedStringArray("res://addons/discord-rpc-gd/plugin.cfg") + [native_extensions] paths=["res://example.gdextension"] diff --git a/src/main.cpp b/src/main.cpp index 4eb5bae..388a708 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include "main.h" #include "./discord-game-sdk-cpp/discord.h" #include +#include #include using namespace godot; @@ -11,7 +12,7 @@ discord::Core *core{}; void DiscordSDK::_bind_methods() { ClassDB::bind_method(D_METHOD("debug"), &DiscordSDK::debug); - ClassDB::bind_method(D_METHOD("updatedebug"), &DiscordSDK::updatedebug); + ClassDB::bind_method(D_METHOD("update"), &DiscordSDK::update); } DiscordSDK *DiscordSDK::get_singleton() @@ -42,7 +43,7 @@ void DiscordSDK::debug() assets.SetSmallImage("godot"); core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {}); } -void DiscordSDK::updatedebug() +void DiscordSDK::update() { ::core->RunCallbacks(); } \ No newline at end of file diff --git a/src/main.h b/src/main.h index c30b855..271cd25 100644 --- a/src/main.h +++ b/src/main.h @@ -22,7 +22,7 @@ public: ~DiscordSDK(); void debug(); - void updatedebug(); + void update(); }; #endif \ No newline at end of file