12 #define SS_DECLARE_ENUM_STRING_DEF(type) \
13 SsString __EnumToString_( type::_enum n );\
14 void __StringToEnum_( SsString n , type::_enum& out);\
24 typedef std::string SsString;
46 float sq = x * x + y * y;
52 return sqrt( distance_sq(l, r) );
86 SsPoint3(
float _x ,
float _y ,
float _z)
88 x = _x ; y = _y;z = _z;
95 typedef unsigned int u32;
96 typedef unsigned char u8;
102 template <
typename T>
108 SsTRect(): x(0), y(0), w(0), h(0) {}
109 SsTRect(T ax, T ay, T aw, T ah): x(ax), y(ay), w(aw), h(ah) {}
112 bool operator ==(
const SsTRect& r)
const {
return x == r.x && y == r.y && w == r.w && h == r.h;}
113 bool operator !=(
const SsTRect& r)
const {
return !(*
this == r);}
122 template <
typename T>
128 SsTColor(): r(0), g(0), b(0), a(0) {}
129 SsTColor(T ar, T ag, T ab, T aa): r(ar), g(ag), b(ab), a(aa) {}
132 void fromARGB(u32 c);
133 void fromBGRA(u32 c);
137 bool operator ==(
const SsTColor& rhs)
const
153 a = (float)(c >> 24) / 255.f;
154 r = (float)((c >> 16) & 0xff) / 255.f;
155 g = (float)((c >> 8) & 0xff) / 255.f;
156 b = (float)(c & 0xff) / 255.f;
160 b = (float)(c >> 24) / 255.f;
161 g = (float)((c >> 16) & 0xff) / 255.f;
162 r = (float)((c >> 8) & 0xff) / 255.f;
163 a = (float)(c & 0xff) / 255.f;
167 u32 c = (u8)(a * 255) << 24 | (u8)(r * 255) << 16 | (u8)(g * 255) << 8 | (u8)(b * 255);
178 r = ((c >> 16) & 0xff);
179 g = ((c >> 8) & 0xff);
185 g = ((c >> 16) & 0xff) ;
186 r = ((c >> 8) & 0xff) ;
191 u32 c = (u8)(a) << 24 | (u8)(r) << 16 | (u8)(g) << 8 | (u8)(b);
204 char operator()(
char c) {
return tolower(c); }
207 inline void ConvertStringToSsColor(
const std::string& str , SsColor& out)
212 std::string temp =
"0x";
215 transform(temp.begin(), temp.end(), temp.begin(),
ToLower());
216 x = strtoul(temp.c_str(), &endptr, 16);
245 namespace SsPartsSortMode
255 SS_DECLARE_ENUM_STRING_DEF( SsPartsSortMode );
271 SS_DECLARE_ENUM_STRING_DEF( SsPartType );
276 namespace SsBoundsType
290 SS_DECLARE_ENUM_STRING_DEF( SsBoundsType );
295 namespace SsInheritType
305 SS_DECLARE_ENUM_STRING_DEF( SsInheritType );
309 namespace SsBlendType
320 SS_DECLARE_ENUM_STRING_DEF( SsBlendType );
324 namespace SsColorBlendTarget
333 SS_DECLARE_ENUM_STRING_DEF( SsColorBlendTarget );
338 namespace SsInterpolationType
352 SS_DECLARE_ENUM_STRING_DEF( SsInterpolationType );
356 namespace SsTexWrapMode
368 SS_DECLARE_ENUM_STRING_DEF(SsTexWrapMode);
371 namespace SsTexFilterMode
381 SS_DECLARE_ENUM_STRING_DEF(SsTexFilterMode);
387 namespace SsAttributeKind
429 SS_DECLARE_ENUM_STRING_DEF(SsAttributeKind);
431 namespace SsKeyValueType
483 int getTargetToInt(){
return (
int)target;}
484 int getBlendTypeToInt(){
return (
int)blendType;}
486 target( SsColorBlendTarget::invalid ) ,
487 blendType( SsBlendType::invalid ){}
542 independent(
false ),
544 startLabel(
"_start"),