45 Commits
1.0.1 ... 1.2.0

Author SHA1 Message Date
55b41f85fa fixed mac releases 2024-03-02 23:28:09 +01:00
d468df31df updated syntax highlighter 2024-03-01 12:26:56 +01:00
a97cf81ea9 improved release pipeline 2024-03-01 12:00:22 +01:00
2ad1dd1e25 bumped to 1.2.0 2024-02-29 19:49:07 +01:00
0c280cf2e6 finished upgrade to 4.1.3 and added macos support 2024-02-29 19:46:41 +01:00
91786abb15 readded godot-cpp submodule 2024-02-29 19:12:58 +01:00
577e6b87b4 updated to 4.1.3 (4.1.2/custom downloader for it made macos not compile) 2024-02-29 19:06:47 +01:00
d318d7b5f9 threw git submodules away because of lack of features 2024-02-27 18:38:55 +01:00
9d8a809b13 made it backwards compatible from 4.2.X down to 4.1.2 2024-02-27 17:30:55 +01:00
79c6ea8a9e started backporting 2024-02-27 13:23:16 +01:00
0bf43164f2 updated docs link 2024-02-27 13:05:38 +01:00
605080d7ff fixed a random crash and stabilized the plugin in general 2024-02-27 13:01:26 +01:00
Yannik
1b56b8c8df Merge pull request #53 from vaartis/macos-fixes 2024-02-27 07:14:04 +01:00
Yannik
9f49afd472 Update README.md 2024-02-25 15:48:16 +01:00
Yannik
e016b7b582 Update README.md 2024-02-25 15:39:26 +01:00
Ekaterina Vaartis
4726a4488b Make macos version work (testes on m1 at least)
1. Change name of discord's library to libdiscord_game_sdk, so it
links properly
2. Change it's install name with install_name_tool to use @loader_path
instead of @rpath, that one's a blunder on discord's side, it should
really have been loader_path from the beginning (rpath means look at
where the binary is started from, loader_path means look at where the
library is)
3. Combine the aarch and x86 library into one, again no idea why
discord does not do this themselves
2024-02-25 16:40:54 +03:00
Yannik
bcdf52d5c6 Update BUG.yml 2024-02-11 02:20:04 +01:00
Yannik
c4da303a5d Update README.md 2024-02-11 02:12:46 +01:00
Yannik
de8e4b4793 Update FUNDING.yml 2024-02-09 18:18:14 +01:00
Yannik
ecead11830 Update FUNDING.yml 2024-02-09 18:17:48 +01:00
Yannik
91074133bb Merge pull request #50 from EddieDover/multiplatform-building
Better platform detection
2024-02-02 18:28:42 +01:00
37c7759cdf trying to fix macos support agaaaiiin -_- 2024-01-12 17:20:35 +01:00
262450728d you know what we'll call it a hotfix 2024-01-10 19:29:17 +01:00
dab07c9f62 fixed crash on Editor Presence on switching projects 2024-01-10 19:28:35 +01:00
d3919d249b made linux binaries for release 2024-01-10 18:50:13 +01:00
91c4946116 finished rewrite of EditorPresence 2024-01-10 18:46:53 +01:00
cd19b48ca8 fixed crash on clear 2024-01-10 18:46:36 +01:00
Eddie Dover
93d424e3e7 Added platform identifier to output 2023-12-23 05:49:10 -08:00
Eddie Dover
96afc12c92 Merge branch 'multiplatform-building' of https://github.com/EddieDover/discord-sdk-godot into multiplatform-building 2023-12-23 05:36:42 -08:00
Eddie Dover
20978010a1 Switched from os.name to platform.system for better platform discovery 2023-12-23 05:31:33 -08:00
Eddie Dover
39078e7a98 Requirements and gitignore changes for easier venv setup 2023-12-23 05:31:33 -08:00
dc7b4b43ad tweaked vscode settings a bit more 2023-12-23 14:24:02 +01:00
37c679d1bc added gtextension syntax to vscode 2023-12-23 14:20:20 +01:00
9f1395c6a7 forgot to link the correct dyllib 2023-12-23 14:05:30 +01:00
Eddie Dover
a52ca54bca Switched from os.name to platform.system for better platform discovery 2023-12-22 17:04:26 -08:00
Eddie Dover
7be2c5a119 Requirements and gitignore changes for easier venv setup 2023-12-22 17:03:46 -08:00
0fb4526191 trying to fix macos builds again 2023-12-23 00:25:22 +01:00
Yannik
f8a84cf3d5 Update README.md 2023-12-21 15:01:01 +01:00
7859bd0a77 fixed editorpresence setting appearing in other projects where the plugin isn't used 2023-12-21 13:12:41 +01:00
f5560593d0 stabalized native EditorPresence 2023-12-18 19:47:32 +01:00
3f58da00ad finished custom EditorPresence GDExtension class 2023-12-18 19:27:08 +01:00
ea829e8603 Merge branch 'main' of https://github.com/vaporvee/discord-sdk-godot 2023-12-18 17:52:33 +01:00
1e1bc6c59d started making editor presence with gdextension instead of gdscript 2023-12-18 17:52:31 +01:00
Yannik
5153c4e9ed Update BUG.yml 2023-12-18 08:20:10 +01:00
Yannik
5f56cf4b26 Update README.md 2023-12-17 18:45:07 +01:00
31 changed files with 349 additions and 130 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1 +1,2 @@
patreon: vaporvee
ko_fi: vaporvee ko_fi: vaporvee

