HDB: Add macros for RGB-565 conversions

This commit is contained in:
Nipun Garg 2019-07-12 05:57:57 +05:30 committed by Eugene Sandulenko
parent bcaf795b59
commit 8f83631a3b

View File

@ -166,6 +166,20 @@ public:
void turnOnBonusStars(int which);
void drawBonusStars();
// Macro to convert RGB into 16-bit
uint16 rgbTo565(int r, int g, int b) {
return (uint16) (
((r & 0xf8) << 8) |
((g & 0xfc) << 3) |
((b & 0xf8) >> 3)
);
}
// Macros to get RGB from 565 short
#define getR( x ) ( ( x & 0xf800 ) >> 8 )
#define getG( x ) ( ( x & 0x07e0 ) >> 3 )
#define getB( x ) ( ( x & 0x001f ) << 3 )
private:
int _numTiles;
TileLookup *_tLookupArray;