89 lines
1006 B
C
89 lines
1006 B
C
/*
|
|
* This file is automaticaly generated, Please dont edit this file!
|
|
*/
|
|
#include <vector2.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void vector2_constructor( vector2 * this, float x, float y ) {
|
|
|
|
|
|
|
|
this->x = x;
|
|
|
|
this->y = y;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
vector2 * vector2_operator_plus( vector2 * this, vector2 * b ) {
|
|
|
|
vector2_add( this, b );
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
vector2 * vector2_operator_add( vector2 * this, struct vector2 * b ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return b;
|
|
}
|
|
|
|
void vector2_add( vector2 * this, vector2 * a ) {
|
|
|
|
this->x += a->x;
|
|
|
|
this->y += a->y;
|
|
|
|
}
|
|
|
|
void vector2_subtract( vector2 * this, vector2 * a ) {
|
|
|
|
this->x -= a->x;
|
|
|
|
this->y -= a->y;
|
|
|
|
}
|
|
|
|
int vector2_length( vector2 * this ) {
|
|
|
|
return this->x + this->y;
|
|
|
|
}
|
|
|
|
vector2 vector2_new(float x, float y) {
|
|
|
|
vector2 instance;
|
|
|
|
vector2_constructor( &instance, x, y);
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
vector2 * vector2_newPointer(float x, float y) {
|
|
|
|
struct vector2 * pointer = malloc( sizeof ( struct vector2 ) );
|
|
|
|
vector2_constructor( pointer , x, y);
|
|
|
|
return pointer;
|
|
|
|
}
|
|
|