fixed a lot of bugs but broke linux support
This commit is contained in:
10
SConstruct
10
SConstruct
@@ -28,7 +28,9 @@ else:
|
||||
# make sure our binding library is properly includes
|
||||
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/"]) # this line for some reason doesn't get understanded by most linux distros
|
||||
env.Append(
|
||||
CPPPATH=["src/lib/discord_game_sdk/cpp/"]
|
||||
) # this line for some reason doesn't get understanded by most linux distros
|
||||
env.Append(LIBS=["discord_game_sdk"])
|
||||
|
||||
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
||||
@@ -51,11 +53,13 @@ env.Depends(
|
||||
Copy("$TARGET", "$SOURCE"),
|
||||
),
|
||||
)
|
||||
if(discord_library_second != ""):
|
||||
if discord_library_second != "":
|
||||
env.Depends(
|
||||
library,
|
||||
Command(
|
||||
"project/addons/discord-sdk-gd/bin/" + libexportfolder + discord_library_second,
|
||||
"project/addons/discord-sdk-gd/bin/"
|
||||
+ libexportfolder
|
||||
+ discord_library_second,
|
||||
"src/lib/discord_game_sdk/bin/" + discord_library_second,
|
||||
Copy("$TARGET", "$SOURCE"),
|
||||
),
|
||||
|
BIN
project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk.so
Normal file
BIN
project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk.so
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +1,12 @@
|
||||
## [color=yellow]PLEASE IGNORE![/color] This is a important Node wich gets automatically added as Singleton.
|
||||
## This is a GDscript Node wich gets automatically added as Autoload while installing the addon.
|
||||
##
|
||||
## The DiscordSDKLoader Node automatically gets added as Singleton while installing the addon.
|
||||
## It has to run in the background to comunicate with Discord.
|
||||
## You don't need to use it.
|
||||
## 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]discord_sdk.run_callbacks()[/code] in a [code]_process[/code] function.
|
||||
##
|
||||
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
|
||||
@tool
|
||||
class_name core_updater
|
||||
extends Node
|
||||
class_name DiscordSDKLoaderAutoload
|
||||
|
||||
func _process(_delta):
|
||||
if(ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled") && Engine.is_editor_hint()):
|
||||
@@ -20,4 +19,4 @@ func _process(_delta):
|
||||
discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
discord_sdk.refresh()
|
||||
if(discord_sdk.app_id == 1108142249990176808 || !Engine.is_editor_hint()):
|
||||
discord_sdk.coreupdate()
|
||||
discord_sdk.run_callbacks()
|
@@ -13,15 +13,16 @@ 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)
|
||||
get_node("/root/").add_child(DiscordLoader.new())
|
||||
|
||||
func _enable_plugin() -> void:
|
||||
add_autoload_singleton("DiscordSDKAutoload","res://addons/discord-sdk-gd/nodes/discord_autoload.gd")
|
||||
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")
|
||||
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore"):
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore")
|
||||
|
||||
func _disable_plugin() -> void:
|
||||
remove_autoload_singleton("DiscordSDKAutoload")
|
||||
FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
|
||||
FileAccess.open("res://addons/discord-sdk-gd/nodes/.gdignore",FileAccess.WRITE)
|
||||
remove_custom_type("DiscordSDKDebug")
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/variant/utility_functions.hpp>
|
||||
|
||||
#define BIND_METHOD(method, ...) godot::ClassDB::bind_method(D_METHOD(#method, __VA_ARGS__), &discord_sdk::method)
|
||||
#define BIND_METHOD(method, ...) godot::ClassDB::bind_method(D_METHOD(#method, ##__VA_ARGS__), &discord_sdk::method)
|
||||
#define BIND_SET_GET(property_name, variant_type) \
|
||||
godot::ClassDB::bind_method(D_METHOD("get_" #property_name), &discord_sdk::get_##property_name); \
|
||||
godot::ClassDB::bind_method(D_METHOD("set_" #property_name, #variant_type), &discord_sdk::set_##property_name); \
|
||||
@@ -49,7 +49,7 @@ void discord_sdk::_bind_methods()
|
||||
BIND_SIGNAL(overlay_toggle, PropertyInfo(Variant::BOOL, "is_locked"));
|
||||
BIND_SIGNAL(relationships_init);
|
||||
BIND_METHOD(debug);
|
||||
BIND_METHOD(coreupdate);
|
||||
BIND_METHOD(run_callbacks);
|
||||
BIND_METHOD(refresh);
|
||||
ClassDB::bind_method(D_METHOD("clear", "reset_values"), &discord_sdk::clear, DEFVAL(false));
|
||||
BIND_METHOD(unclear);
|
||||
@@ -93,11 +93,8 @@ discord_sdk::discord_sdk()
|
||||
|
||||
discord_sdk::~discord_sdk()
|
||||
{
|
||||
if (app_id != 0)
|
||||
{
|
||||
set_app_id(0);
|
||||
core->~Core();
|
||||
}
|
||||
app_id = 0;
|
||||
core->~Core();
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
@@ -106,7 +103,7 @@ discord_sdk *discord_sdk::get_singleton()
|
||||
return singleton;
|
||||
}
|
||||
|
||||
void discord_sdk::coreupdate()
|
||||
void discord_sdk::run_callbacks()
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
::core->RunCallbacks();
|
||||
@@ -173,7 +170,7 @@ int64_t discord_sdk::get_app_id()
|
||||
|
||||
void discord_sdk::refresh()
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
{
|
||||
activity.GetParty().SetPrivacy(discord::ActivityPartyPrivacy::Public);
|
||||
activity.SetType(discord::ActivityType::Playing);
|
||||
@@ -185,7 +182,7 @@ void discord_sdk::refresh()
|
||||
|
||||
void discord_sdk::clear(bool reset_values = false)
|
||||
{
|
||||
if (result == discord::Result::Ok)
|
||||
if (get_is_discord_working())
|
||||
{
|
||||
if (reset_values)
|
||||
{
|
||||
@@ -212,8 +209,7 @@ void discord_sdk::clear(bool reset_values = false)
|
||||
else
|
||||
old_app_id = app_id;
|
||||
set_app_id(0);
|
||||
delete core;
|
||||
core = nullptr;
|
||||
core->~Core();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,69 +228,69 @@ void discord_sdk::unclear()
|
||||
bool discord_sdk::get_is_overlay_enabled()
|
||||
{
|
||||
bool ie;
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->OverlayManager().IsEnabled(&ie);
|
||||
return ie;
|
||||
}
|
||||
bool discord_sdk::get_is_overlay_locked()
|
||||
{
|
||||
bool il;
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->OverlayManager().IsLocked(&il);
|
||||
return il;
|
||||
}
|
||||
void discord_sdk::set_is_overlay_locked(bool value)
|
||||
{
|
||||
is_overlay_locked = value;
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->OverlayManager().SetLocked(value, {});
|
||||
}
|
||||
void discord_sdk::open_invite_overlay(bool is_spectate)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->OverlayManager().OpenActivityInvite(static_cast<discord::ActivityActionType>(is_spectate + 1), {});
|
||||
}
|
||||
void discord_sdk::open_server_invite_overlay(String invite_code)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->OverlayManager().OpenGuildInvite(invite_code.utf8().get_data(), {});
|
||||
}
|
||||
void discord_sdk::open_voice_settings()
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->OverlayManager().OpenVoiceSettings({});
|
||||
}
|
||||
|
||||
void discord_sdk::accept_join_request(int64_t user_id)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->ActivityManager().SendRequestReply(user_id, static_cast<discord::ActivityJoinRequestReply>(1), {});
|
||||
}
|
||||
void discord_sdk::send_invite(int64_t user_id, bool is_spectate = false, String message_content = "")
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->ActivityManager().SendInvite(user_id, static_cast<discord::ActivityActionType>(is_spectate + 1), message_content.utf8().get_data(), {});
|
||||
}
|
||||
void discord_sdk::accept_invite(int64_t user_id)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->ActivityManager().AcceptInvite(user_id, {});
|
||||
}
|
||||
|
||||
void discord_sdk::register_command(String value)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->ActivityManager().RegisterCommand(value.utf8().get_data());
|
||||
}
|
||||
void discord_sdk::register_steam(int32_t value)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
core->ActivityManager().RegisterSteam(value);
|
||||
}
|
||||
Dictionary discord_sdk::get_current_user()
|
||||
{
|
||||
Dictionary userdict;
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
{
|
||||
discord::User user{};
|
||||
core->UserManager().GetCurrentUser(&user);
|
||||
@@ -305,7 +301,7 @@ Dictionary discord_sdk::get_current_user()
|
||||
|
||||
Dictionary discord_sdk::get_relationship(int64_t user_id)
|
||||
{
|
||||
if (result == discord::Result::Ok && app_id > 0)
|
||||
if (get_is_discord_working())
|
||||
{
|
||||
discord::Relationship relationship{};
|
||||
core->RelationshipManager().Get(user_id, &relationship);
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
H_SET_GET(bool, is_overlay_locked)
|
||||
|
||||
void debug();
|
||||
void coreupdate();
|
||||
void run_callbacks();
|
||||
void refresh();
|
||||
void clear(bool reset_values);
|
||||
void unclear();
|
||||
|
Submodule src/lib/godot-cpp updated: d627942b64...54136ee835
@@ -1,26 +0,0 @@
|
||||
#include "loader_node.h"
|
||||
#include "discordgodot.h"
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/variant/utility_functions.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#define EDITOR_PRESENCE_ID 1108142249990176808
|
||||
|
||||
void DiscordLoader::_bind_methods()
|
||||
{
|
||||
}
|
||||
|
||||
DiscordLoader::DiscordLoader()
|
||||
{
|
||||
}
|
||||
|
||||
DiscordLoader::~DiscordLoader()
|
||||
{
|
||||
}
|
||||
|
||||
void DiscordLoader::_process(double delta)
|
||||
{
|
||||
discord_sdk *singleton = discord_sdk::get_singleton();
|
||||
singleton->coreupdate();
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
#ifndef LOADER_NODE_H
|
||||
#define LOADER_NODE_H
|
||||
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
|
||||
namespace godot
|
||||
{
|
||||
|
||||
class DiscordLoader : public Node
|
||||
{
|
||||
GDCLASS(DiscordLoader, Node)
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
DiscordLoader();
|
||||
~DiscordLoader();
|
||||
|
||||
void _process(double delta) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -7,7 +7,6 @@
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include "discordgodot.h"
|
||||
#include "loader_node.h"
|
||||
using namespace godot;
|
||||
|
||||
static discord_sdk *discordsdk;
|
||||
@@ -20,7 +19,6 @@ void initialize_discordsdk_module(ModuleInitializationLevel p_level)
|
||||
discordsdk = memnew(discord_sdk);
|
||||
Engine::get_singleton()->register_singleton("discord_sdk", discord_sdk::get_singleton());
|
||||
}
|
||||
ClassDB::register_class<DiscordLoader>();
|
||||
}
|
||||
|
||||
void uninitialize_discordsdk_module(ModuleInitializationLevel p_level)
|
||||
|
Reference in New Issue
Block a user