T-Bear
30-05-2012, 10:09 AM
How do i convert pSDL_Color to TColor or Cardinal, and how do i convert Cardinal/TColor to pSDL_COLOR?
Are there any functions, maybe even in SDL which i can use?
Thanks for help.
Super Vegeta
30-05-2012, 10:48 AM
If by Cardinal, you mean a color in $RRGGBB format, then just (*, +) or (shl, or) the components of sdl's color.
Function SDL_ColorToUInt(Col:PSDL_Color):Longword;
begin Exit((Col^.R shl 16) or (Col^.G shl 8) or (Col^.B)) end;
Function Make_PSDL_Color(Num:LongWord):PSDL_Color;
Var Col:PSDL_Color;
begin New(Col);
Col^.R:=Num shr 16;
Col^.G:=Num shr 8;
Col^.B:=Num;
Exit(Col)
end;
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.