use pointers for objects, default arguments

This commit is contained in:
Karroffel
2017-04-04 21:02:44 +02:00
parent c40a9dce51
commit 8aaef5a6a2
5 changed files with 165 additions and 97 deletions

View File

@@ -15,12 +15,20 @@ namespace godot {
#define GODOT_CLASS(Name, Base) \
public: inline static char *___get_type_name() { return (char *) #Name; } \
inline static char *___get_base_type_name() { return (char *) #Base; } \
inline Name(godot_object *o) { __core_object = o; } \
inline Name(const Variant& obj) { __core_object = ((Object) obj).__core_object; } \
Base *self; \
inline Name(godot_object *o) { self = (Base *) o; } \
private:
// inline Name(Object o) { this = (Name *) godot_dlinstance_get_userdata(o.__core_object);\
// memcpy(this, p, sizeof(Name)); } \
// inline Name(const Variant& obj) { __core_object = ((Object) obj).__core_object; } \
template<class T>
T *as(Object *obj)
{
return (T *) godot_dlinstance_get_userdata(obj);
}
// instance and destroy funcs

View File

@@ -77,6 +77,10 @@ public:
operator String() const;
inline Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz,real_t tx, real_t ty, real_t tz) {
set(xx, xy, xz, yx, yy, yz, zx, zy, zz,tx, ty, tz);
}
Transform(const Basis& p_basis, const Vector3& p_origin=Vector3());
inline Transform() {}

View File

@@ -32,7 +32,7 @@ Variant::Variant(signed int p_int) // real one
Variant::Variant(unsigned int p_int)
{
godot_variant_new_int(&_godot_variant, p_int);
godot_variant_new_uint(&_godot_variant, p_int);
}
Variant::Variant(signed short p_short) // real one
@@ -48,7 +48,7 @@ Variant::Variant(int64_t p_char) // real one
Variant::Variant(uint64_t p_char)
{
godot_variant_new_int(&_godot_variant, p_char);
godot_variant_new_uint(&_godot_variant, p_char);
}
Variant::Variant(float p_float)
@@ -219,7 +219,7 @@ Variant::operator signed int() const
}
Variant::operator unsigned int() const // this is the real one
{
return godot_variant_as_int(&_godot_variant);
return godot_variant_as_uint(&_godot_variant);
}
Variant::operator signed short() const
{
@@ -227,7 +227,7 @@ Variant::operator signed short() const
}
Variant::operator unsigned short() const
{
return godot_variant_as_int(&_godot_variant);
return godot_variant_as_uint(&_godot_variant);
}
Variant::operator signed char() const
{
@@ -235,7 +235,7 @@ Variant::operator signed char() const
}
Variant::operator unsigned char() const
{
return godot_variant_as_int(&_godot_variant);
return godot_variant_as_uint(&_godot_variant);
}
Variant::operator int64_t() const
{
@@ -243,7 +243,7 @@ Variant::operator int64_t() const
}
Variant::operator uint64_t() const
{
return godot_variant_as_int(&_godot_variant);
return godot_variant_as_uint(&_godot_variant);
}