View File

@@ -1,6 +1,6 @@
name: Bug Report name: Error
description: File a bug report description: Get help with an error or report a bug
title: "[Bug/Crash]: " title: "[Issue/Bug]: "
labels: ["bug"] labels: ["bug"]
assignees: assignees:
- vaporvee - vaporvee
@@ -23,6 +23,8 @@ body:
label: Version label: Version
description: What version of the Discord Game SDK Godot plugin are you running? description: What version of the Discord Game SDK Godot plugin are you running?
options: options:
- 1.2.0
- 1.1.0
- 1.0.1 - 1.0.1
- 1.0.0 - 1.0.0
- 0.3.2 - 0.3.2
@@ -87,10 +89,10 @@ body:
attributes: attributes:
label: Checks label: Checks
description: Common mistakes (Adding more in the future sorry btw) description: Common mistakes (Adding more in the future sorry btw)
options: options:
- label: I tried reinstalling the addon or tried to fix it myself with other methods. - label: I tried reinstalling the addon or tried to fix it myself with other methods.
required: true required: true
- label: I tried restarting Discord and Godot completely. - label: I tried restarting Discord and Godot completely.
required: true required: true
- label: I did read the documentation https://github.com/vaporvee/discord-sdk-godot/wiki - label: I did read the documentation https://vaporvee.com/docs/discord-sdk-godot/
required: true required: true

14
.gitignore vendored
View File

@@ -1,12 +1,14 @@
# Objects. # Objects.
.scons-cache/ .scons-cache/
*.os *.os
*.o
# SConstruct # SConstruct
.sconf_temp .sconf_temp
.sconsign.dblite .sconsign.dblite
*.pyc *.pyc
# MacOS # MacOS
.DS_Store .DS_Store
@@ -17,9 +19,15 @@ build/
*.obj *.obj
*.exp *.exp
*.lib *.lib
*.a
#Clean files from the Game SDK #Clean files from setup.py
src/lib/discord_game_sdk/ src/lib/discord_game_sdk/
# release.py # release
release/ release/
project/export/
# venv
venv/

2
.gitmodules vendored
View File

@@ -1,4 +1,4 @@
[submodule "src/lib/godot-cpp"] [submodule "src/lib/godot-cpp"]
path = src/lib/godot-cpp path = src/lib/godot-cpp
url = https://github.com/godotengine/godot-cpp url = https://github.com/godotengine/godot-cpp
branch = 4.2 branch = 4.1

View File

@@ -1,5 +1,8 @@
{ {
"recommendations": [ "recommendations": [
"ms-vscode.cpptools" "ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"geequlim.godot-tools",
"ms-python.python"
] ]
} }

59
.vscode/settings.json vendored
View File

