tried to implement get and set and variables but didnt work?
This commit is contained in:
Binary file not shown.
31
src/main.cpp
31
src/main.cpp
@@ -16,9 +16,17 @@ void DiscordSDK::_bind_methods()
|
||||
{
|
||||
ClassDB::bind_method(D_METHOD("debug"), &DiscordSDK::debug);
|
||||
ClassDB::bind_method(D_METHOD("coreupdate"), &DiscordSDK::coreupdate);
|
||||
ClassDB::bind_method(D_METHOD("set_app_id"), &DiscordSDK::set_app_id);
|
||||
ClassDB::bind_method(D_METHOD("set_state"), &DiscordSDK::set_state);
|
||||
ClassDB::bind_method(D_METHOD("set_details"), &DiscordSDK::set_details);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_app_id", "app_id"), &DiscordSDK::set_app_id);
|
||||
ClassDB::bind_method(D_METHOD("get_app_id", "app_id"), &DiscordSDK::get_app_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "app_id"), "set_app_id", "get_app_id");
|
||||
ClassDB::bind_method(D_METHOD("set_state", "state"), &DiscordSDK::set_state);
|
||||
ClassDB::bind_method(D_METHOD("get_state", "state"), &DiscordSDK::get_state);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "state"), "set_state", "get_state");
|
||||
ClassDB::bind_method(D_METHOD("set_details", "details"), &DiscordSDK::set_details);
|
||||
ClassDB::bind_method(D_METHOD("get_details", "details"), &DiscordSDK::get_details);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "details"), "set_details", "get_details");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("refresh"), &DiscordSDK::refresh);
|
||||
}
|
||||
|
||||
@@ -56,19 +64,34 @@ void DiscordSDK::coreupdate()
|
||||
::core->RunCallbacks();
|
||||
}
|
||||
|
||||
void DiscordSDK::set_app_id(int64_t appid)
|
||||
void DiscordSDK::set_app_id(int appid)
|
||||
{
|
||||
p_appid = appid;
|
||||
result = discord::Core::Create(appid, DiscordCreateFlags_NoRequireDiscord, &core);
|
||||
}
|
||||
int DiscordSDK::get_app_id()
|
||||
{
|
||||
return p_appid;
|
||||
}
|
||||
|
||||
void DiscordSDK::set_state(String state)
|
||||
{
|
||||
p_state = state;
|
||||
activity.SetState(state.utf8().get_data());
|
||||
}
|
||||
String DiscordSDK::get_state()
|
||||
{
|
||||
return p_state;
|
||||
}
|
||||
void DiscordSDK::set_details(String details)
|
||||
{
|
||||
p_details = details;
|
||||
activity.SetDetails(details.utf8().get_data());
|
||||
}
|
||||
String DiscordSDK::get_details()
|
||||
{
|
||||
return p_details;
|
||||
}
|
||||
|
||||
void DiscordSDK::refresh()
|
||||
{
|
||||
|
@@ -22,11 +22,18 @@ public:
|
||||
DiscordSDK();
|
||||
~DiscordSDK();
|
||||
|
||||
int p_appid;
|
||||
String p_state;
|
||||
String p_details;
|
||||
|
||||
void debug();
|
||||
void coreupdate();
|
||||
void refresh();
|
||||
void set_app_id(int64_t appid);
|
||||
int get_app_id();
|
||||
void set_app_id(int appid);
|
||||
String get_state();
|
||||
void set_state(String state);
|
||||
String get_details();
|
||||
void set_details(String details);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user