Added Vector2i, Vector3i, Vector4, Vector4i, Rect2i, and PoolVector2iArray.

This commit is contained in:
Relintai 2023-05-31 17:25:57 +02:00
parent 56f4e1ec46
commit 52b5a8e4db
15 changed files with 824 additions and 0 deletions

View File

@ -44,13 +44,19 @@
#include "Quaternion.hpp"
#include "RID.hpp"
#include "Rect2.hpp"
#include "Rect2i.hpp"
#include "String.hpp"
#include "StringName.hpp"
#include "Transform.hpp"
#include "Transform2D.hpp"
#include "Projection.hpp"
#include "Variant.hpp"
#include "Vector2.hpp"
#include "Vector2i.hpp"
#include "Vector3.hpp"
#include "Vector3i.hpp"
#include "Vector4.hpp"
#include "Vector4i.hpp"
#include "Wrapped.hpp"

View File

@ -37,6 +37,7 @@
#include "GodotGlobal.hpp"
#include "String.hpp"
#include "Vector2.hpp"
#include "Vector2i.hpp"
#include "Vector3.hpp"
#include <gdn/pool_arrays.h>
@ -557,6 +558,108 @@ public:
~PoolVector2Array();
};
class PoolVector2iArray {
pandemonium_pool_vector2i_array _pandemonium_array;
friend class Variant;
explicit inline PoolVector2iArray(pandemonium_pool_vector2i_array a) {
_pandemonium_array = a;
}
public:
class Read {
friend class PoolVector2iArray;
pandemonium_pool_vector2i_array_read_access *_read_access;
public:
inline Read() {
_read_access = nullptr;
}
inline Read(const Read &p_other) {
_read_access = godot::api->pandemonium_pool_vector2i_array_read_access_copy(p_other._read_access);
}
inline ~Read() {
godot::api->pandemonium_pool_vector2i_array_read_access_destroy(_read_access);
}
inline const Vector2i *ptr() const {
return (const Vector2i *)godot::api->pandemonium_pool_vector2i_array_read_access_ptr(_read_access);
}
inline const Vector2i &operator[](int p_idx) const {
return ptr()[p_idx];
}
inline void operator=(const Read &p_other) {
godot::api->pandemonium_pool_vector2i_array_read_access_operator_assign(_read_access, p_other._read_access);
}
};
class Write {
friend class PoolVector2iArray;
pandemonium_pool_vector2i_array_write_access *_write_access;
public:
inline Write() {
_write_access = nullptr;
}
inline Write(const Write &p_other) {
_write_access = godot::api->pandemonium_pool_vector2i_array_write_access_copy(p_other._write_access);
}
inline ~Write() {
godot::api->pandemonium_pool_vector2i_array_write_access_destroy(_write_access);
}
inline Vector2i *ptr() const {
return (Vector2i *)godot::api->pandemonium_pool_vector2i_array_write_access_ptr(_write_access);
}
inline Vector2i &operator[](int p_idx) const {
return ptr()[p_idx];
}
inline void operator=(const Write &p_other) {
godot::api->pandemonium_pool_vector2i_array_write_access_operator_assign(_write_access, p_other._write_access);
}
};
PoolVector2iArray();
PoolVector2iArray(const PoolVector2iArray &p_other);
PoolVector2iArray &operator=(const PoolVector2iArray &p_other);
PoolVector2iArray(const Array &array);
Read read() const;
Write write();
void append(const Vector2i &data);
void append_array(const PoolVector2iArray &array);
int insert(const int idx, const Vector2i &data);
void invert();
void push_back(const Vector2i &data);
void remove(const int idx);
void resize(const int size);
void set(const int idx, const Vector2i &data);
const Vector2i operator[](const int idx);
int size() const;
~PoolVector2iArray();
};
class PoolVector3Array {
pandemonium_pool_vector3_array _pandemonium_array;

66
include/core/Rect2i.hpp Normal file
View File

@ -0,0 +1,66 @@
/*************************************************************************/
/* Rect2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RECT2I_H
#define RECT2I_H
#include "Vector2i.hpp"
#include <cmath>
#include <cstdlib>
namespace godot {
class String;
typedef Vector2i Size2i;
typedef Vector2i Point2i;
struct Rect2i {
Point2i position;
Size2i size;
operator String() const;
inline Rect2i() {}
inline Rect2i(real_t p_x, real_t p_y, real_t p_width, real_t p_height) {
position = Point2i(p_x, p_y);
size = Size2i(p_width, p_height);
}
inline Rect2i(const Point2i &p_position, const Size2i &p_size) {
position = p_position;
size = p_size;
}
};
} // namespace godot
#endif // RECT2_H

View File

@ -41,14 +41,20 @@
#include "NodePath.hpp"
#include "Plane.hpp"
#include "PoolArrays.hpp"
#include "Projection.hpp"
#include "Quaternion.hpp"
#include "RID.hpp"
#include "Rect2.hpp"
#include "Rect2i.hpp"
#include "String.hpp"
#include "Transform.hpp"
#include "Transform2D.hpp"
#include "Vector2.hpp"
#include "Vector2i.hpp"
#include "Vector3.hpp"
#include "Vector3i.hpp"
#include "Vector4.hpp"
#include "Vector4i.hpp"
namespace godot {
@ -194,10 +200,16 @@ public:
Variant(const wchar_t *p_wstring);
Variant(const Vector2 &p_vector2);
Variant(const Vector2i &p_vector2i);
Variant(const Rect2 &p_rect2);
Variant(const Rect2i &p_rect2i);
Variant(const Vector3 &p_vector3);
Variant(const Vector3i &p_vector3i);
Variant(const Vector4 &p_vector4);
Variant(const Vector4i &p_vector4i);
Variant(const Plane &p_plane);
@ -211,6 +223,8 @@ public:
Variant(const Transform &p_transform);
Variant(const Projection &p_projection);
Variant(const Color &p_color);
Variant(const NodePath &p_path);
@ -257,14 +271,20 @@ public:
operator String() const;
operator StringName() const;
operator Vector2() const;
operator Vector2i() const;
operator Rect2() const;
operator Rect2i() const;
operator Vector3() const;
operator Vector3i() const;
operator Vector4() const;
operator Vector4i() const;
operator Plane() const;
operator godot::AABB() const;
operator Quaternion() const;
operator Basis() const;
operator Transform() const;
operator Transform2D() const;
operator Projection() const;
operator Color() const;

69
include/core/Vector2i.hpp Normal file
View File

@ -0,0 +1,69 @@
/*************************************************************************/
/* Vector2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR2I_H
#define VECTOR2I_H
#include <gdn/vector2i.h>
#include "Defs.hpp"
#include <Mathp.hpp>
namespace godot {
class String;
struct Vector2i {
union {
int32_t x;
int32_t width;
};
union {
int32_t y;
int32_t height;
};
inline Vector2i(int p_x, int p_y) {
x = p_x;
y = p_y;
}
inline Vector2i() {
x = 0;
y = 0;
}
operator String() const;
};
} // namespace godot
#endif // VECTOR2_H

72
include/core/Vector3i.hpp Normal file
View File

@ -0,0 +1,72 @@
/*************************************************************************/
/* Vector2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR3I_H
#define VECTOR3I_H
#include <gdn/vector3i.h>
#include "Defs.hpp"
#include <Mathp.hpp>
namespace godot {
class String;
struct Vector3i {
union {
struct {
int32_t x;
int32_t y;
int32_t z;
};
int32_t coord[3]; // Not for direct access, use [] operator instead
};
inline Vector3i(int p_x, int p_y, int p_z) {
x = p_x;
y = p_y;
z = p_z;
}
inline Vector3i() {
x = 0;
y = 0;
z = 0;
}
operator String() const;
};
} // namespace godot
#endif // VECTOR2_H

75
include/core/Vector4.hpp Normal file
View File

@ -0,0 +1,75 @@
/*************************************************************************/
/* Vector2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR4_H
#define VECTOR4_H
#include <gdn/vector4.h>
#include "Defs.hpp"
#include <Mathp.hpp>
namespace godot {
class String;
struct Vector4 {
union {
struct {
real_t x;
real_t y;
real_t z;
real_t w;
};
real_t coord[4]; // Not for direct access, use [] operator instead
};
inline Vector4(real_t p_x, real_t p_y, real_t p_z, real_t p_w) {
x = p_x;
y = p_y;
z = p_z;
w = p_w;
}
inline Vector4() {
x = 0;
y = 0;
z = 0;
w = 0;
}
operator String() const;
};
} // namespace godot
#endif // VECTOR2_H

75
include/core/Vector4i.hpp Normal file
View File

@ -0,0 +1,75 @@
/*************************************************************************/
/* Vector2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR4I_H
#define VECTOR4I_H
#include <gdn/vector4i.h>
#include "Defs.hpp"
#include <Mathp.hpp>
namespace godot {
class String;
struct Vector4i {
union {
struct {
int32_t x;
int32_t y;
int32_t z;
int32_t w;
};
int32_t coord[4]; // Not for direct access, use [] operator instead
};
inline Vector4i(int p_x, int p_y, int p_z, int p_w) {
x = p_x;
y = p_y;
z = p_z;
w = p_w;
}
inline Vector4i() {
x = 0;
y = 0;
z = 0;
w = 0;
}
operator String() const;
};
} // namespace godot
#endif // VECTOR2_H

View File

@ -34,6 +34,7 @@
#include "GodotGlobal.hpp"
#include "String.hpp"
#include "Vector2.hpp"
#include "Vector2i.hpp"
#include "Vector3.hpp"
#include <gdn/pool_arrays.h>
@ -416,6 +417,82 @@ PoolVector2Array::~PoolVector2Array() {
godot::api->pandemonium_pool_vector2_array_destroy(&_pandemonium_array);
}
PoolVector2iArray::PoolVector2iArray() {
godot::api->pandemonium_pool_vector2i_array_new(&_pandemonium_array);
}
PoolVector2iArray::PoolVector2iArray(const PoolVector2iArray &p_other) {
godot::api->pandemonium_pool_vector2i_array_new_copy(&_pandemonium_array, &p_other._pandemonium_array);
}
PoolVector2iArray &PoolVector2iArray::operator=(const PoolVector2iArray &p_other) {
godot::api->pandemonium_pool_vector2i_array_destroy(&_pandemonium_array);
godot::api->pandemonium_pool_vector2i_array_new_copy(&_pandemonium_array, &p_other._pandemonium_array);
return *this;
}
PoolVector2iArray::PoolVector2iArray(const Array &array) {
godot::api->pandemonium_pool_vector2i_array_new_with_array(&_pandemonium_array, (pandemonium_array *)&array);
}
PoolVector2iArray::Read PoolVector2iArray::read() const {
Read read;
read._read_access = godot::api->pandemonium_pool_vector2i_array_read(&_pandemonium_array);
return read;
}
PoolVector2iArray::Write PoolVector2iArray::write() {
Write write;
write._write_access = godot::api->pandemonium_pool_vector2i_array_write(&_pandemonium_array);
return write;
}
void PoolVector2iArray::append(const Vector2i &data) {
godot::api->pandemonium_pool_vector2i_array_append(&_pandemonium_array, (pandemonium_vector2i *)&data);
}
void PoolVector2iArray::append_array(const PoolVector2iArray &array) {
godot::api->pandemonium_pool_vector2i_array_append_array(&_pandemonium_array, &array._pandemonium_array);
}
int PoolVector2iArray::insert(const int idx, const Vector2i &data) {
return godot::api->pandemonium_pool_vector2i_array_insert(&_pandemonium_array, idx, (pandemonium_vector2i *)&data);
}
void PoolVector2iArray::invert() {
godot::api->pandemonium_pool_vector2i_array_invert(&_pandemonium_array);
}
void PoolVector2iArray::push_back(const Vector2i &data) {
godot::api->pandemonium_pool_vector2i_array_push_back(&_pandemonium_array, (pandemonium_vector2i *)&data);
}
void PoolVector2iArray::remove(const int idx) {
godot::api->pandemonium_pool_vector2i_array_remove(&_pandemonium_array, idx);
}
void PoolVector2iArray::resize(const int size) {
godot::api->pandemonium_pool_vector2i_array_resize(&_pandemonium_array, size);
}
void PoolVector2iArray::set(const int idx, const Vector2i &data) {
godot::api->pandemonium_pool_vector2i_array_set(&_pandemonium_array, idx, (pandemonium_vector2i *)&data);
}
const Vector2i PoolVector2iArray::operator[](const int idx) {
Vector2i v;
*(pandemonium_vector2i *)&v = godot::api->pandemonium_pool_vector2i_array_get(&_pandemonium_array, idx);
return v;
}
int PoolVector2iArray::size() const {
return godot::api->pandemonium_pool_vector2i_array_size(&_pandemonium_array);
}
PoolVector2iArray::~PoolVector2iArray() {
godot::api->pandemonium_pool_vector2i_array_destroy(&_pandemonium_array);
}
PoolVector3Array::PoolVector3Array() {
godot::api->pandemonium_pool_vector3_array_new(&_pandemonium_array);
}

41
src/core/Rect2i.cpp Normal file
View File

@ -0,0 +1,41 @@
/*************************************************************************/
/* Rect2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Rect2i.hpp"
#include "String.hpp"
#include "Vector2i.hpp"
namespace godot {
Rect2i::operator String() const {
return String(position) + ", " + String(size);
}
} // namespace godot

View File

@ -104,14 +104,34 @@ Variant::Variant(const Vector2 &p_vector2) {
godot::api->pandemonium_variant_new_vector2(&_pandemonium_variant, (pandemonium_vector2 *)&p_vector2);
}
Variant::Variant(const Vector2i &p_vector2i) {
godot::api->pandemonium_variant_new_vector2i(&_pandemonium_variant, (pandemonium_vector2i *)&p_vector2i);
}
Variant::Variant(const Rect2 &p_rect2) {
godot::api->pandemonium_variant_new_rect2(&_pandemonium_variant, (pandemonium_rect2 *)&p_rect2);
}
Variant::Variant(const Rect2i &p_rect2i) {
godot::api->pandemonium_variant_new_rect2i(&_pandemonium_variant, (pandemonium_rect2i *)&p_rect2i);
}
Variant::Variant(const Vector3 &p_vector3) {
godot::api->pandemonium_variant_new_vector3(&_pandemonium_variant, (pandemonium_vector3 *)&p_vector3);
}
Variant::Variant(const Vector3i &p_vector3i) {
godot::api->pandemonium_variant_new_vector3i(&_pandemonium_variant, (pandemonium_vector3 *)&p_vector3i);
}
Variant::Variant(const Vector4 &p_vector4) {
godot::api->pandemonium_variant_new_vector4(&_pandemonium_variant, (pandemonium_vector4 *)&p_vector4);
}
Variant::Variant(const Vector4i &p_vector4i) {
godot::api->pandemonium_variant_new_vector4i(&_pandemonium_variant, (pandemonium_vector4i *)&p_vector4i);
}
Variant::Variant(const Plane &p_plane) {
godot::api->pandemonium_variant_new_plane(&_pandemonium_variant, (pandemonium_plane *)&p_plane);
}
@ -136,6 +156,10 @@ Variant::Variant(const Transform &p_transform) {
godot::api->pandemonium_variant_new_transform(&_pandemonium_variant, (pandemonium_transform *)&p_transform);
}
Variant::Variant(const Projection &p_projection) {
godot::api->pandemonium_variant_new_projection(&_pandemonium_variant, (pandemonium_projection *)&p_projection);
}
Variant::Variant(const Color &p_color) {
godot::api->pandemonium_variant_new_color(&_pandemonium_variant, (pandemonium_color *)&p_color);
}
@ -249,14 +273,34 @@ Variant::operator Vector2() const {
pandemonium_vector2 s = godot::api->pandemonium_variant_as_vector2(&_pandemonium_variant);
return *(Vector2 *)&s;
}
Variant::operator Vector2i() const {
pandemonium_vector2i s = godot::api->pandemonium_variant_as_vector2i(&_pandemonium_variant);
return *(Vector2i *)&s;
}
Variant::operator Rect2() const {
pandemonium_rect2 s = godot::api->pandemonium_variant_as_rect2(&_pandemonium_variant);
return *(Rect2 *)&s;
}
Variant::operator Rect2i() const {
pandemonium_rect2i s = godot::api->pandemonium_variant_as_rect2i(&_pandemonium_variant);
return *(Rect2i *)&s;
}
Variant::operator Vector3() const {
pandemonium_vector3 s = godot::api->pandemonium_variant_as_vector3(&_pandemonium_variant);
return *(Vector3 *)&s;
}
Variant::operator Vector3i() const {
pandemonium_vector3i s = godot::api->pandemonium_variant_as_vector3i(&_pandemonium_variant);
return *(Vector3i *)&s;
}
Variant::operator Vector4() const {
pandemonium_vector4 s = godot::api->pandemonium_variant_as_vector4(&_pandemonium_variant);
return *(Vector4 *)&s;
}
Variant::operator Vector4i() const {
pandemonium_vector4i s = godot::api->pandemonium_variant_as_vector4i(&_pandemonium_variant);
return *(Vector4i *)&s;
}
Variant::operator Plane() const {
pandemonium_plane s = godot::api->pandemonium_variant_as_plane(&_pandemonium_variant);
return *(Plane *)&s;
@ -281,6 +325,10 @@ Variant::operator Transform2D() const {
pandemonium_transform2d s = godot::api->pandemonium_variant_as_transform2d(&_pandemonium_variant);
return *(Transform2D *)&s;
}
Variant::operator Projection() const {
pandemonium_projection s = godot::api->pandemonium_variant_as_projection(&_pandemonium_variant);
return *(Projection *)&s;
}
Variant::operator Color() const {
pandemonium_color s = godot::api->pandemonium_variant_as_color(&_pandemonium_variant);

43
src/core/Vector2i.cpp Normal file
View File

@ -0,0 +1,43 @@
/*************************************************************************/
/* Vector2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Vector2i.hpp"
#include <gdn/vector2i.h>
#include "String.hpp"
namespace godot {
Vector2i::operator String() const {
return String::num(x) + ", " + String::num(y);
}
} // namespace godot

43
src/core/Vector3i.cpp Normal file
View File

@ -0,0 +1,43 @@
/*************************************************************************/
/* Vector2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Vector3i.hpp"
#include <gdn/vector3i.h>
#include "String.hpp"
namespace godot {
Vector3i::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) ;
}
} // namespace godot

43
src/core/Vector4.cpp Normal file
View File

@ -0,0 +1,43 @@
/*************************************************************************/
/* Vector2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Vector4.hpp"
#include <gdn/vector4.h>
#include "String.hpp"
namespace godot {
Vector4::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
}
} // namespace godot

43
src/core/Vector4i.cpp Normal file
View File

@ -0,0 +1,43 @@
/*************************************************************************/
/* Vector2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Vector4i.hpp"
#include <gdn/vector4i.h>
#include "String.hpp"
namespace godot {
Vector4i::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
}
} // namespace godot