@@ -4,64 +4,7 @@
"${workspaceFolder}/src/lib/godot-cpp/include" "${workspaceFolder}/src/lib/godot-cpp/include"
], ],
"files.associations": { "files.associations": {
"xlocbuf": "cpp", "*.gdextension": "ini"
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"csignal": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"memory": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"set": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocinfo": "cpp",
"xlocnum": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
}, },
"[python]": { "[python]": {
"editor.defaultFormatter": "ms-python.black-formatter" "editor.defaultFormatter": "ms-python.black-formatter"

View File

@@ -1,8 +1,10 @@
<img src="/project/assets/Banner.svg" alt="Project Banner" /> <img src="/project/assets/Banner.svg" alt="Project Banner" />
**Discord Game SDK support for GDScript in Godot Engine 4.1. with the easiest code pattern!**<br><br>
**Discord Game SDK support for GDScript in Godot Engine 4.2. with the easiest code pattern!**<br><br>
<br /> <br />
# [Quick start :rocket: (click here)](https://github.com/vaporvee/discord-sdk-godot/wiki) ### [My Discord Server](https://discord.gg/EBdaTefpWy)
# [Quick start :rocket: (click here)](https://vaporvee.com/docs/discord-sdk-godot#quick-start)
<br /> <br />
**A small donation with the sponsor button would be nice if you sell your project with this addon but is of course not mandatory!** **A small donation with the sponsor button would be nice if you sell your project with this addon but is of course not mandatory!**

View File

@@ -5,7 +5,7 @@ env = SConscript("src/lib/godot-cpp/SConstruct")
if env["platform"] == "macos": if env["platform"] == "macos":
discord_library = "libdiscord_game_sdk.dylib" discord_library = "libdiscord_game_sdk.dylib"
discord_library_second = "libdiscord_game_sdk_aarch64.dylib" discord_library_second = ""
libexportfolder = "/macos/" libexportfolder = "/macos/"
elif env["platform"] in ("linuxbsd", "linux"): elif env["platform"] in ("linuxbsd", "linux"):
@@ -23,6 +23,11 @@ if env["target"] == "template_debug":
else: else:
debugsuffix = "" debugsuffix = ""
if env.get("arch") == "arm64":
armsuffix = "_arm64"
else:
armsuffix = ""
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"]) env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp") sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"]) env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"])
@@ -37,6 +42,7 @@ library = env.SharedLibrary(
target="project/addons/discord-sdk-gd/bin/" target="project/addons/discord-sdk-gd/bin/"
+ libexportfolder + libexportfolder
+ "discord_game_sdk_binding" + "discord_game_sdk_binding"
+ armsuffix
+ debugsuffix, + debugsuffix,
source=sources, source=sources,
) )

View File

@@ -1,4 +1,5 @@
import os import os
import platform
import sys import sys
yes = {"yes", "y", "ye", ""} yes = {"yes", "y", "ye", ""}
@@ -16,11 +17,17 @@ if choice in yes:
"python -m SCons && python -m SCons target=template_release && cd project && godot" "python -m SCons && python -m SCons target=template_release && cd project && godot"
) )
elif choice in no: elif choice in no:
if os.name == "nt": system = platform.system()
print("Building for: '%s'" % (system))
if system == "Windows": # Windows
os.system( os.system(
"python -m SCons && python -m SCons target=template_release && godot project\project.godot" "python -m SCons && python -m SCons target=template_release && godot project/project.godot"
) )
else: elif system == "Darwin": # macOS
os.system(
"python -m SCons target=template_release arch=x86_64 && python -m SCons target=template_debug arch=x86_64 && python -m SCons target=template_release arch=arm64 && python -m SCons target=template_debug arch=arm64 && godot project/project.godot"
)
else: # Linux
os.system( os.system(
"python -m SCons && python -m SCons target=template_release && godot project/project.godot" "python -m SCons && python -m SCons target=template_release && godot project/project.godot"
) )

View File

