typedef struct D3DXCOLOR { #ifdef __cplusplus public: D3DXCOLOR() {} D3DXCOLOR(DWORD argb); D3DXCOLOR(CONST FLOAT *); D3DXCOLOR(CONST D3DXFLOAT16 *); D3DXCOLOR(CONST D3DCOLORVALUE&); D3DXCOLOR(FLOAT r, FLOAT g, FLOAT b, FLOAT a);
// приведение типов operator DWORD () const;
operator FLOAT* (); operator CONST FLOAT* () const; operator D3DCOLORVALUE* (); operator CONST D3DCOLORVALUE* () const;
operator D3DCOLORVALUE& (); operator CONST D3DCOLORVALUE& () const;
// операторы присваивания D3DXCOLOR& operator += (CONST D3DXCOLOR&); D3DXCOLOR& operator -= (CONST D3DXCOLOR&); D3DXCOLOR& operator *= (FLOAT); D3DXCOLOR& operator /= (FLOAT);
// унарные операторы D3DXCOLOR operator + () const; D3DXCOLOR operator - () const;
// бинарные операторы D3DXCOLOR operator + (CONST D3DXCOLOR&) const; D3DXCOLOR operator - (CONST D3DXCOLOR&) const; D3DXCOLOR operator * (FLOAT) const; D3DXCOLOR operator / (FLOAT) const;
friend D3DXCOLOR operator * (FLOAT, CONST D3DXCOLOR&);
BOOL operator == (CONST D3DXCOLOR&) const; BOOL operator != (CONST D3DXCOLOR&) const;
#endif //__cplusplus FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR;
ПРИМЕЧАНИЕ
(c1, c2, c3, c4)
Мы дополним наш файл d3dUtility.h следующими глобальными цветовыми константами:
namespace d3d { . . . const D3DXCOLOR WHITE(D3DCOLOR_XRGB(255, 255, 255)); const D3DXCOLOR BLACK(D3DCOLOR_XRGB( 0, 0, 0)); const D3DXCOLOR RED(D3DCOLOR_XRGB(255, 0, 0)); const D3DXCOLOR GREEN(D3DCOLOR_XRGB( 0, 255, 0)); const D3DXCOLOR BLUE(D3DCOLOR_XRGB( 0, 0, 255)); const D3DXCOLOR YELLOW(D3DCOLOR_XRGB(255, 255, 0)); const D3DXCOLOR CYAN(D3DCOLOR_XRGB( 0, 255, 255)); const D3DXCOLOR MAGENTA(D3DCOLOR_XRGB(255, 0, 255)); }