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_
static UDim percent()
finger saving convenience method returning UDim(0.01, 0)
Definition: UDim.h:216
Definition: MemoryAllocatedObject.h:109
static UDim px()
finger saving convenience method returning UDim(0, 1)
Definition: UDim.h:228
bool CEGUIEXPORT operator==(const String &str1, const String &str2)
Return true if String str1 is equal to String str2.
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
T TypeSensitiveOne()
allows you to get UDim::relative() if you pass UDim or just 1 if you pass anything else ...
Definition: UDim.h:358
T TypeSensitiveZero()
allows you to get UDim(0, 0) if you pass UDim or just 0 if you pass anything else ...
Definition: UDim.h:341
Class encapsulating the 'Unified Box' - this is usually used for margin.
Definition: UDim.h:247
String CEGUIEXPORT operator+(const String &str1, const String &str2)
Return String object that is the concatenation of the given inputs.
static UDim relative()
finger saving convenience method returning UDim(1, 0)
Definition: UDim.h:205
bool CEGUIEXPORT operator!=(const String &str1, const String &str2)
Return true if String str1 is not equal to String str2.
Dimension that has both a relative 'scale' portion and and absolute 'offset' portion.
Definition: UDim.h:92
static UDim zero()
finger saving convenience method returning UDim(0, 0)
Definition: UDim.h:194