diff --git a/.gitmodules b/.gitmodules index e497b19..ac404d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "src/lib/godot-cpp"] path = src/lib/godot-cpp url = https://github.com/godotengine/godot-cpp + branch = 4.2 diff --git a/build.py b/build.py index 5f9ddff..93fae2f 100644 --- a/build.py +++ b/build.py @@ -1,23 +1,28 @@ import os import sys -yes = {'yes', 'y', 'ye', ''} -no = {'no', 'n'} +yes = {"yes", "y", "ye", ""} +no = {"no", "n"} if len(sys.argv) > 1: choice = sys.argv[1].removeprefix("-") else: sys.stdout.write( - "Do you want to open only the built project instead of the Godot Editor after building? ([y]es/[n]o): ") + "Do you want to open only the built project instead of the Godot Editor after building? ([y]es/[n]o): " + ) choice = input().lower() if choice in yes: - os.system("python -m SCons && python -m SCons target=template_release && cd project && godot") + os.system( + "python -m SCons && python -m SCons target=template_release && cd project && godot" + ) elif choice in no: - if os.name == 'nt': + if os.name == "nt": 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: 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: sys.stdout.write("Please respond with 'yes' or 'no'") diff --git a/project/Node b/project/Node deleted file mode 100644 index 7e644f0..0000000 Binary files a/project/Node and /dev/null differ diff --git a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll index 28db412..e42f667 100644 Binary files a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll and b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll differ diff --git a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll index eec67c1..dd52740 100644 Binary files a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll and b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll differ diff --git a/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll b/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll new file mode 100644 index 0000000..dd52740 Binary files /dev/null and b/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll differ diff --git a/project/addons/discord-sdk-gd/plugin.cfg b/project/addons/discord-sdk-gd/plugin.cfg index db87b1e..badfe3f 100644 --- a/project/addons/discord-sdk-gd/plugin.cfg +++ b/project/addons/discord-sdk-gd/plugin.cfg @@ -3,5 +3,5 @@ name="DiscordSDK" description="Discord Game SDK support for GDScript in Godot" author="vaporvee" -version="3.2" +version="3.3" script="plugin.gd" diff --git a/project/addons/discord-sdk-gd/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index b732ca8..07d661b 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -13,7 +13,6 @@ func _enter_tree() -> void: ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true) ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) - ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true) func _enable_plugin() -> void: if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): diff --git a/project/project.godot b/project/project.godot index 259e006..8ed5900 100644 --- a/project/project.godot +++ b/project/project.godot @@ -13,7 +13,7 @@ config_version=5 config/name="GDExtension DiscordSDK Test Project" config/tags=PackedStringArray("vaporvee") run/main_scene="res://main.tscn" -config/features=PackedStringArray("4.1") +config/features=PackedStringArray("4.2") boot_splash/bg_color=Color(0.25098, 0.305882, 0.929412, 1) boot_splash/image="res://assets/Banner_v1.png" boot_splash/fullsize=false diff --git a/setup.py b/setup.py index 1be2156..7182e91 100644 --- a/setup.py +++ b/setup.py @@ -8,8 +8,8 @@ with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref: # Patch the SDK to actually build, since it's missing an include with open("src/lib/discord_game_sdk/cpp/types.h", "r+") as f: - s = f.read(); - f.seek(0); + s = f.read() + f.seek(0) f.write("#include \n" + s) copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/") @@ -47,4 +47,4 @@ 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") -os.system("git submodule update --init") +os.system("git submodule update --init --remote") diff --git a/src/discordgodot.cpp b/src/discordgodot.cpp index cf1487f..d625a01 100644 --- a/src/discordgodot.cpp +++ b/src/discordgodot.cpp @@ -89,16 +89,17 @@ SET_GET(is_public_party, activity.GetParty().SetPrivacy(static_cast~Core(); + } singleton = nullptr; } diff --git a/src/discordgodot.h b/src/discordgodot.h index d531790..c4a6abe 100644 --- a/src/discordgodot.h +++ b/src/discordgodot.h @@ -6,6 +6,11 @@ #include #include +#define H_SET_GET(variable_type, property_name) \ + variable_type property_name; \ + variable_type get_##property_name(); \ + void set_##property_name(variable_type value); + using namespace godot; class discord_sdk : public RefCounted @@ -29,98 +34,42 @@ public: Dictionary relationship2dict(discord::Relationship relationship); Dictionary user2dict(discord::User user); /// - - int64_t app_id = 0; - - String state; - String details; - - String large_image; - String large_image_text; - String small_image; - String small_image_text; - - int64_t start_timestamp; - int64_t end_timestamp; - - String party_id; - int32_t current_party_size; - int32_t max_party_size; - String match_secret; - String join_secret; - String spectate_secret; - - bool is_public_party; - - bool instanced; - - bool is_overlay_locked; + H_SET_GET(int64_t, app_id) + H_SET_GET(String, state) + H_SET_GET(String, details) + H_SET_GET(String, large_image) + H_SET_GET(String, large_image_text) + H_SET_GET(String, small_image) + H_SET_GET(String, small_image_text) + H_SET_GET(int64_t, start_timestamp) + H_SET_GET(int64_t, end_timestamp) + H_SET_GET(String, party_id) + H_SET_GET(int32_t, current_party_size) + H_SET_GET(int32_t, max_party_size) + H_SET_GET(String, match_secret) + H_SET_GET(String, join_secret) + H_SET_GET(String, spectate_secret) + H_SET_GET(bool, is_public_party) + H_SET_GET(bool, instanced) + H_SET_GET(bool, is_overlay_locked) void debug(); void coreupdate(); void refresh(); void clear(bool reset_values); - void unclear(); - int64_t get_app_id(); - void set_app_id(int64_t value); - String get_state(); - void set_state(String value); - String get_details(); - void set_details(String value); - - String get_large_image(); - void set_large_image(String value); - String get_large_image_text(); - void set_large_image_text(String value); - String get_small_image(); - void set_small_image(String value); - String get_small_image_text(); - void set_small_image_text(String value); - - int64_t get_start_timestamp(); - void set_start_timestamp(int64_t value); - int64_t get_end_timestamp(); - void set_end_timestamp(int64_t value); - - String get_party_id(); - void set_party_id(String value); - - int32_t get_current_party_size(); - void set_current_party_size(int32_t value); - int32_t get_max_party_size(); - void set_max_party_size(int32_t value); - String get_match_secret(); - void set_match_secret(String value); - String get_join_secret(); - void set_join_secret(String value); - String get_spectate_secret(); - void set_spectate_secret(String value); - - bool get_is_public_party(); - void set_is_public_party(bool value); - - bool get_instanced(); - void set_instanced(bool value); - bool get_is_overlay_enabled(); - bool get_is_overlay_locked(); - void set_is_overlay_locked(bool value); void open_invite_overlay(bool is_spectate); void open_server_invite_overlay(String invite_code); void open_voice_settings(); - void accept_join_request(int64_t user_id); void send_invite(int64_t user_id, bool is_spectate, String message_content); void accept_invite(int64_t user_id); - void register_command(String value); void register_steam(int32_t value); - Dictionary get_current_user(); Dictionary get_relationship(int64_t user_id); Array get_all_relationships(); - bool get_is_discord_working(); int get_result_int(); };