@@ -1,7 +1,7 @@
[configuration] [configuration]
entry_symbol = "discordsdkgd_library_init" entry_symbol = "discordsdkgd_library_init"
compatibility_minimum = 4.2 compatibility_minimum = 4.1
[libraries] [libraries]
@@ -18,8 +18,7 @@ linux.release.rv64 = "linux/libdiscord_game_sdk_binding.so"
[dependencies] [dependencies]
macos.debug = { "macos/libdiscord_game_sdk.dylib": "" } macos = { "macos/libdiscord_game_sdk.dylib": "" }
macos.release = { "macos/libdiscord_game_sdk.dylib": "" }
windows.debug.x86_64 = { "windows/discord_game_sdk.dll": "" } windows.debug.x86_64 = { "windows/discord_game_sdk.dll": "" }
windows.release.x86_64 = { "windows/discord_game_sdk.dll": "" } windows.release.x86_64 = { "windows/discord_game_sdk.dll": "" }
linux.debug.x86_64 = { "linux/libdiscord_game_sdk.so": "" } linux.debug.x86_64 = { "linux/libdiscord_game_sdk.so": "" }

View File

@@ -1,22 +1,13 @@
## This is a GDscript Node wich gets automatically added as Autoload while installing the addon. ## This is a GDscript Node wich gets automatically added as Autoload while installing the addon.
## ##
## It can run in the background to comunicate with Discord. ## It can run in the background to comunicate with Discord.
## You don't need to use it unless you are using EditorPresence. If you remove it make sure to run [code]DiscordSDK.run_callbacks()[/code] in a [code]_process[/code] function. ## You don't need to use it. If you remove it make sure to run [code]DiscordSDK.run_callbacks()[/code] in a [code]_process[/code] function.
## ##
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki ## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
@tool
extends Node extends Node
func _ready() -> void:
pass
func _process(_delta) -> void: func _process(_delta) -> void:
if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"): DiscordSDK.run_callbacks()
if ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled",false) && Engine.is_editor_hint():
if DiscordSDK.app_id != 1108142249990176808:
DiscordSDK.app_id = 1108142249990176808
DiscordSDK.details = ProjectSettings.get_setting("application/config/name")
DiscordSDK.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\""
DiscordSDK.large_image = "godot"
DiscordSDK.large_image_text = str(Engine.get_version_info().string)
DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
DiscordSDK.refresh()
if DiscordSDK.app_id == 1108142249990176808 || !Engine.is_editor_hint():
DiscordSDK.run_callbacks()

View File

@@ -3,5 +3,5 @@
name="DiscordSDK" name="DiscordSDK"
description="Discord Game SDK support for GDScript in Godot" description="Discord Game SDK support for GDScript in Godot"
author="vaporvee" author="vaporvee"
version="1.0.1" version="1.2.0"
script="plugin.gd" script="plugin.gd"

View File

@@ -5,12 +5,22 @@ const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/Debug.svg") const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/Debug.svg")
var loaded_DiscordSDKDebug = DiscordSDKDebug.new() var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate() var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate()
var plugin_cfg: ConfigFile = ConfigFile.new()
const plugin_data_filename = "/plugin_data.cfg"
func _enter_tree() -> void: func _enter_tree() -> void:
add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) get_editor_interface().get_editor_settings().settings_changed.connect(_on_editor_settings_changed)
ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) func _ready() -> void:
await get_tree().create_timer(0.5).timeout
plugin_cfg.load(get_editor_interface().get_editor_paths().get_data_dir() + plugin_data_filename)
if !get_editor_interface().get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
get_editor_interface().get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",plugin_cfg.get_value("Discord","editor_presence",false))
func _exit_tree():
if get_editor_interface().get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
get_editor_interface().get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")
func _enable_plugin() -> void: func _enable_plugin() -> void:
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"):
@@ -18,19 +28,29 @@ func _enable_plugin() -> void:
add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd") add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd")
restart_window.connect("confirmed", save_no_restart) restart_window.connect("confirmed", save_no_restart)
restart_window.connect("canceled", save_and_restart) restart_window.connect("canceled", save_and_restart)
EditorInterface.popup_dialog_centered(restart_window) get_editor_interface().popup_dialog_centered(restart_window)
print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!") print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")
func _disable_plugin() -> void: func _disable_plugin() -> void:
remove_autoload_singleton("DiscordSDKLoader") remove_autoload_singleton("DiscordSDKLoader")
FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE) FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
remove_custom_type("DiscordSDKDebug") remove_custom_type("DiscordSDKDebug")
ProjectSettings.clear("DiscordSDK/EditorPresence/enabled") get_editor_interface().get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")
push_warning("Please restart the editor to fully disable the DiscordSDK plugin") push_warning("Please restart the editor to fully disable the DiscordSDK plugin")
func save_and_restart() -> void: func save_and_restart() -> void:
EditorInterface.save_all_scenes() get_editor_interface().restart_editor(true)
EditorInterface.restart_editor(true)
func save_no_restart() -> void: func save_no_restart() -> void:
EditorInterface.restart_editor(false) get_editor_interface().restart_editor(false)
var editor_presence: Node
func _on_editor_settings_changed() -> void:
plugin_cfg.set_value("Discord","editor_presence",get_editor_interface().get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"))
plugin_cfg.save(get_editor_interface().get_editor_paths().get_data_dir() + plugin_data_filename)
if ClassDB.class_exists("EditorPresence") && editor_presence == null:
editor_presence = ClassDB.instantiate("EditorPresence")
if get_editor_interface().get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled") && get_editor_interface().get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"):
add_child(editor_presence)
else:
editor_presence.queue_free()

