aboutsummaryrefslogtreecommitdiff
path: root/dep/g3dlite/source/Vector2int16.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dep/g3dlite/source/Vector2int16.cpp')
-rw-r--r--dep/g3dlite/source/Vector2int16.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/dep/g3dlite/source/Vector2int16.cpp b/dep/g3dlite/source/Vector2int16.cpp
index 2a4035a4d09..16893eb1752 100644
--- a/dep/g3dlite/source/Vector2int16.cpp
+++ b/dep/g3dlite/source/Vector2int16.cpp
@@ -1,10 +1,10 @@
/**
- @file Vector2int16.cpp
+ \file G3D/Vector2int16.cpp
- @author Morgan McGuire, http://graphics.cs.williams.edu
+ \author Morgan McGuire, http://graphics.cs.williams.edu
- @created 2003-08-09
- @edited 2006-01-29
+ \created 2003-08-09
+ \edited 2011-01-06
*/
#include "G3D/platform.h"
@@ -13,9 +13,41 @@
#include "G3D/Vector2.h"
#include "G3D/BinaryInput.h"
#include "G3D/BinaryOutput.h"
+#include "G3D/Any.h"
+#include "G3D/Vector2int32.h"
namespace G3D {
+Vector2int16::Vector2int16(const class Vector2int32& v) : x(v.x), y(v.y) {}
+
+Vector2int16::Vector2int16(const Any& any) {
+ any.verifyName("Vector2int16", "Point2int16");
+ any.verifyType(Any::TABLE, Any::ARRAY);
+ any.verifySize(2);
+
+ if (any.type() == Any::ARRAY) {
+ x = any[0];
+ y = any[1];
+ } else {
+ // Table
+ x = any["x"];
+ y = any["y"];
+ }
+}
+
+
+Vector2int16& Vector2int16::operator=(const Any& a) {
+ *this = Vector2int16(a);
+ return *this;
+}
+
+
+Any Vector2int16::toAny() const {
+ Any any(Any::ARRAY, "Vector2int16");
+ any.append(x, y);
+ return any;
+}
+
Vector2int16::Vector2int16(const class Vector2& v) {
x = (int16)iFloor(v.x + 0.5);
y = (int16)iFloor(v.y + 0.5);