CEGUIVector.h

00001 /***********************************************************************
00002         filename:       CEGUIVector.h
00003         created:        14/3/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines interfaces for Vector classes
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIVector_h_
00031 #define _CEGUIVector_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUISize.h"
00035 
00036 
00037 // Start of CEGUI namespace section
00038 namespace CEGUI
00039 {
00040 
00045 class CEGUIEXPORT Vector2
00046 {
00047 public:
00048         Vector2(void) {}
00049         Vector2(float x, float y) : d_x(x), d_y(y) {}
00050 
00051         Vector2& operator*=(const Vector2& vec)
00052         {
00053                 d_x *= vec.d_x;
00054                 d_y *= vec.d_y;
00055 
00056                 return *this;
00057         }
00058 
00059         Vector2& operator/=(const Vector2& vec)
00060         {
00061                 d_x /= vec.d_x;
00062                 d_y /= vec.d_y;
00063 
00064                 return *this;
00065         }
00066 
00067         Vector2& operator+=(const Vector2& vec)
00068         {
00069                 d_x += vec.d_x;
00070                 d_y += vec.d_y;
00071 
00072                 return *this;
00073         }
00074 
00075         Vector2& operator-=(const Vector2& vec)
00076         {
00077                 d_x -= vec.d_x;
00078                 d_y -= vec.d_y;
00079 
00080                 return *this;
00081         }
00082 
00083         Vector2 operator+(const Vector2& vec) const
00084         {
00085                 return Vector2(d_x + vec.d_x, d_y + vec.d_y);
00086         }
00087 
00088         Vector2 operator-(const Vector2& vec) const
00089         {
00090                 return Vector2(d_x - vec.d_x, d_y - vec.d_y);
00091         }
00092 
00093         Vector2 operator*(const Vector2& vec) const
00094         {
00095                 return Vector2(d_x * vec.d_x, d_y * vec.d_y);
00096         }
00097 
00098         bool    operator==(const Vector2& vec) const
00099         {
00100                 return ((d_x == vec.d_x) && (d_y == vec.d_y));
00101         }
00102 
00103         bool    operator!=(const Vector2& vec) const
00104         {
00105                 return !(operator==(vec));
00106         }
00107 
00108     Size asSize() const     { return Size(d_x, d_y); }
00109 
00110         float d_x, d_y;
00111 };
00112 
00117 typedef Vector2         Point;
00118 
00119 
00124 class CEGUIEXPORT Vector3
00125 {
00126 public:
00127         Vector3(void) {}
00128         Vector3(float x, float y, float z) : d_x(x), d_y(y), d_z(z) {}
00129 
00130         float   d_x, d_y, d_z;
00131 };
00132 
00133 } // End of  CEGUI namespace section
00134 
00135 
00136 #endif  // end of guard _CEGUIVector_h_

Generated on Sun Nov 5 14:35:28 2006 for Crazy Eddies GUI System by  doxygen 1.4.7