Small improvements to Vector2's api.

This commit is contained in:
Relintai 2023-05-26 14:32:17 +02:00
parent 66330f13c1
commit 06ff8e110b
2 changed files with 4 additions and 6 deletions

View File

@ -57,11 +57,11 @@ pandemonium_real GDAPI pandemonium_vector2_get_y(const pandemonium_vector2 *p_se
return self->y; return self->y;
} }
void GDAPI pandemonium_vector2_set_axis(pandemonium_vector2 *p_self, const pandemonium_int 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;
} }
pandemonium_real GDAPI pandemonium_vector2_get_axis(const pandemonium_vector2 *p_self, const pandemonium_int p_axis) { pandemonium_real GDAPI pandemonium_vector2_get_axis(const pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis) {
const Vector2 *self = (const Vector2 *)p_self; const Vector2 *self = (const Vector2 *)p_self;
return self->operator[](p_axis); return self->operator[](p_axis);
} }

View File

@ -60,8 +60,6 @@ extern "C" {
typedef enum { typedef enum {
PANDEMONIUM_VECTOR2_AXIS_X, PANDEMONIUM_VECTOR2_AXIS_X,
PANDEMONIUM_VECTOR2_AXIS_Y, PANDEMONIUM_VECTOR2_AXIS_Y,
PANDEMONIUM_VECTOR2_AXIS_COUNT,
} pandemonium_vector2_axis; } pandemonium_vector2_axis;
void GDAPI pandemonium_vector2_set_x(pandemonium_vector2 *p_self, const pandemonium_real p_x); void GDAPI pandemonium_vector2_set_x(pandemonium_vector2 *p_self, const pandemonium_real p_x);
@ -70,8 +68,8 @@ 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);
void GDAPI pandemonium_vector2_set_axis(pandemonium_vector2 *p_self, const pandemonium_int 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_int p_axis); pandemonium_real GDAPI pandemonium_vector2_get_axis(const pandemonium_vector2 *p_self, const pandemonium_vector2_axis p_axis);
void GDAPI pandemonium_vector2_set_all(pandemonium_vector2 *p_self, const pandemonium_real p_value); void GDAPI pandemonium_vector2_set_all(pandemonium_vector2 *p_self, const pandemonium_real p_value);