Populous: The Beginning Script 3  1.0.0
Documentation for Populous Script 3 engine

◆ LB_API_CLASS()

LB_API_CLASS ( TbColour  )

Definition at line 18 of file LbColour.h.

19 {
20 public:
21  TbColour()
22  {
23  Index = Red = Green = Blue = Alpha = 0;
24  }
25 
26  // Constructors
27  TbColour(UBYTE Ind)
28  {
29  // Palette lookup
30  Index = Ind;
31  Red = _lbGlobalPalette.Entry[Index].Red;
32  Green = _lbGlobalPalette.Entry[Index].Green;
33  Blue = _lbGlobalPalette.Entry[Index].Blue;
34  Alpha = 0xff;
35  };
36 
37  TbColour(int Ind)
38  {
39  ASSERT(Ind >= 0);
40  ASSERT(Ind<256);
41 
42  // Palette lookup
43  Index = (UBYTE)Ind;
44  Red = _lbGlobalPalette.Entry[Index].Red;
45  Green = _lbGlobalPalette.Entry[Index].Green;
46  Blue = _lbGlobalPalette.Entry[Index].Blue;
47  Alpha = 0xff;
48  };
49 
50  TbColour(UBYTE r, UBYTE g, UBYTE b)
51  {
52  Set(r, g, b);
53  };
54 
55  TbColour(UBYTE r, UBYTE g, UBYTE b, UBYTE Pal) : Red(r), Green(g), Blue(b), Index(Pal), Alpha(0xff)
56  {
57  };
58 
59 
60  // Set the colour to an rgb value
61  inline void Set(UBYTE r, UBYTE g, UBYTE b, UBYTE a = 0xff);
62 
63  // Function to get the colour as a packed 32bit value
64  inline ULONG Get32bitValue() const;
65 
66  // Function to get the colour as a formatted - packed to the specifications in the pixel format mask
67  inline ULONG GetFormattedValue(const TbPixelCaps& pixcaps) const;
68  inline ULONG GetFormattedValue(const TbPixFormat& pixformat) const;
69 
70  // public data
71  union
72  {
73  ULONG Packed;
74 
75  struct
76  {
77  UBYTE Blue;
78  UBYTE Green;
79  UBYTE Red;
80  UBYTE Alpha;
81  };
82  };
83 
84  UBYTE Index;
85 };
LB_API_VAR_IMPORT TbPalette _lbGlobalPalette
Definition: LbColour.h:12

References _lbGlobalPalette.