| Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
00001 // Copyright (C) 2002-2008 Nikolaus Gebhardt 00002 // This file is part of the "Irrlicht Engine". 00003 // For conditions of distribution and use, see copyright notice in irrlicht.h 00004 00005 #ifndef __IRR_DIMENSION2D_H_INCLUDED__ 00006 #define __IRR_DIMENSION2D_H_INCLUDED__ 00007 00008 #include "irrTypes.h" 00009 00010 namespace irr 00011 { 00012 namespace core 00013 { 00014 00016 template <class T> 00017 class dimension2d 00018 { 00019 public: 00021 dimension2d() : Width(0), Height(0) {} 00023 dimension2d(const T& width, const T& height) 00024 : Width(width), Height(height) {} 00025 00027 bool operator==(const dimension2d<T>& other) const 00028 { 00029 return Width == other.Width && Height == other.Height; 00030 } 00031 00033 bool operator!=(const dimension2d<T>& other) const 00034 { 00035 return ! (*this == other); 00036 } 00037 00038 00040 dimension2d<T>& set(const T& width, const T& height) 00041 { 00042 Width = width; 00043 Height = height; 00044 return *this; 00045 } 00046 00048 dimension2d<T>& operator/=(const T& scale) 00049 { 00050 Width /= scale; 00051 Height /= scale; 00052 return *this; 00053 } 00054 00056 dimension2d<T> operator/(const T& scale) const 00057 { 00058 return dimension2d<T>(Width/scale, Height/scale); 00059 } 00060 00062 dimension2d<T>& operator*=(const T& scale) 00063 { 00064 Width *= scale; 00065 Height *= scale; 00066 return *this; 00067 } 00068 00070 dimension2d<T> operator*(const T& scale) const 00071 { 00072 return dimension2d<T>(Width*scale, Height*scale); 00073 } 00074 00076 T getArea() const 00077 { 00078 return Width*Height; 00079 } 00080 00082 T Width; 00084 T Height; 00085 }; 00086 00088 typedef dimension2d<f32> dimension2df; 00090 typedef dimension2d<s32> dimension2di; 00091 00092 } // end namespace core 00093 } // end namespace irr 00094 00095 #endif 00096
| The Irrlicht
Engine Documentation © 2003-2008 by Nikolaus Gebhardt. Generated
on Sun Jun 1 07:59:07 2008 by Doxygen
(1.4.2) |