32#include "CEGUI/UDim.h"
33#include "CEGUI/Vector.h"
85 inline bool operator==(
const Size&
other)
const
87 return d_width ==
other.d_width && d_height ==
other.d_height;
90 inline bool operator!=(
const Size&
other)
const
92 return !operator==(
other);
95 inline Size operator*(
const T
c)
const
97 return Size(d_width *
c, d_height *
c);
100 inline Size operator*(
const Size&
s)
const
102 return Size(d_width *
s.d_width, d_height *
s.d_height);
107 return Size(d_width *
vec.d_x, d_height *
vec.d_y);
110 inline Size operator+(
const Size&
s)
const
112 return Size(d_width +
s.d_width, d_height +
s.d_height);
115 inline Size operator-(
const Size&
s)
const
117 return Size(d_width -
s.d_width, d_height -
s.d_height);
125 if (d_width <
min.d_width)
126 d_width =
min.d_width;
127 else if (d_width >
max.d_width)
128 d_width =
max.d_width;
130 if (d_height <
min.d_height)
131 d_height =
min.d_height;
132 else if (d_height >
max.d_height)
133 d_height =
max.d_height;
141 if(d_width <= 0 && d_height <= 0)
156 d_height = d_width /
ratio;
165 s <<
"CEGUI::Size<" <<
typeid(T).name() <<
">(" << v.d_width <<
", " << v.d_height <<
")";
204typedef Size<float> Sizef;
205typedef Size<UDim> USize;
207inline USize operator*(
const USize& i,
float x)
209 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:176
static Size square(const T side)
finger saving alias for Size(side, side)
Definition Size.h:170
static Size one()
finger saving alias for Size(1, 1)
Definition Size.h:182
static Size one_width()
finger saving alias for Size(1, 0)
Definition Size.h:188
static Size one_height()
finger saving alias for Size(0, 1)
Definition Size.h:194
friend std::ostream & operator<<(std::ostream &s, const Size &v)
allows writing the size to std ostream
Definition Size.h:163
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