From 71416cb4b388956d6132f6c8b5b77b0fb38b7a27 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 22 Dec 2018 10:46:06 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9vector=E5=88=86=E9=87=8F=E5=88=AB?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/math/je_vector2.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/libjin/math/je_vector2.hpp') diff --git a/src/libjin/math/je_vector2.hpp b/src/libjin/math/je_vector2.hpp index 4d76987..4be30fb 100644 --- a/src/libjin/math/je_vector2.hpp +++ b/src/libjin/math/je_vector2.hpp @@ -58,9 +58,17 @@ namespace JinEngine return data[0] == 0 && data[1] == 0; } - T &x = data[0], &y = data[1]; // xy - T &w = data[0], &h = data[1]; // wh - T &colum = data[0], &row = data[1]; // colum row + #define _aliases(A, B) \ + T& A() { return data[0]; }\ + T& B() { return data[1]; }\ + T A() const { return data[0]; }\ + T B() const { return data[1]; } + + _aliases(x, y) + _aliases(w, h) + _aliases(colum, row) + + #undef _aliases private: T data[2]; -- cgit v1.1-26-g67d0