Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00032
00033 #pragma once
00034
00035 #include "../api_core.h"
00036
00037 template<typename Type>
00038 class CL_Vec2;
00039
00040 template<typename Type>
00041 class CL_Vec3;
00042
00043 template<typename Type>
00044 class CL_Vec4;
00045
00051 template<typename Type>
00052 class CL_API_CORE CL_Sizex
00053 {
00056
00057 public:
00059 CL_Sizex() : width(0), height(0) { return; }
00060
00065 CL_Sizex(Type width, Type height)
00066 : width(width), height(height) { }
00067
00071 CL_Sizex(const CL_Sizex<Type> &s)
00072 { width = s.width; height = s.height; }
00073
00077
00078 public:
00080 Type width;
00081
00083 Type height;
00084
00088
00089 public:
00091 CL_Sizex<Type> &operator+=(const CL_Sizex<Type> &s)
00092 { width += s.width; height += s.height; return *this; }
00093
00095 CL_Sizex<Type> &operator-=(const CL_Sizex<Type> &s)
00096 { width -= s.width; height -= s.height; return *this; }
00097
00099 CL_Sizex<Type> operator+(const CL_Sizex<Type> &s) const
00100 { return CL_Sizex<Type>(width + s.width, height + s.height); }
00101
00103 CL_Sizex<Type> operator-(const CL_Sizex<Type> &s) const
00104 { return CL_Sizex<Type>(width - s.width, height - s.height); }
00105
00107 CL_Sizex<Type> &operator+=(const Type &s)
00108 { width += s; height += s; return *this; }
00109
00111 CL_Sizex<Type> &operator-=(const Type &s)
00112 { width -= s; height -= s; return *this; }
00113
00115 CL_Sizex<Type> &operator*=(const Type &s)
00116 { width *= s; height *= s; return *this; }
00117
00119 CL_Sizex<Type> &operator/=(const Type &s)
00120 { width /= s; height /= s; return *this; }
00121
00123 CL_Sizex<Type> operator+(const Type &s) const
00124 { return CL_Sizex<Type>(width + s, height + s); }
00125
00127 CL_Sizex<Type> operator-(const Type &s) const
00128 { return CL_Sizex<Type>(width - s, height - s); }
00129
00131 CL_Sizex<Type> operator*(const Type &s) const
00132 { return CL_Sizex<Type>(width * s, height * s); }
00133
00135 CL_Sizex<Type> operator/(const Type &s) const
00136 { return CL_Sizex<Type>(width / s, height / s); }
00137
00139 bool operator==(const CL_Sizex<Type> &s) const
00140 { return (width == s.width) && (height == s.height); }
00141
00143 bool operator!=(const CL_Sizex<Type> &s) const
00144 { return (width != s.width) || (height != s.height); }
00146 };
00147
00151 class CL_Size : public CL_Sizex<int>
00152 {
00153 public:
00154 CL_Size() : CL_Sizex<int>() {}
00155 CL_Size(int width, int height) : CL_Sizex<int>(width, height) {}
00156 CL_Size(const CL_Sizex<int> &s) : CL_Sizex<int>(s) {}
00157
00158 explicit CL_Size(const CL_Sizex<float> ©) { width = (int)(copy.width+0.5f); height = (int)(copy.height+0.5f); }
00159 explicit CL_Size(const CL_Sizex<double> ©) { width = (int)(copy.width+0.5); height = (int)(copy.height+0.5); }
00160 };
00161
00165 class CL_Sizef : public CL_Sizex<float>
00166 {
00167 public:
00168 CL_Sizef() : CL_Sizex<float>() {}
00169 CL_Sizef(float width, float height) : CL_Sizex<float>(width, height) {}
00170 CL_Sizef(const CL_Sizex<float> &s) : CL_Sizex<float>(s) {}
00171
00172 CL_Sizef(const CL_Sizex<int> ©) { width = (float)copy.width; height = (float)copy.height; }
00173 explicit CL_Sizef(const CL_Sizex<double> ©) { width = (float)copy.width; height = (float)copy.height; }
00174 };
00175
00179 class CL_Sized : public CL_Sizex<double>
00180 {
00181 public:
00182 CL_Sized() : CL_Sizex<double>() {}
00183 CL_Sized(double width, double height) : CL_Sizex<double>(width, height) {}
00184 CL_Sized(const CL_Sizex<double> &s) : CL_Sizex<double>(s) {}
00185
00186 CL_Sized(const CL_Sizex<int> ©) { width = (double)copy.width; height = (double)copy.height; }
00187 CL_Sized(const CL_Sizex<float> ©) { width = (double)copy.width; height = (double)copy.height; }
00188 };
00189
00191