30 #include "CEGUI/Base.h"
34 # pragma warning(push)
35 # pragma warning(disable : 4251)
39 #define cegui_absdim(x) CEGUI::UDim(0,(x))
40 #define cegui_reldim(x) CEGUI::UDim((x),0)
99 inline UDim(
float scale,
float offset):
111 return UDim(d_scale + other.d_scale, d_offset + other.d_offset);
114 inline UDim operator-(
const UDim& other)
const
116 return UDim(d_scale - other.d_scale, d_offset - other.d_offset);
119 inline UDim operator*(
const float val)
const
121 return UDim(d_scale * val, d_offset * val);
124 inline friend UDim operator*(
const float val,
const UDim& u)
126 return UDim(val * u.d_scale, val * u.d_offset);
129 inline UDim operator*(
const UDim& other)
const
131 return UDim(d_scale * other.d_scale, d_offset * other.d_offset);
134 inline UDim operator/(
const UDim& other)
const
138 return UDim(other.d_scale == 0.0f ? 0.0f : d_scale / other.d_scale,
139 other.d_offset == 0.0f ? 0.0f : d_offset / other.d_offset);
142 inline const UDim& operator+=(
const UDim& other)
144 d_scale += other.d_scale;
145 d_offset += other.d_offset;
149 inline const UDim& operator-=(
const UDim& other)
151 d_scale -= other.d_scale;
152 d_offset -= other.d_offset;
156 inline const UDim& operator*=(
const UDim& other)
158 d_scale *= other.d_scale;
159 d_offset *= other.d_offset;
163 inline const UDim& operator/=(
const UDim& other)
167 d_scale = (other.d_scale == 0.0f ? 0.0f : d_scale / other.d_scale);
168 d_offset = (other.d_offset == 0.0f ? 0.0f : d_offset / other.d_offset);
174 return d_scale == other.d_scale && d_offset == other.d_offset;
185 inline friend std::ostream& operator << (std::ostream& s,
const UDim& v)
187 s <<
"CEGUI::UDim(" << v.d_scale <<
", " << v.d_offset <<
")";
196 return UDim(0.0f, 0.0f);
207 return UDim(1.0f, 0.0f);
218 return UDim(0.01f, 0.0f);
230 return UDim(0.0f, 1.0f);
275 d_bottom(b.d_bottom),
284 return ((d_top == rhs.d_top) &&
285 (d_left == rhs.d_left) &&
286 (d_bottom == rhs.d_bottom) &&
287 (d_right == rhs.d_right));
299 d_bottom = rhs.d_bottom;
300 d_right = rhs.d_right;
305 UBox operator*(
const float val)
const
308 d_top * val, d_left * val,
309 d_bottom * val, d_right * val);
312 UBox operator*(
const UDim& dim)
const
315 d_top * dim, d_left * dim,
316 d_bottom * dim, d_right * dim);
322 d_top + b.d_top, d_left + b.d_left,
323 d_bottom + b.d_bottom, d_right + b.d_right);
347 inline UDim TypeSensitiveZero<UDim>()
364 inline UDim TypeSensitiveOne<UDim>()
372 #if defined(_MSC_VER)
373 # pragma warning(pop)
376 #endif // end of guard _CEGUIUDim_h_