View File

@@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
[sub_resource type="Image" id="Image_6icdx"] [sub_resource type="Image" id="Image_v4whe"]
data = { data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0), "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0),
"format": "RGBA8", "format": "RGBA8",
@@ -19,7 +19,7 @@ data = {
} }
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"] [sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
image = SubResource("Image_6icdx") image = SubResource("Image_v4whe")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
@@ -80,9 +80,9 @@ layout_mode = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 8 size_flags_vertical = 8
mouse_default_cursor_shape = 16 mouse_default_cursor_shape = 16
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 20
text = "HOW TO USE" text = "HOW TO USE"
uri = "https://github.com/vaporvee/discord-sdk-godot/wiki" uri = "https://vaporvee.com/docs/discord-sdk-godot#quick-start"
[node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"] [node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"]
custom_minimum_size = Vector2(128, 128) custom_minimum_size = Vector2(128, 128)
@@ -102,10 +102,11 @@ theme_override_font_sizes/normal_font_size = 16
theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg") theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg")
bbcode_enabled = true bbcode_enabled = true
text = "[center]Thanks for enabling the text = "[center]Thanks for enabling the
[rainbow][b]Discord Game SDK Plugin[/b][/rainbow] [rainbow]Discord Game SDK Plugin[/rainbow]
made by vaporvee. ❤️ made by vaporvee. ❤️
You need to [wave][b]restart[/b][/wave] the editor to fully enable this plugin! You need to [wave]restart[/wave] the editor to fully enable this plugin!
Do you want to [wave][b]save[/b][/wave] your project before restarting? Do you want to [wave]save[/wave] your project before restarting?
(Error messages after the first restart are normal. Please ignore them)"
Error messages after the first two restarts are normal. Please ignore them!"

View File

