diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll index 1ac3946..9bc2bf4 100644 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll and b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll differ diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll index 46593ee..6e72728 100644 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll and b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll differ diff --git a/project/main.gd b/project/main.gd index 8fe58c6..eccee93 100644 --- a/project/main.gd +++ b/project/main.gd @@ -10,6 +10,9 @@ func _ready(): Discord_Activity.large_image_text = "Try it now!" Discord_Activity.small_image = "boss" Discord_Activity.small_image_text = "Fighting the end boss! D:" + + Discord_Activity.start_timestamp = int(Time.get_unix_time_from_system()) + #Discord_Activity.end_timestamp = 2492978400 #31. 12. 2048 in unix time Discord_Activity.refresh() - $Info.text = $Info.text.replace("{id}",str(Discord_Activity.app_id)).replace("{details}",Discord_Activity.details).replace("{state}",Discord_Activity.state).replace("{lkey}",Discord_Activity.large_image).replace("{ltext}",Discord_Activity.large_image_text).replace("{skey}",Discord_Activity.small_image).replace("{stext}",Discord_Activity.small_image_text) + $Info.text = $Info.text.replace("{id}",str(Discord_Activity.app_id)).replace("{details}",Discord_Activity.details).replace("{state}",Discord_Activity.state).replace("{lkey}",Discord_Activity.large_image).replace("{ltext}",Discord_Activity.large_image_text).replace("{skey}",Discord_Activity.small_image).replace("{stext}",Discord_Activity.small_image_text).replace("{stimestamp}",str(Discord_Activity.start_timestamp)).replace("{etimestamp}",str(Discord_Activity.end_timestamp)) diff --git a/project/main.tscn b/project/main.tscn index 44bdc99..a030686 100644 --- a/project/main.tscn +++ b/project/main.tscn @@ -45,7 +45,7 @@ text = "[center][font s=60][rainbow]DiscordSDK Test[/rainbow][/font]" offset_left = 7.0 offset_top = 6.0 offset_right = 514.0 -offset_bottom = 227.0 +offset_bottom = 399.0 text = "Application ID : {id} Details: {details} State: {state} @@ -53,4 +53,7 @@ State: {state} Large image key: {lkey} Large image text: {ltext} Small image key: {skey} -Small image text: {stext}" +Small image text: {stext} + +Start timestamp: {stimestamp} +End timestamp: {etimestamp}" diff --git a/src/activity.cpp b/src/activity.cpp index 565eb53..e8f7792 100644 --- a/src/activity.cpp +++ b/src/activity.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace godot; @@ -40,6 +41,13 @@ void Discord_Activity::_bind_methods() ClassDB::bind_method(D_METHOD("set_small_image_text", "large_small_text"), &Discord_Activity::set_small_image_text); ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image_text"), "set_small_image_text", "get_small_image_text"); + ClassDB::bind_method(D_METHOD("get_start_timestamp"), &Discord_Activity::get_start_timestamp); + ClassDB::bind_method(D_METHOD("set_start_timestamp", "start_timestamp"), &Discord_Activity::set_start_timestamp); + ADD_PROPERTY(PropertyInfo(Variant::INT, "start_timestamp"), "set_start_timestamp", "get_start_timestamp"); + ClassDB::bind_method(D_METHOD("get_end_timestamp"), &Discord_Activity::get_end_timestamp); + ClassDB::bind_method(D_METHOD("set_end_timestamp", "end_timestamp"), &Discord_Activity::set_end_timestamp); + ADD_PROPERTY(PropertyInfo(Variant::INT, "end_timestamp"), "set_end_timestamp", "get_end_timestamp"); + ClassDB::bind_method(D_METHOD("refresh"), &Discord_Activity::refresh); } @@ -70,6 +78,7 @@ void Discord_Activity::debug() debugactivity.GetAssets().SetLargeText("wow test text for large image"); debugactivity.GetAssets().SetSmallImage("godot"); debugactivity.GetAssets().SetSmallText("wow test text for small image"); + debugactivity.GetTimestamps().SetStart(1682242800); core->ActivityManager().UpdateActivity(debugactivity, [](discord::Result debugresult) {}); } @@ -147,4 +156,23 @@ void Discord_Activity::set_small_image_text(const String &value) String Discord_Activity::get_small_image_text() const { return small_image_text; +} + +void Discord_Activity::set_start_timestamp(const int64_t &value) +{ + start_timestamp = value; + activity.GetTimestamps().SetStart(value); +} +int64_t Discord_Activity::get_start_timestamp() const +{ + return activity.GetTimestamps().GetStart(); +} +void Discord_Activity::set_end_timestamp(const int64_t &value) +{ + end_timestamp = value; + activity.GetTimestamps().SetEnd(value); +} +int64_t Discord_Activity::get_end_timestamp() const +{ + return activity.GetTimestamps().GetEnd(); } \ No newline at end of file diff --git a/src/activity.h b/src/activity.h index 9ed1f42..3c57678 100644 --- a/src/activity.h +++ b/src/activity.h @@ -18,6 +18,7 @@ protected: private: int64_t app_id; + String state; String details; @@ -26,6 +27,9 @@ private: String small_image; String small_image_text; + int64_t start_timestamp; + int64_t end_timestamp; + public: static Discord_Activity *get_singleton(); @@ -37,6 +41,7 @@ public: void refresh(); int64_t get_app_id() const; + void set_app_id(const int64_t &value); String get_state() const; void set_state(const String &value); @@ -51,6 +56,11 @@ public: void set_small_image(const String &value); String get_small_image_text() const; void set_small_image_text(const String &value); + + int64_t get_start_timestamp() const; + void set_start_timestamp(const int64_t &value); + int64_t get_end_timestamp() const; + void set_end_timestamp(const int64_t &value); }; #endif \ No newline at end of file