mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
Merge pull request #9918 from Calinou/gdextension-cpp-example-fix-add-property
Fix `ADD_PROPERTY()` calls in GDExtension C++ example to use correct syntax
This commit is contained in:
@@ -497,6 +497,7 @@ show the methods we end up changing, don't remove the lines we're omitting:
|
||||
void GDExample::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_amplitude"), &GDExample::get_amplitude);
|
||||
ClassDB::bind_method(D_METHOD("set_amplitude", "p_amplitude"), &GDExample::set_amplitude);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "amplitude"), "set_amplitude", "get_amplitude");
|
||||
}
|
||||
|
||||
@@ -554,7 +555,8 @@ showing the methods that have changed so don't remove anything we're omitting:
|
||||
...
|
||||
ClassDB::bind_method(D_METHOD("get_speed"), &GDExample::get_speed);
|
||||
ClassDB::bind_method(D_METHOD("set_speed", "p_speed"), &GDExample::set_speed);
|
||||
ADD_PROPERTY("GDExample", PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
|
||||
}
|
||||
|
||||
GDExample::GDExample() {
|
||||
@@ -648,7 +650,7 @@ as follows:
|
||||
|
||||
void GDExample::_bind_methods() {
|
||||
...
|
||||
ADD_PROPERTY("GDExample", PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("position_changed", PropertyInfo(Variant::OBJECT, "node"), PropertyInfo(Variant::VECTOR2, "new_pos")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user