some NodePath fixes and better handling of Object type arguments
This commit is contained in:
@@ -9,7 +9,15 @@ namespace godot {
|
||||
|
||||
NodePath::NodePath()
|
||||
{
|
||||
String from = "";
|
||||
godot_node_path_new(&_node_path, (godot_string *) &from);
|
||||
}
|
||||
|
||||
NodePath::NodePath(const NodePath &other)
|
||||
{
|
||||
String from = other;
|
||||
godot_node_path_new(&_node_path, (godot_string *) &from);
|
||||
godot_node_path_copy(&_node_path, &other._node_path);
|
||||
}
|
||||
|
||||
NodePath::NodePath(const String &from)
|
||||
@@ -17,6 +25,12 @@ NodePath::NodePath(const String &from)
|
||||
godot_node_path_new(&_node_path, (godot_string *) &from);
|
||||
}
|
||||
|
||||
NodePath::NodePath(const char *contents)
|
||||
{
|
||||
String from = contents;
|
||||
godot_node_path_new(&_node_path, (godot_string *) &from);
|
||||
}
|
||||
|
||||
String NodePath::get_name(const int idx) const
|
||||
{
|
||||
godot_string str = godot_node_path_get_name(&_node_path, idx);
|
||||
@@ -63,6 +77,11 @@ NodePath::operator String() const
|
||||
return *(String *) &str;
|
||||
}
|
||||
|
||||
void NodePath::operator =(const NodePath& other)
|
||||
{
|
||||
godot_node_path_copy(&_node_path, &other._node_path);
|
||||
}
|
||||
|
||||
NodePath::~NodePath()
|
||||
{
|
||||
godot_node_path_destroy(&_node_path);
|
||||
|
||||
@@ -24,7 +24,11 @@ class GD_CPP_CORE_API NodePath
|
||||
public:
|
||||
NodePath();
|
||||
|
||||
NodePath(const String &from);
|
||||
NodePath(const NodePath &other);
|
||||
|
||||
NodePath(const String& from);
|
||||
|
||||
NodePath(const char *contents);
|
||||
|
||||
String get_name(const int idx) const;
|
||||
|
||||
@@ -42,6 +46,8 @@ public:
|
||||
|
||||
operator String() const;
|
||||
|
||||
void operator =(const NodePath& other);
|
||||
|
||||
~NodePath();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "String.hpp"
|
||||
|
||||
#include "NodePath.hpp"
|
||||
|
||||
namespace godot {
|
||||
|
||||
|
||||
@@ -119,6 +121,11 @@ bool String::operator >=(const String &s)
|
||||
return !(*this < s);
|
||||
}
|
||||
|
||||
String::operator NodePath() const
|
||||
{
|
||||
return NodePath(*this);
|
||||
}
|
||||
|
||||
const wchar_t *String::c_string() const
|
||||
{
|
||||
return godot_string_c_str(&_godot_string);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class NodePath;
|
||||
|
||||
class GD_CPP_CORE_API String
|
||||
{
|
||||
godot_string _godot_string;
|
||||
@@ -61,6 +63,8 @@ public:
|
||||
|
||||
bool operator >=(const String &s);
|
||||
|
||||
operator NodePath() const;
|
||||
|
||||
const wchar_t *c_string() const;
|
||||
|
||||
};
|
||||
|
||||
@@ -385,6 +385,10 @@ Variant::operator PoolColorArray() const
|
||||
godot_pool_color_array s = godot_variant_as_pool_color_array(&_godot_variant);
|
||||
return *(PoolColorArray *) &s;
|
||||
}
|
||||
Variant::operator Object*() const {
|
||||
godot_object *o = godot_variant_as_object(&_godot_variant);
|
||||
return (Object *) o;
|
||||
}
|
||||
|
||||
Variant::Type Variant::get_type() const
|
||||
{
|
||||
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
operator NodePath() const;
|
||||
operator RID() const;
|
||||
operator InputEvent() const;
|
||||
operator Object() const;
|
||||
operator Object*() const;
|
||||
|
||||
operator Dictionary() const;
|
||||
operator Array() const;
|
||||
|
||||
Reference in New Issue
Block a user