32#include "CEGUI/UDim.h"
33#include "CEGUI/Vector.h"
87 inline bool operator==(
const Size&
other)
const
89 return d_width ==
other.d_width && d_height ==
other.d_height;
92 inline bool operator!=(
const Size&
other)
const
94 return !operator==(
other);
97 inline Size operator*(
const T
c)
const
99 return Size(d_width *
c, d_height *
c);
102 inline Size operator*(
const Size&
s)
const
104 return Size(d_width *
s.d_width, d_height *
s.d_height);
109 return Size(d_width *
vec.d_x, d_height *
vec.d_y);
112 inline Size operator+(
const Size&
s)
const
114 return Size(d_width +
s.d_width, d_height +
s.d_height);
117 inline Size operator-(
const Size&
s)
const
119 return Size(d_width -
s.d_width, d_height -
s.d_height);
127 if (d_width <
min.d_width)
128 d_width =
min.d_width;
129 else if (d_width >
max.d_width)
130 d_width =
max.d_width;
132 if (d_height <
min.d_height)
133 d_height =
min.d_height;
134 else if (d_height >
max.d_height)
135 d_height =
max.d_height;
143 if(d_width <= 0 && d_height <= 0)
158 d_height = d_width /
ratio;
167 s <<
"CEGUI::Size<" <<
typeid(T).name() <<
">(" << v.d_width <<
", " << v.d_height <<
")";
206typedef Size<float> Sizef;
207typedef Size<UDim> USize;
209inline USize operator*(
const USize& i,
float x)
211 return i * UDim(x,x);
Definition MemoryAllocatedObject.h:110
Class that holds the size (width & height) of something.
Definition Size.h:68
static Size zero()
finger saving alias for Size(0, 0)
Definition Size.h:178
static Size square(const T side)
finger saving alias for Size(side, side)
Definition Size.h:172
static Size one()
finger saving alias for Size(1, 1)
Definition Size.h:184
static Size one_width()
finger saving alias for Size(1, 0)
Definition Size.h:190
static Size one_height()
finger saving alias for Size(0, 1)
Definition Size.h:196
friend std::ostream & operator<<(std::ostream &s, const Size &v)
allows writing the size to std ostream
Definition Size.h:165
base class for properties able to do native set/get
Definition TypedProperty.h:50
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1
AspectMode
How aspect ratio should be maintained.
Definition Size.h:46
@ AM_SHRINK
Definition Size.h:53
@ AM_EXPAND
Definition Size.h:58
@ AM_IGNORE
Ignores the target aspect (default)
Definition Size.h:48