@@ -8,7 +8,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../../eexport/windows/discord-sdk-godot-demo.exe" export_path="export/windows/discord-sdk-godot-demo.exe"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false
@@ -42,6 +42,7 @@ application/product_name=""
application/file_description="Discord SDK Godot Test" application/file_description="Discord SDK Godot Test"
application/copyright="" application/copyright=""
application/trademarks="" application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip" ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22" ssh_remote_deploy/port="22"
@@ -70,7 +71,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../../eexport/linux/discord-sdk-godot-demo.x86_64" export_path="export/linux/discord-sdk-godot-demo.x86_64"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false
@@ -99,3 +100,108 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\"" rm -rf \"{temp_dir}\""
[preset.2]
name="macOS"
platform="macOS"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/macos/discord-sdk-godot-demo.zip"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.2.options]
export/distribution_type=0
binary_format/architecture="universal"
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
application/icon=""
application/icon_interpolation=4
application/bundle_identifier="com.vaporvee.discord-sdk-godot-demo"
application/signature=""
application/app_category="Games"
application/short_version=""
application/version=""
application/copyright=""
application/copyright_localized={}
application/min_macos_version="10.12"
application/export_angle=0
display/high_res=true
xcode/platform_build="14C18"
xcode/sdk_version="13.1"
xcode/sdk_build="22C55"
xcode/sdk_name="macosx13.1"
xcode/xcode_version="1420"
xcode/xcode_build="14C18"
codesign/codesign=1
codesign/installer_identity=""
codesign/apple_team_id=""
codesign/identity=""
codesign/entitlements/custom_file=""
codesign/entitlements/allow_jit_code_execution=false
codesign/entitlements/allow_unsigned_executable_memory=false
codesign/entitlements/allow_dyld_environment_variables=false
codesign/entitlements/disable_library_validation=false
codesign/entitlements/audio_input=false
codesign/entitlements/camera=false
codesign/entitlements/location=false
codesign/entitlements/address_book=false
codesign/entitlements/calendars=false
codesign/entitlements/photos_library=false
codesign/entitlements/apple_events=false
codesign/entitlements/debugging=false
codesign/entitlements/app_sandbox/enabled=false
codesign/entitlements/app_sandbox/network_server=false
codesign/entitlements/app_sandbox/network_client=false
codesign/entitlements/app_sandbox/device_usb=false
codesign/entitlements/app_sandbox/device_bluetooth=false
codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/entitlements/app_sandbox/files_user_selected=0
codesign/entitlements/app_sandbox/helper_executables=[]
codesign/custom_options=PackedStringArray()
notarization/notarization=0
privacy/microphone_usage_description=""
privacy/microphone_usage_description_localized={}
privacy/camera_usage_description=""
privacy/camera_usage_description_localized={}
privacy/location_usage_description=""
privacy/location_usage_description_localized={}
privacy/address_book_usage_description=""
privacy/address_book_usage_description_localized={}
privacy/calendar_usage_description=""
privacy/calendar_usage_description_localized={}
privacy/photos_library_usage_description=""
privacy/photos_library_usage_description_localized={}
privacy/desktop_folder_usage_description=""
privacy/desktop_folder_usage_description_localized={}
privacy/documents_folder_usage_description=""
privacy/documents_folder_usage_description_localized={}
privacy/downloads_folder_usage_description=""
privacy/downloads_folder_usage_description_localized={}
privacy/network_volumes_usage_description=""
privacy/network_volumes_usage_description_localized={}
privacy/removable_volumes_usage_description=""
privacy/removable_volumes_usage_description_localized={}
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

View File

@@ -33,7 +33,7 @@ func set_activity() -> void:
DiscordSDK.is_public_party = true DiscordSDK.is_public_party = true
DiscordSDK.instanced = true #required for spectate DiscordSDK.instanced = true #required for spectate
#DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) #DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
DiscordSDK.register_command(r"C:\Users\yanni\Desktop\demo\DiscordSDK.exe") DiscordSDK.register_command("C:\\Users\\yanni\\Desktop\\demo\\DiscordSDK.exe")
#DiscordSDK.register_steam(1389990) #DiscordSDK.register_steam(1389990)
DiscordSDK.refresh() DiscordSDK.refresh()

View File

