Added operator methods to Vector2 and Vector2i.

This commit is contained in:
Relintai 2023-05-27 11:28:26 +02:00
parent 6c71a971f5
commit 2f1317bf4d
4 changed files with 24 additions and 0 deletions

View File

@ -57,6 +57,15 @@ pandemonium_real GDAPI pandemonium_vector2_get_y(const pandemonium_vector2 *p_se
return self->y; return self->y;
} }
pandemonium_real GDAPI *pandemonium_vector2_operator_index(pandemonium_vector2 *p_self, const pandemonium_int p_idx) {
Vector2 *self = (Vector2 *)p_self;
return (pandemonium_real *)&self->operator[](p_idx);
}
const pandemonium_real GDAPI *pandemonium_vector2_operator_index_const(const pandemonium_vector2 *p_self, const pandemonium_int p_idx) {
const Vector2 *self = (const Vector2 *)p_self;
return (const pandemonium_real *)&self->operator[](p_idx);
}
void GDAPI pandemonium_vector2_set_axis(pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis, const pandemonium_real p_value) { void GDAPI pandemonium_vector2_set_axis(pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis, const pandemonium_real p_value) {
Vector2 *self = (Vector2 *)p_self; Vector2 *self = (Vector2 *)p_self;
self->operator[](p_axis) = p_value; self->operator[](p_axis) = p_value;

View File

@ -57,6 +57,15 @@ pandemonium_real GDAPI pandemonium_vector2i_get_y(const pandemonium_vector2i *p_
return self->y; return self->y;
} }
pandemonium_real GDAPI *pandemonium_vector2i_operator_index(pandemonium_vector2i *p_self, const pandemonium_int p_idx) {
Vector2i *self = (Vector2i *)p_self;
return (pandemonium_real *)&self->operator[](p_idx);
}
const pandemonium_real GDAPI *pandemonium_vector2i_operator_index_const(const pandemonium_vector2i *p_self, const pandemonium_int p_idx) {
const Vector2i *self = (const Vector2i *)p_self;
return (const pandemonium_real *)&self->operator[](p_idx);
}
void GDAPI pandemonium_vector2i_set_axis(pandemonium_vector2i *p_self, const pandemonium_vector2i_axis p_axis, const pandemonium_real p_value) { void GDAPI pandemonium_vector2i_set_axis(pandemonium_vector2i *p_self, const pandemonium_vector2i_axis p_axis, const pandemonium_real p_value) {
Vector2i *self = (Vector2i *)p_self; Vector2i *self = (Vector2i *)p_self;
self->operator[](p_axis) = p_value; self->operator[](p_axis) = p_value;

View File

@ -68,6 +68,9 @@ void GDAPI pandemonium_vector2_set_y(pandemonium_vector2 *p_self, const pandemon
pandemonium_real GDAPI pandemonium_vector2_get_x(const pandemonium_vector2 *p_self); pandemonium_real GDAPI pandemonium_vector2_get_x(const pandemonium_vector2 *p_self);
pandemonium_real GDAPI pandemonium_vector2_get_y(const pandemonium_vector2 *p_self); pandemonium_real GDAPI pandemonium_vector2_get_y(const pandemonium_vector2 *p_self);
pandemonium_real GDAPI *pandemonium_vector2_operator_index(pandemonium_vector2 *p_self, const pandemonium_int p_idx);
const pandemonium_real GDAPI *pandemonium_vector2_operator_index_const(const pandemonium_vector2 *p_self, const pandemonium_int p_idx);
void GDAPI pandemonium_vector2_set_axis(pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis, const pandemonium_real p_value); void GDAPI pandemonium_vector2_set_axis(pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis, const pandemonium_real p_value);
pandemonium_real GDAPI pandemonium_vector2_get_axis(const pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis); pandemonium_real GDAPI pandemonium_vector2_get_axis(const pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis);

View File

@ -68,6 +68,9 @@ void GDAPI pandemonium_vector2i_set_y(pandemonium_vector2i *p_self, const pandem
pandemonium_real GDAPI pandemonium_vector2i_get_x(const pandemonium_vector2i *p_self); pandemonium_real GDAPI pandemonium_vector2i_get_x(const pandemonium_vector2i *p_self);
pandemonium_real GDAPI pandemonium_vector2i_get_y(const pandemonium_vector2i *p_self); pandemonium_real GDAPI pandemonium_vector2i_get_y(const pandemonium_vector2i *p_self);
pandemonium_real GDAPI *pandemonium_vector2i_operator_index(pandemonium_vector2i *p_self, const pandemonium_int p_idx);
const pandemonium_real GDAPI *pandemonium_vector2i_operator_index_const(const pandemonium_vector2i *p_self, const pandemonium_int p_idx);
void GDAPI pandemonium_vector2i_set_axis(pandemonium_vector2i *p_self, const pandemonium_vector2i_axis p_axis, const pandemonium_real p_value); void GDAPI pandemonium_vector2i_set_axis(pandemonium_vector2i *p_self, const pandemonium_vector2i_axis p_axis, const pandemonium_real p_value);
pandemonium_real GDAPI pandemonium_vector2i_get_axis(const pandemonium_vector2i *p_self, const pandemonium_vector2i_axis p_axis); pandemonium_real GDAPI pandemonium_vector2i_get_axis(const pandemonium_vector2i *p_self, const pandemonium_vector2i_axis p_axis);