Changeset 235


Ignore:
Timestamp:
Jan 19, 2011, 9:32:50 PM (10 years ago)
Author:
sam
Message:

Allow to access Int2, Float2 etc. members using [].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matrix.h

    r232 r235  
    2121    Vector2() { x = y = 0; }
    2222    Vector2(T _x, T _y) { x = _x; y = _y; }
     23    T& operator[](int n) { return *(&x + n); }
    2324
    2425    union { T x; T a; T i; };
     
    3334    Vector3() { x = y = z = 0; }
    3435    Vector3(T _x, T _y, T _z) { x = _x; y = _y; z = _z; }
     36    T& operator[](int n) { return *(&x + n); }
    3537
    3638    union { T x; T a; T i; };
Note: See TracChangeset for help on using the changeset viewer.