@@ -1,26 +1,37 @@
import os import os
from distutils.dir_util import copy_tree
import shutil import shutil
from distutils.dir_util import copy_tree
folder_path = "project/addons/discord-sdk-gd/bin/windows" win_folder_path = "project/addons/discord-sdk-gd/bin/windows"
# Filter files that end with 'TMP' or 'exp' or 'lib'
matching_files = [
file for file in os.listdir(folder_path) if file.endswith(("TMP", "exp", "lib"))
]
matching_files = [file for file in os.listdir(win_folder_path) if file.endswith(("TMP", "exp", "lib"))]
for file in matching_files: for file in matching_files:
file_path = os.path.join(folder_path, file) file_path = os.path.join(win_folder_path, file)
os.remove(file_path) os.remove(file_path)
if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"): if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"):
shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True) shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True)
copy_tree("project/addons/", "release/temp/ADDON-Discord-SDK-Godot/addons") copy_tree("project/addons/", "release/temp/ADDON-Discord-SDK-Godot/addons")
open(
"release/temp/ADDON-Discord-SDK-Godot/addons/discord-sdk-gd/bin/.gdignore", "a"
).close()
shutil.make_archive("release/ADDON-Discord-SDK-Godot", "zip", "release/temp/") open("release/temp/ADDON-Discord-SDK-Godot/addons/discord-sdk-gd/bin/.gdignore", "a").close()
shutil.make_archive('release/ADDON-Discord-SDK-Godot', 'zip', 'release/temp/')
shutil.rmtree("release/temp/") shutil.rmtree("release/temp/")
# Export Demos
os.system("cd project && godot --headless --export-release \"Linux/X11\"")
os.system("cd project && godot --headless --export-release \"Windows Desktop\"")
os.system("cd project && godot --headless --export-release \"macOS\"")
temp_dir = "release/temp_export_dir"
os.makedirs(temp_dir, exist_ok=True)
for platform in ["windows", "linux", "macos"]:
shutil.copytree(f"project/export/{platform}", os.path.join(temp_dir, platform))
shutil.make_archive('release/Demo-Export', 'zip', temp_dir)
shutil.rmtree(temp_dir)
print("ADDON-Discord-SDK-Godot.zip and Demo-Export.zip have been created successfully.")

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
setuptools
scons

View File

@@ -2,6 +2,7 @@ import zipfile
from distutils.dir_util import copy_tree from distutils.dir_util import copy_tree
import shutil import shutil
import os import os
import sys
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref: with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
zip_ref.extractall("src/lib/discord_game_sdk/") zip_ref.extractall("src/lib/discord_game_sdk/")
@@ -15,11 +16,7 @@ with open("src/lib/discord_game_sdk/cpp/types.h", "r+") as f:
copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/") copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/")
os.rename( os.rename(
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib", "src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib",
"src/lib/discord_game_sdk/bin/aarch64/libdiscord_game_sdk_aarch64.dylib", "src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk_aarch64.dylib",
)
os.rename(
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.dylib",
"src/lib/discord_game_sdk/bin/x86_64/libdiscord_game_sdk.dylib",
) )
os.rename( os.rename(
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.so", "src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.so",
@@ -47,4 +44,18 @@ shutil.rmtree("src/lib/discord_game_sdk/bin/x86/", ignore_errors=True)
shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True) shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True)
os.remove("src/lib/discord_game_sdk/README.md") os.remove("src/lib/discord_game_sdk/README.md")
if sys.platform == "darwin":
# Combine the two libraries into one
os.system(
"lipo src/lib/discord_game_sdk/bin/{discord_game_sdk.dylib,discord_game_sdk_aarch64.dylib} -output src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib -create"
)
# Change the install name to (library's location)/(its new name)
os.system(
"install_name_tool -id '@loader_path/libdiscord_game_sdk.dylib'\
src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib"
)
# Remove the ones it's made of
os.remove("src/lib/discord_game_sdk/bin/discord_game_sdk.dylib")
os.remove("src/lib/discord_game_sdk/bin/discord_game_sdk_aarch64.dylib")
os.system("git submodule update --init --remote") os.system("git submodule update --init --remote")

View File

@@ -87,14 +87,17 @@ SET_GET(is_public_party, activity.GetParty().SetPrivacy(static_cast<discord::Act
DiscordSDK::DiscordSDK() DiscordSDK::DiscordSDK()
{ {
ERR_FAIL_COND(singleton != nullptr);
singleton = this; singleton = this;
} }
DiscordSDK::~DiscordSDK() DiscordSDK::~DiscordSDK()
{ {
singleton = nullptr; app_id = 0;
delete core; // couldn't use destructor because it would not compile on linux delete core; // couldn't use destructor because it would not compile on linux
core = nullptr; core = nullptr;
ERR_FAIL_COND(singleton != this);
singleton = nullptr;
} }
DiscordSDK *DiscordSDK::get_singleton() DiscordSDK *DiscordSDK::get_singleton()
@@ -207,6 +210,7 @@ void DiscordSDK::clear(bool reset_values = false)
} }
else else
old_app_id = app_id; old_app_id = app_id;
app_id = 0;
delete core; delete core;
core = nullptr; core = nullptr;
} }

