30#include "CEGUI/Base.h"
35# pragma warning(disable : 4251)
39#define cegui_absdim(x) CEGUI::UDim(0,(x))
40#define cegui_reldim(x) CEGUI::UDim((x),0)
101 inline UDim(
float scale,
float offset):
113 return UDim(d_scale + other.d_scale, d_offset + other.d_offset);
116 inline UDim operator-(
const UDim& other)
const
118 return UDim(d_scale - other.d_scale, d_offset - other.d_offset);
121 inline UDim operator*(
const float val)
const
123 return UDim(d_scale * val, d_offset * val);
126 inline friend UDim operator*(
const float val,
const UDim& u)
128 return UDim(val * u.d_scale, val * u.d_offset);
131 inline UDim operator*(
const UDim& other)
const
133 return UDim(d_scale * other.d_scale, d_offset * other.d_offset);
136 inline UDim operator/(
const UDim& other)
const
140 return UDim(other.d_scale == 0.0f ? 0.0f : d_scale / other.d_scale,
141 other.d_offset == 0.0f ? 0.0f : d_offset / other.d_offset);
144 inline const UDim& operator+=(
const UDim& other)
146 d_scale += other.d_scale;
147 d_offset += other.d_offset;
151 inline const UDim& operator-=(
const UDim& other)
153 d_scale -= other.d_scale;
154 d_offset -= other.d_offset;
158 inline const UDim& operator*=(
const UDim& other)
160 d_scale *= other.d_scale;
161 d_offset *= other.d_offset;
165 inline const UDim& operator/=(
const UDim& other)
169 d_scale = (other.d_scale == 0.0f ? 0.0f : d_scale / other.d_scale);
170 d_offset = (other.d_offset == 0.0f ? 0.0f : d_offset / other.d_offset);
176 return d_scale == other.d_scale && d_offset == other.d_offset;
187 inline friend std::ostream& operator << (std::ostream& s,
const UDim& v)
189 s <<
"CEGUI::UDim(" << v.d_scale <<
", " << v.d_offset <<
")";
198 return UDim(0.0f, 0.0f);
209 return UDim(1.0f, 0.0f);
220 return UDim(0.01f, 0.0f);
232 return UDim(0.0f, 1.0f);
277 d_bottom(b.d_bottom),
286 return ((d_top == rhs.d_top) &&
287 (d_left == rhs.d_left) &&
288 (d_bottom == rhs.d_bottom) &&
289 (d_right == rhs.d_right));
301 d_bottom = rhs.d_bottom;
302 d_right = rhs.d_right;
307 UBox operator*(
const float val)
const
310 d_top * val, d_left * val,
311 d_bottom * val, d_right * val);
314 UBox operator*(
const UDim& dim)
const
317 d_top * dim, d_left * dim,
318 d_bottom * dim, d_right * dim);
324 d_top + b.d_top, d_left + b.d_left,
325 d_bottom + b.d_bottom, d_right + b.d_right);
349inline UDim TypeSensitiveZero<UDim>()
366inline UDim TypeSensitiveOne<UDim>()
Definition: MemoryAllocatedObject.h:110
Class encapsulating the 'Unified Box' - this is usually used for margin.
Definition: UDim.h:251
Dimension that has both a relative 'scale' portion and and absolute 'offset' portion.
Definition: UDim.h:94
static UDim px()
finger saving convenience method returning UDim(0, 1)
Definition: UDim.h:230
static UDim relative()
finger saving convenience method returning UDim(1, 0)
Definition: UDim.h:207
static UDim zero()
finger saving convenience method returning UDim(0, 0)
Definition: UDim.h:196
static UDim percent()
finger saving convenience method returning UDim(0.01, 0)
Definition: UDim.h:218
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
T TypeSensitiveZero()
allows you to get UDim(0, 0) if you pass UDim or just 0 if you pass anything else
Definition: UDim.h:343
T TypeSensitiveOne()
allows you to get UDim::relative() if you pass UDim or just 1 if you pass anything else
Definition: UDim.h:360
String CEGUIEXPORT operator+(const String &str1, const String &str2)
Return String object that is the concatenation of the given inputs.
bool CEGUIEXPORT operator!=(const String &str1, const String &str2)
Return true if String str1 is not equal to String str2.
bool CEGUIEXPORT operator==(const String &str1, const String &str2)
Return true if String str1 is equal to String str2.