i noticed D3DX8 uses hex colors in this format: &HXXRRGGBB
how do i make a function that can create that format with XX in % and RR GG BB in 255
Printable View
i noticed D3DX8 uses hex colors in this format: &HXXRRGGBB
how do i make a function that can create that format with XX in % and RR GG BB in 255
Well, for starters, you could tell us what the input to the functino might be... ;)Quote:
Originally Posted by nareth
Where did you see that....you can usualy use the RGB() function to convert colors to a long in DX.
ØØ
not in D3DX8 because it uses transperancie i tried using rgb but that failed drawing text so i need a function likeQuote:
Originally Posted by NoteMe
VB Code:
XRGB(ByVal X As Long, ByVal R As Long, ByVal G As Long, ByVal B As Long) 'X Should be a ratio of 1 and generate hex from 00 to FF 'R/G/B Should be 0-255 and generate hex from 00 to FF
so you have a RGB value and you want to convert it to a hex number
Quote:
XRGB(ByVal X As Long, ByVal R As Long, ByVal G As Long, ByVal B As Long)
VB Code:
myhex = "&H" & Hex(r) & Hex(g) & Hex(b)
just add x to that if want
rgds pete
thanks!
VB Code:
Public Function XRGB(X As Long, R As Long, G As Long, B As Long) As Long Let XRGB = CLng("&H" & Hex(X) & Hex(R) & Hex(G) & Hex(B)) End Function