31 #include "CEGUI/Base.h"
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
40 #define cegui_absdim(x) CEGUI::UDim(0,(x))
41 #define cegui_reldim(x) CEGUI::UDim((x),0)
100 inline UDim(
float scale,
float offset):
112 return UDim(d_scale + other.d_scale, d_offset + other.d_offset);
115 inline UDim operator-(
const UDim& other)
const
117 return UDim(d_scale - other.d_scale, d_offset - other.d_offset);
120 inline UDim operator*(
const float val)
const
122 return UDim(d_scale * val, d_offset * val);
125 inline friend UDim operator*(
const float val,
const UDim& u)
127 return UDim(val * u.d_scale, val * u.d_offset);
130 inline UDim operator*(
const UDim& other)
const
132 return UDim(d_scale * other.d_scale, d_offset * other.d_offset);
135 inline UDim operator/(
const UDim& other)
const
139 return UDim(other.d_scale == 0.0f ? 0.0f : d_scale / other.d_scale,
140 other.d_offset == 0.0f ? 0.0f : d_offset / other.d_offset);
143 inline const UDim& operator+=(
const UDim& other)
145 d_scale += other.d_scale;
146 d_offset += other.d_offset;
150 inline const UDim& operator-=(
const UDim& other)
152 d_scale -= other.d_scale;
153 d_offset -= other.d_offset;
157 inline const UDim& operator*=(
const UDim& other)
159 d_scale *= other.d_scale;
160 d_offset *= other.d_offset;
164 inline const UDim& operator/=(
const UDim& other)
168 d_scale = (other.d_scale == 0.0f ? 0.0f : d_scale / other.d_scale);
169 d_offset = (other.d_offset == 0.0f ? 0.0f : d_offset / other.d_offset);
175 return d_scale == other.d_scale && d_offset == other.d_offset;
186 inline friend std::ostream& operator << (std::ostream& s,
const UDim& v)
188 s <<
"CEGUI::UDim(" << v.d_scale <<
", " << v.d_offset <<
")";
197 return UDim(0.0f, 0.0f);
208 return UDim(1.0f, 0.0f);
219 return UDim(0.01f, 0.0f);
231 return UDim(0.0f, 1.0f);
276 d_bottom(b.d_bottom),
285 return ((d_top == rhs.d_top) &&
286 (d_left == rhs.d_left) &&
287 (d_bottom == rhs.d_bottom) &&
288 (d_right == rhs.d_right));
300 d_bottom = rhs.d_bottom;
301 d_right = rhs.d_right;
306 UBox operator*(
const float val)
const
309 d_top * val, d_left * val,
310 d_bottom * val, d_right * val);
313 UBox operator*(
const UDim& dim)
const
316 d_top * dim, d_left * dim,
317 d_bottom * dim, d_right * dim);
323 d_top + b.d_top, d_left + b.d_left,
324 d_bottom + b.d_bottom, d_right + b.d_right);
348 inline UDim TypeSensitiveZero<UDim>()
365 inline UDim TypeSensitiveOne<UDim>()
373 #if defined(_MSC_VER)
374 # pragma warning(pop)
377 #endif // end of guard _CEGUIUDim_h_