This topic is now archived and is closed to further replies.

CD3D Font - Always on top? & color

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have displayed the font using CD3D but the text goes behind the objects. How can I make it to be always on top for like health, ammo etc.... And is thurr a list of colors anywhere on the web? Because I have no idea what they are except for 0xff000000 = white. Thanks a lot. -Rob

Share this post

Link to post
Share on other sites
here is how you figure out the colors
and 0xff000000 should not be shoult be black actually

"0x" means it is a hex number
00 - first two places are for the color red
00 - second two places are for color green
00 - last two places are for color blue

00 - lowest value
ff - highest value

you know color ranges from 0 to 255 right ?

well 00 = 0 and ff = 255

it is just converting decimal numbers to binary numbers and then putting them in the right place in the color number


unsigned int color = 0;
unsigned int alpha = 255; // all visible or transparent i dont remember

// just some random color

unsigned int red = 63;
unsigned int green = 199;
unsigned int blue = 0;

// put alpha in correct place

alpha = (alpha << 6);
// put red in correct place using shifts

red = (red << 4);
// put green in correct place

green = (green << 2);
// blue is already in correct place

// OR them together to get the color

color = alpha | red | green | blue;

"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

Share this post

Link to post
Share on other sites
To generate those colors, look at the D3DCOLOR_ARGB or D3DCOLOR_XRGB macros. All you do is input the correct integer value (0-255) for A(alpha), R, G, and B. They work pretty much the same as the code ncsu gave.

Share this post

Link to post
Share on other sites
__A R G B

alpha red green blue, each one is trated as a hex pair 00 - ff if you dont know hex, the digits are.... 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f (jsut a note its not case sensitive and i actually prefer caps)

so... ff = 255
hex | decimal
00 = 0

01 = 1

10 = 16

20 = 32

40 = 64

uhhh.. hope that helped, if not, this may


decimal number = (HexDigit1 * 16) + HexDigit2

Share this post

Link to post
Share on other sites