Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
d3919d249b | |||
91c4946116 | |||
cd19b48ca8 | |||
dc7b4b43ad | |||
37c679d1bc | |||
9f1395c6a7 | |||
0fb4526191 | |||
|
f8a84cf3d5 | ||
7859bd0a77 | |||
f5560593d0 | |||
3f58da00ad | |||
ea829e8603 | |||
1e1bc6c59d | |||
|
5153c4e9ed | ||
|
5f56cf4b26 |
7
.github/ISSUE_TEMPLATE/BUG.yml
vendored
7
.github/ISSUE_TEMPLATE/BUG.yml
vendored
@@ -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,7 @@ 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.1.0
|
||||||
- 1.0.1
|
- 1.0.1
|
||||||
- 1.0.0
|
- 1.0.0
|
||||||
- 0.3.2
|
- 0.3.2
|
||||||
|
5
.vscode/extensions.json
vendored
5
.vscode/extensions.json
vendored
@@ -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
59
.vscode/settings.json
vendored
@@ -4,64 +4,7 @@
|
|||||||
"${workspaceFolder}/src/lib/godot-cpp/include"
|
"${workspaceFolder}/src/lib/godot-cpp/include"
|
||||||
],
|
],
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"xlocbuf": "cpp",
|
"*.gdextension": "config-definition"
|
||||||
"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"
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<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)
|
# [Quick start :rocket: (click here)](https://github.com/vaporvee/discord-sdk-godot/wiki#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!**
|
||||||
|
@@ -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,
|
||||||
)
|
)
|
||||||
|
6
build.py
6
build.py
@@ -16,10 +16,14 @@ 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":
|
if os.name == "nt": # 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"
|
||||||
)
|
)
|
||||||
|
elif os.name == "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:
|
else:
|
||||||
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"
|
||||||
|
@@ -5,8 +5,10 @@ compatibility_minimum = 4.2
|
|||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
macos.debug = "macos/libdiscord_game_sdk_binding_debug.dylib"
|
macos.debug.x86_64 = "macos/libdiscord_game_sdk_binding_debug.dylib"
|
||||||
macos.release = "macos/libdiscord_game_sdk_binding.dylib"
|
macos.release.x86_64 = "macos/libdiscord_game_sdk_binding.dylib"
|
||||||
|
macos.debug.arm64 = "macos/libdiscord_game_sdk_binding_arm64_debug.dylib"
|
||||||
|
macos.release.arm64 = "macos/libdiscord_game_sdk_binding_arm64.dylib"
|
||||||
windows.debug.x86_64 = "windows/discord_game_sdk_binding_debug.dll"
|
windows.debug.x86_64 = "windows/discord_game_sdk_binding_debug.dll"
|
||||||
windows.release.x86_64 = "windows/discord_game_sdk_binding.dll"
|
windows.release.x86_64 = "windows/discord_game_sdk_binding.dll"
|
||||||
linux.debug.x86_64 = "linux/libdiscord_game_sdk_binding_debug.so"
|
linux.debug.x86_64 = "linux/libdiscord_game_sdk_binding_debug.so"
|
||||||
@@ -18,8 +20,10 @@ linux.release.rv64 = "linux/libdiscord_game_sdk_binding.so"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
macos.debug = { "macos/libdiscord_game_sdk.dylib": "" }
|
macos.debug.x86_64 = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||||
macos.release = { "macos/libdiscord_game_sdk.dylib": "" }
|
macos.release.x86_64 = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||||
|
macos.debug.arm64 = { "macos/libdiscord_game_sdk_aarch64": "" }
|
||||||
|
macos.release.arm64 = { "macos/libdiscord_game_sdk_aarch64": "" }
|
||||||
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": "" }
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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()
|
|
||||||
|
@@ -3,5 +3,6 @@
|
|||||||
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.1.0"
|
||||||
script="plugin.gd"
|
script="plugin.gd"
|
||||||
|
editor_presence=true
|
||||||
|
@@ -5,12 +5,21 @@ 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)
|
EditorInterface.get_editor_settings().settings_changed.connect(_on_editor_settings_changed)
|
||||||
ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
|
await RenderingServer.frame_post_draw
|
||||||
ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false)
|
plugin_cfg.load(EditorInterface.get_editor_paths().get_data_dir() + plugin_data_filename)
|
||||||
|
print(EditorInterface.get_editor_paths().get_data_dir())
|
||||||
|
if !EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
|
||||||
|
EditorInterface.get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",plugin_cfg.get_value("Discord","editor_presence",false))
|
||||||
|
|
||||||
|
func _exit_tree():
|
||||||
|
if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
|
||||||
|
EditorInterface.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"):
|
||||||
@@ -25,7 +34,7 @@ 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")
|
EditorInterface.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:
|
||||||
@@ -34,3 +43,14 @@ func save_and_restart() -> void:
|
|||||||
|
|
||||||
func save_no_restart() -> void:
|
func save_no_restart() -> void:
|
||||||
EditorInterface.restart_editor(false)
|
EditorInterface.restart_editor(false)
|
||||||
|
|
||||||
|
var editor_presence: Node
|
||||||
|
func _on_editor_settings_changed() -> void:
|
||||||
|
plugin_cfg.set_value("Discord","editor_presence",EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"))
|
||||||
|
plugin_cfg.save(EditorInterface.get_editor_paths().get_data_dir() + plugin_data_filename)
|
||||||
|
if ClassDB.class_exists("EditorPresence") && editor_presence == null:
|
||||||
|
editor_presence = ClassDB.instantiate("EditorPresence")
|
||||||
|
if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled") && EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"):
|
||||||
|
add_child(editor_presence)
|
||||||
|
else:
|
||||||
|
editor_presence.queue_free()
|
||||||
|
@@ -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_oelge"]
|
||||||
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_oelge")
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
||||||
|
|
||||||
@@ -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!"
|
||||||
|
@@ -93,6 +93,7 @@ DiscordSDK::DiscordSDK()
|
|||||||
DiscordSDK::~DiscordSDK()
|
DiscordSDK::~DiscordSDK()
|
||||||
{
|
{
|
||||||
singleton = nullptr;
|
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;
|
||||||
}
|
}
|
||||||
@@ -207,6 +208,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;
|
||||||
}
|
}
|
||||||
|
54
src/editor_presence.cpp
Normal file
54
src/editor_presence.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#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>
|
||||||
|
|
||||||
|
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 = editor_interface->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();
|
||||||
|
}
|
45
src/editor_presence.h
Normal file
45
src/editor_presence.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#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/editor_interface.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();
|
||||||
|
godot::EditorInterface *editor_interface = godot::EditorInterface::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
|
@@ -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>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user