Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
55b41f85fa | |||
d468df31df | |||
a97cf81ea9 | |||
2ad1dd1e25 | |||
0c280cf2e6 | |||
91786abb15 | |||
577e6b87b4 | |||
d318d7b5f9 | |||
9d8a809b13 | |||
79c6ea8a9e | |||
0bf43164f2 | |||
605080d7ff | |||
|
1b56b8c8df | ||
|
9f49afd472 | ||
|
e016b7b582 | ||
|
4726a4488b | ||
|
bcdf52d5c6 | ||
|
c4da303a5d | ||
|
de8e4b4793 | ||
|
ecead11830 | ||
|
91074133bb | ||
37c7759cdf | |||
262450728d | |||
dab07c9f62 | |||
d3919d249b | |||
91c4946116 | |||
cd19b48ca8 | |||
|
93d424e3e7 | ||
|
96afc12c92 | ||
|
20978010a1 | ||
|
39078e7a98 | ||
dc7b4b43ad | |||
37c679d1bc | |||
9f1395c6a7 | |||
|
a52ca54bca | ||
|
7be2c5a119 | ||
0fb4526191 | |||
|
f8a84cf3d5 | ||
7859bd0a77 | |||
f5560593d0 | |||
3f58da00ad | |||
ea829e8603 | |||
1e1bc6c59d | |||
|
5153c4e9ed | ||
|
5f56cf4b26 | ||
210555d7a5 |
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +1,2 @@
|
||||
patreon: vaporvee
|
||||
ko_fi: vaporvee
|
||||
|
11
.github/ISSUE_TEMPLATE/BUG.yml
vendored
11
.github/ISSUE_TEMPLATE/BUG.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Bug Report
|
||||
description: File a bug report
|
||||
title: "[Bug/Crash]: "
|
||||
name: Error
|
||||
description: Get help with an error or report a bug
|
||||
title: "[Issue/Bug]: "
|
||||
labels: ["bug"]
|
||||
assignees:
|
||||
- vaporvee
|
||||
@@ -23,6 +23,9 @@ body:
|
||||
label: Version
|
||||
description: What version of the Discord Game SDK Godot plugin are you running?
|
||||
options:
|
||||
- 1.2.0
|
||||
- 1.1.0
|
||||
- 1.0.1
|
||||
- 1.0.0
|
||||
- 0.3.2
|
||||
- 0.3.1
|
||||
@@ -91,5 +94,5 @@ body:
|
||||
required: true
|
||||
- label: I tried restarting Discord and Godot completely.
|
||||
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
|
||||
|
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,12 +1,14 @@
|
||||
# Objects.
|
||||
.scons-cache/
|
||||
*.os
|
||||
*.o
|
||||
|
||||
# SConstruct
|
||||
.sconf_temp
|
||||
.sconsign.dblite
|
||||
*.pyc
|
||||
|
||||
|
||||
# MacOS
|
||||
.DS_Store
|
||||
|
||||
@@ -17,9 +19,15 @@ build/
|
||||
*.obj
|
||||
*.exp
|
||||
*.lib
|
||||
*.a
|
||||
|
||||
#Clean files from the Game SDK
|
||||
#Clean files from setup.py
|
||||
src/lib/discord_game_sdk/
|
||||
|
||||
# release.py
|
||||
# release
|
||||
release/
|
||||
project/export/
|
||||
|
||||
# venv
|
||||
venv/
|
||||
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,4 +1,4 @@
|
||||
[submodule "src/lib/godot-cpp"]
|
||||
path = src/lib/godot-cpp
|
||||
url = https://github.com/godotengine/godot-cpp
|
||||
branch = 4.2
|
||||
branch = 4.1
|
||||
|
5
.vscode/extensions.json
vendored
5
.vscode/extensions.json
vendored
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-vscode.cpptools"
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"geequlim.godot-tools",
|
||||
"ms-python.python"
|
||||
]
|
||||
}
|
59
.vscode/settings.json
vendored
59
.vscode/settings.json
vendored
@@ -4,64 +4,7 @@
|
||||
"${workspaceFolder}/src/lib/godot-cpp/include"
|
||||
],
|
||||
"files.associations": {
|
||||
"xlocbuf": "cpp",
|
||||
"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"
|
||||
"*.gdextension": "ini"
|
||||
},
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||
|
@@ -1,8 +1,10 @@
|
||||
<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 />
|
||||
# [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 />
|
||||
|
||||
**A small donation with the sponsor button would be nice if you sell your project with this addon but is of course not mandatory!**
|
||||
|
@@ -5,7 +5,7 @@ env = SConscript("src/lib/godot-cpp/SConstruct")
|
||||
|
||||
if env["platform"] == "macos":
|
||||
discord_library = "libdiscord_game_sdk.dylib"
|
||||
discord_library_second = "libdiscord_game_sdk_aarch64.dylib"
|
||||
discord_library_second = ""
|
||||
libexportfolder = "/macos/"
|
||||
|
||||
elif env["platform"] in ("linuxbsd", "linux"):
|
||||
@@ -23,6 +23,11 @@ if env["target"] == "template_debug":
|
||||
else:
|
||||
debugsuffix = ""
|
||||
|
||||
if env.get("arch") == "arm64":
|
||||
armsuffix = "_arm64"
|
||||
else:
|
||||
armsuffix = ""
|
||||
|
||||
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
|
||||
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
|
||||
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"])
|
||||
@@ -37,6 +42,7 @@ library = env.SharedLibrary(
|
||||
target="project/addons/discord-sdk-gd/bin/"
|
||||
+ libexportfolder
|
||||
+ "discord_game_sdk_binding"
|
||||
+ armsuffix
|
||||
+ debugsuffix,
|
||||
source=sources,
|
||||
)
|
||||
|
13
build.py
13
build.py
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
yes = {"yes", "y", "ye", ""}
|
||||
@@ -16,11 +17,17 @@ if choice in yes:
|
||||
"python -m SCons && python -m SCons target=template_release && cd project && godot"
|
||||
)
|
||||
elif choice in no:
|
||||
if os.name == "nt":
|
||||
system = platform.system()
|
||||
print("Building for: '%s'" % (system))
|
||||
if system == "Windows": # Windows
|
||||
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(
|
||||
"python -m SCons && python -m SCons target=template_release && godot project/project.godot"
|
||||
)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
[configuration]
|
||||
|
||||
entry_symbol = "discordsdkgd_library_init"
|
||||
compatibility_minimum = 4.2
|
||||
compatibility_minimum = 4.1
|
||||
|
||||
[libraries]
|
||||
|
||||
@@ -18,8 +18,7 @@ linux.release.rv64 = "linux/libdiscord_game_sdk_binding.so"
|
||||
|
||||
[dependencies]
|
||||
|
||||
macos.debug = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||
macos.release = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||
macos = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||
windows.debug.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": "" }
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,23 +1,13 @@
|
||||
## 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.
|
||||
## 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
|
||||
@tool
|
||||
extends Node
|
||||
class_name DiscordSDKLoaderAutoload
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func _process(_delta) -> void:
|
||||
if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"):
|
||||
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()
|
||||
DiscordSDK.run_callbacks()
|
||||
|
@@ -3,5 +3,5 @@
|
||||
name="DiscordSDK"
|
||||
description="Discord Game SDK support for GDScript in Godot"
|
||||
author="vaporvee"
|
||||
version="1.0.0"
|
||||
version="1.2.0"
|
||||
script="plugin.gd"
|
||||
|
@@ -5,32 +5,52 @@ const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
|
||||
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/Debug.svg")
|
||||
var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
|
||||
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:
|
||||
add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
|
||||
ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false)
|
||||
ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
|
||||
ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false)
|
||||
get_editor_interface().get_editor_settings().settings_changed.connect(_on_editor_settings_changed)
|
||||
|
||||
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:
|
||||
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"):
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore")
|
||||
add_autoload_singleton("DiscordSDKAutoload","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("canceled", save_and_restart)
|
||||
EditorInterface.popup_dialog_centered(restart_window)
|
||||
print("IGNORE THE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")
|
||||
get_editor_interface().popup_dialog_centered(restart_window)
|
||||
print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")
|
||||
|
||||
func _disable_plugin() -> void:
|
||||
remove_autoload_singleton("DiscordSDKAutoload")
|
||||
remove_autoload_singleton("DiscordSDKLoader")
|
||||
FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
|
||||
remove_custom_type("DiscordSDKDebug")
|
||||
ProjectSettings.clear("DiscordSDK/EditorPresence/enabled")
|
||||
push_warning("Please restart the editor to dully disable the DiscordSDK plugin")
|
||||
get_editor_interface().get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")
|
||||
push_warning("Please restart the editor to fully disable the DiscordSDK plugin")
|
||||
|
||||
func save_and_restart() -> void:
|
||||
EditorInterface.save_all_scenes()
|
||||
EditorInterface.restart_editor(true)
|
||||
get_editor_interface().restart_editor(true)
|
||||
|
||||
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()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://byc4c6d5tpomq"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://byc4c6d5tpomq"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://csl0e2px0cwc1" path="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png" id="1_0svbg"]
|
||||
|
||||
@@ -7,25 +7,9 @@
|
||||
[sub_resource type="Theme" id="Theme_swwco"]
|
||||
Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_7v43l"]
|
||||
resource_name = "RestartWindow"
|
||||
script/source = "extends ConfirmationDialog
|
||||
|
||||
|
||||
func _ready():
|
||||
canceled.connect(_on_canceled)
|
||||
confirmed.connect(_on_confirmed)
|
||||
|
||||
func _on_canceled():
|
||||
EditorInterface.restart_editor(false)
|
||||
|
||||
func _on_confirmed():
|
||||
EditorInterface.restart_editor(true)
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
|
||||
|
||||
[sub_resource type="Image" id="Image_wf00a"]
|
||||
[sub_resource type="Image" id="Image_v4whe"]
|
||||
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),
|
||||
"format": "RGBA8",
|
||||
@@ -35,7 +19,7 @@ data = {
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
|
||||
image = SubResource("Image_wf00a")
|
||||
image = SubResource("Image_v4whe")
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
||||
|
||||
@@ -49,15 +33,14 @@ unresizable = true
|
||||
theme = SubResource("Theme_swwco")
|
||||
ok_button_text = "Restart"
|
||||
cancel_button_text = "Save and restart"
|
||||
script = SubResource("GDScript_7v43l")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = 8.0
|
||||
offset_left = -207.0
|
||||
offset_top = 8.0
|
||||
offset_right = 422.0
|
||||
offset_right = 207.0
|
||||
offset_bottom = 451.0
|
||||
grow_horizontal = 2
|
||||
mouse_filter = 1
|
||||
@@ -97,9 +80,9 @@ layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
mouse_default_cursor_shape = 16
|
||||
theme_override_font_sizes/font_size = 24
|
||||
theme_override_font_sizes/font_size = 20
|
||||
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"]
|
||||
custom_minimum_size = Vector2(128, 128)
|
||||
@@ -119,10 +102,11 @@ theme_override_font_sizes/normal_font_size = 16
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg")
|
||||
bbcode_enabled = true
|
||||
text = "[center]Thanks for enabling the
|
||||
[rainbow][b]Discord Game SDK Plugin[/b][/rainbow]
|
||||
[rainbow]Discord Game SDK Plugin[/rainbow]
|
||||
made by vaporvee. ❤️
|
||||
|
||||
|
||||
You need to [wave][b]restart[/b][/wave] the editor to fully enable this plugin!
|
||||
Do you want to [wave][b]save[/b][/wave] your project before restarting?
|
||||
(Error messages after the first restart are normal. Please ignore them)"
|
||||
You need to [wave]restart[/wave] the editor to fully enable this plugin!
|
||||
Do you want to [wave]save[/wave] your project before restarting?
|
||||
|
||||
Error messages after the first two restarts are normal. Please ignore them!"
|
||||
|
@@ -8,7 +8,7 @@ custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_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_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
@@ -42,6 +42,7 @@ application/product_name=""
|
||||
application/file_description="Discord SDK Godot Test"
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
application/export_angle=0
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
@@ -70,7 +71,7 @@ custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_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_exclude_filters=""
|
||||
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
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
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}\""
|
||||
|
@@ -33,7 +33,7 @@ func set_activity() -> void:
|
||||
DiscordSDK.is_public_party = true
|
||||
DiscordSDK.instanced = true #required for spectate
|
||||
#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.refresh()
|
||||
|
||||
|
@@ -21,7 +21,7 @@ config/icon="res://assets/Logo_V2.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
DiscordSDKAutoload="*res://addons/discord-sdk-gd/nodes/discord_autoload.gd"
|
||||
DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/discord_autoload.gd"
|
||||
|
||||
[display]
|
||||
|
||||
|
35
release.py
35
release.py
@@ -1,26 +1,37 @@
|
||||
import os
|
||||
from distutils.dir_util import copy_tree
|
||||
import shutil
|
||||
from distutils.dir_util import copy_tree
|
||||
|
||||
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"))
|
||||
]
|
||||
win_folder_path = "project/addons/discord-sdk-gd/bin/windows"
|
||||
|
||||
matching_files = [file for file in os.listdir(win_folder_path) if file.endswith(("TMP", "exp", "lib"))]
|
||||
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)
|
||||
|
||||
if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"):
|
||||
shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True)
|
||||
|
||||
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/")
|
||||
# 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
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
setuptools
|
||||
scons
|
21
setup.py
21
setup.py
@@ -2,6 +2,7 @@ import zipfile
|
||||
from distutils.dir_util import copy_tree
|
||||
import shutil
|
||||
import os
|
||||
import sys
|
||||
|
||||
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
|
||||
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/")
|
||||
os.rename(
|
||||
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib",
|
||||
"src/lib/discord_game_sdk/bin/aarch64/libdiscord_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",
|
||||
"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.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)
|
||||
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")
|
||||
|
@@ -87,14 +87,17 @@ SET_GET(is_public_party, activity.GetParty().SetPrivacy(static_cast<discord::Act
|
||||
|
||||
DiscordSDK::DiscordSDK()
|
||||
{
|
||||
ERR_FAIL_COND(singleton != nullptr);
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
DiscordSDK::~DiscordSDK()
|
||||
{
|
||||
singleton = nullptr;
|
||||
app_id = 0;
|
||||
delete core; // couldn't use destructor because it would not compile on linux
|
||||
core = nullptr;
|
||||
ERR_FAIL_COND(singleton != this);
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
DiscordSDK *DiscordSDK::get_singleton()
|
||||
@@ -207,6 +210,7 @@ void DiscordSDK::clear(bool reset_values = false)
|
||||
}
|
||||
else
|
||||
old_app_id = app_id;
|
||||
app_id = 0;
|
||||
delete core;
|
||||
core = nullptr;
|
||||
}
|
||||
|
55
src/editor_presence.cpp
Normal file
55
src/editor_presence.cpp
Normal 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
44
src/editor_presence.h
Normal 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
|
Submodule src/lib/godot-cpp updated: 78ffea5b13...4b63d795e4
@@ -7,6 +7,7 @@
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include "discordgodot.h"
|
||||
#include "editor_presence.h"
|
||||
using namespace godot;
|
||||
|
||||
static DiscordSDK *discordsdk;
|
||||
@@ -18,6 +19,7 @@ void initialize_discordsdk_module(ModuleInitializationLevel p_level)
|
||||
ClassDB::register_class<DiscordSDK>();
|
||||
discordsdk = memnew(DiscordSDK);
|
||||
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)
|
||||
{
|
||||
Engine::get_singleton()->unregister_singleton("DiscordSDK");
|
||||
memdelete(discordsdk);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user