tried fixing getsetter

This commit is contained in:
2023-04-22 12:34:31 +02:00
parent b84993faed
commit 01cb2ad639
5 changed files with 11 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
extends Node extends Node
func _process(delta): func _process(delta):
DiscordActivity.coreupdate() DiscordSDK.coreupdate()

View File

@@ -1,7 +1,7 @@
extends Node extends Node
func _ready(): func _ready():
DiscordActivity.set_app_id(918857075105349632) DiscordSDK.set_app_id(918857075105349632)
DiscordActivity.set_details("Made with GDExtension") DiscordSDK.set_details("Made with GDExtension")
DiscordActivity.set_state("This is a test from GDScript in Godot 4") #TODO:Change functions to variables if possible DiscordSDK.set_state("This is a test from GDScript in Godot 4") #TODO:Change functions to variables if possible
DiscordActivity.refresh() DiscordSDK.refresh()

View File

@@ -16,6 +16,11 @@ class DiscordSDK : public Object
protected: protected:
static void _bind_methods(); static void _bind_methods();
private:
int app_id;
String state;
String details;
public: public:
static DiscordSDK *get_singleton(); static DiscordSDK *get_singleton();

View File

@@ -18,7 +18,7 @@ void gdextension_initialize(ModuleInitializationLevel p_level)
ClassDB::register_class<DiscordSDK>(); ClassDB::register_class<DiscordSDK>();
discordsdk = memnew(DiscordSDK); discordsdk = memnew(DiscordSDK);
Engine::get_singleton()->register_singleton("DiscordActivity", DiscordSDK::get_singleton()); // Cant change the class name in the cpp files for some reason Engine::get_singleton()->register_singleton("DiscordSDK", DiscordSDK::get_singleton()); // Cant change the class name in the cpp files for some reason
} }
} }