73 lines
1.9 KiB
C++
73 lines
1.9 KiB
C++
#include "test.hpp"
|
|
|
|
#include <godot_cpp/variant/utility_functions.hpp>
|
|
#include <godot_cpp/variant/variant.hpp>
|
|
|
|
void Test::_bind_methods() {
|
|
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");
|
|
ClassDB::bind_method(D_METHOD("start"), &Test::start);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
void Test::start() {
|
|
Node3D *node3d = memnew_arr(Node3D, 100);
|
|
|
|
uint64_t *i = (uint64_t *)memalloc(sizeof(uint64_t));
|
|
|
|
uint64_t *node3d_size = (uint64_t *)node3d - 1;
|
|
|
|
for (*i = 0; *i < *node3d_size; *i = *i + 1) {
|
|
UtilityFunctions::print(&node3d[*i]);
|
|
}
|
|
|
|
UtilityFunctions::print(*node3d_size);
|
|
memdelete_arr(node3d);
|
|
memdelete(i);
|
|
}
|
|
|