mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Vector2 <-> Vector2i conversion operators.
This commit is contained in:
parent
cf8dd43fd7
commit
e34079ee46
@ -1,6 +1,7 @@
|
||||
#include "vector2.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "vector2i.h"
|
||||
|
||||
#define EPSILON 0.00001
|
||||
|
||||
@ -222,4 +223,8 @@ float &Vector2::operator[](int axis) {
|
||||
|
||||
Vector2::operator String() const {
|
||||
return "[" + String::num(x) + "," + String::num(y) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
Vector2::operator Vector2i() const {
|
||||
return Vector2i(x, y);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "core/string.h"
|
||||
|
||||
class Vector2i;
|
||||
|
||||
class Vector2 {
|
||||
public:
|
||||
Vector2 abs() const;
|
||||
@ -58,6 +60,7 @@ public:
|
||||
float &operator[](int axis);
|
||||
|
||||
operator String() const;
|
||||
operator Vector2i() const;
|
||||
|
||||
enum Axis {
|
||||
AXIS_X = 0,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "vector2i.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "vector2.h"
|
||||
|
||||
Vector2i Vector2i::abs() const {
|
||||
Vector2i b;
|
||||
@ -178,4 +179,8 @@ int &Vector2i::operator[](int axis) {
|
||||
|
||||
Vector2i::operator String() const {
|
||||
return "[" + String::num(x) + "," + String::num(y) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
Vector2i::operator Vector2() const {
|
||||
return Vector2(x, y);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "core/string.h"
|
||||
|
||||
class Vector2;
|
||||
|
||||
class Vector2i {
|
||||
public:
|
||||
Vector2i abs() const;
|
||||
@ -52,6 +54,7 @@ public:
|
||||
int &operator[](int axis);
|
||||
|
||||
operator String() const;
|
||||
operator Vector2() const;
|
||||
|
||||
enum Axis {
|
||||
AXIS_X = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user