13.08.2015, 14:54
Quote:
Hello guys, i can't figure out how to convert hex to ARGB.
I need this for SetObjectMaterialText , the colors of the font must be 0xFFFFFFFF and i am getting them from my database as HEX like FF0000. I tried to get them as ARGB from the mysql database (0xFFFFFFFF) but the text won't appear because i get them as string. (VARCHAR in the database) Can someone help? Thanks ! |
Here's a little piece of code that I wrote for You:
pawn Код:
stock addAlpha(&basecolor, amount)
return (basecolor<<8)+amount;
pawn Код:
new hex = 0xFF0000;
printf("Before: %x after: %x", hex, addAlpha(hex, 255));
Код:
Before: FF0000 after: FF0000FF
-- Nevermind, didn't noticed that You are storing Your color as VARCHAR, my bad
![Roll Eyes (Sarcastic)](images/smilies/rolleyes.png)