55
src/editor_presence.cpp Normal file
View File

@@ -0,0 +1,55 @@
#include "editor_presence.h"
#include "lib/discord_game_sdk/cpp/discord.h"
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
#include <godot_cpp/classes/scene_tree.hpp>
EditorPresence *EditorPresence::singleton = nullptr;
void EditorPresence::_bind_methods()
{
}
EditorPresence::EditorPresence()
{
singleton = this;
}
EditorPresence::~EditorPresence()
{
singleton = nullptr;
delete core; // couldn't use destructor because it would not compile on linux
core = nullptr;
}
EditorPresence *EditorPresence::get_singleton()
{
return singleton;
}
void EditorPresence::_ready()
{
result = discord::Core::Create(1108142249990176808, DiscordCreateFlags_NoRequireDiscord, &core);
activity.SetState("Editing a project...");
activity.SetDetails(String(project_settings->get_setting("application/config/name")).utf8());
if (project_settings->has_setting("application/config/name"))
{
activity.GetAssets().SetLargeImage("godot");
}
activity.GetAssets().SetLargeText(String(engine->get_version_info()["string"]).utf8());
activity.GetTimestamps().SetStart(time->get_unix_time_from_system());
if (result == discord::Result::Ok)
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
else
UtilityFunctions::push_warning("EditorPresence couldn't be loaded! Maybe your Discord isn't running?");
}
void EditorPresence::_process(double delta)
{
if (state_string.utf8() != activity.GetState())
{
godot::Node *edited_scene_root = get_tree()->get_edited_scene_root();
activity.SetState(String("Editing: \"" + edited_scene_root->get_scene_file_path() + "\"").replace("res://", "").utf8());
if (result == discord::Result::Ok)
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
}
if (result == discord::Result::Ok)
core->RunCallbacks();
}

44
src/editor_presence.h Normal file
View File

@@ -0,0 +1,44 @@
#ifndef EDITOR_PRESENCE_H
#define EDITOR_PRESENCE_H
#include <stdio.h>
#include "lib/discord_game_sdk/cpp/discord.h"
#include <godot_cpp/classes/node.hpp>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/classes/project_settings.hpp>
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/time.hpp>
#include <godot_cpp/classes/tree.hpp>
using namespace godot;
class EditorPresence : public Node
{
GDCLASS(EditorPresence, Node);
static EditorPresence *singleton;
protected:
static void _bind_methods();
public:
static EditorPresence *
get_singleton();
godot::Engine *engine = godot::Engine::get_singleton();
godot::ProjectSettings *project_settings = godot::ProjectSettings::get_singleton();
godot::Time *time = godot::Time::get_singleton();
discord::Core *core{};
discord::Result result;
discord::Activity activity{};
String state_string;
EditorPresence();
~EditorPresence();
void _ready() override;
void _process(double delta) override;
};
#endif

View File

@@ -7,6 +7,7 @@
#include <godot_cpp/godot.hpp> #include <godot_cpp/godot.hpp>
#include "discordgodot.h" #include "discordgodot.h"
#include "editor_presence.h"
using namespace godot; using namespace godot;
static DiscordSDK *discordsdk; static DiscordSDK *discordsdk;
@@ -18,6 +19,7 @@ void initialize_discordsdk_module(ModuleInitializationLevel p_level)
ClassDB::register_class<DiscordSDK>(); ClassDB::register_class<DiscordSDK>();
discordsdk = memnew(DiscordSDK); discordsdk = memnew(DiscordSDK);
Engine::get_singleton()->register_singleton("DiscordSDK", DiscordSDK::get_singleton()); Engine::get_singleton()->register_singleton("DiscordSDK", DiscordSDK::get_singleton());
ClassDB::register_class<EditorPresence>();
} }
} }
@@ -26,6 +28,7 @@ void uninitialize_discordsdk_module(ModuleInitializationLevel p_level)
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
{ {
Engine::get_singleton()->unregister_singleton("DiscordSDK"); Engine::get_singleton()->unregister_singleton("DiscordSDK");
memdelete(discordsdk);
} }
} }