Export variables with gdextension
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
@ -5,22 +5,52 @@
|
||||
|
||||
#include <godot_cpp/classes/image_texture.hpp>
|
||||
|
||||
void Test::start_test() {
|
||||
Ref<ImageTexture> tex(memnew(ImageTexture));
|
||||
|
||||
auto format = tex->get_format();
|
||||
UtilityFunctions::print(tex->get_reference_count());
|
||||
|
||||
Ref<ImageTexture> tex2 = tex;
|
||||
UtilityFunctions::print(tex->get_reference_count());
|
||||
|
||||
tex2.unref();
|
||||
UtilityFunctions::print(tex->get_reference_count());
|
||||
|
||||
tex.unref();
|
||||
}
|
||||
|
||||
void Test::_bind_methods() {
|
||||
ClassDB:
|
||||
ClassDB::bind_method(D_METHOD("start_test"), &Test::start_test);
|
||||
ClassDB::bind_method(D_METHOD("get_i_value"), &Test::get_i_value);
|
||||
ClassDB::bind_method(D_METHOD("set_i_value", "i_val"), &Test::set_i_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "i_value"), "set_i_value", "get_i_value");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_f_value"), &Test::get_f_value);
|
||||
ClassDB::bind_method(D_METHOD("set_f_value", "f_val"), &Test::set_f_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "f_value"), "set_f_value", "get_f_value");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_s_value"), &Test::get_s_value);
|
||||
ClassDB::bind_method(D_METHOD("set_s_value", "s_val"), &Test::set_s_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "s_value"), "set_s_value", "get_s_value");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_tex_value"), &Test::get_tex_value);
|
||||
ClassDB::bind_method(D_METHOD("set_tex_value", "tex"), &Test::set_tex_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tex_value", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_tex_value", "get_tex_value");
|
||||
}
|
||||
|
||||
int Test::get_i_value() {
|
||||
return i_value;
|
||||
}
|
||||
|
||||
void Test::set_i_value(int input) {
|
||||
i_value = input;
|
||||
}
|
||||
|
||||
float Test::get_f_value() {
|
||||
return f_value;
|
||||
}
|
||||
|
||||
void Test::set_f_value(float input) {
|
||||
f_value = input;
|
||||
}
|
||||
|
||||
String Test::get_s_value() {
|
||||
return s_value;
|
||||
}
|
||||
|
||||
void Test::set_s_value(String s) {
|
||||
s_value = s;
|
||||
}
|
||||
|
||||
Ref<Texture2D> Test::get_tex_value() {
|
||||
return tex_value;
|
||||
}
|
||||
|
||||
void Test::set_tex_value(Ref<Texture2D> tex) {
|
||||
tex_value = tex;
|
||||
}
|
||||
|
Reference in New Issue
Block a user