Archived

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

CD3D Font - Always on top? & color

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

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 on other sites
here is how you figure out the colors
and 0xff000000 should not be white....it 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

example

unsigned int color = 0;unsigned int alpha = 255;  // all visible or transparent i dont remember// just some random colorunsigned int red = 63;unsigned int green = 199;unsigned int blue = 0;// put alpha in correct placealpha = (alpha << 6);// put red in correct place using shiftsred = (red << 4);// put green in correct placegreen = (green << 2);// blue is already in correct place// OR them together to get the colorcolor = 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

ok thanks

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 on other sites
ok cool ill check it out.

Does anyone know how to fix the always on top problem?

-Rob

Share on other sites
Render all of the objects in your 3D world first, then render your frame stats on top of that.

neneboricua

Share on other sites
Thank you very much!!

-Rob

Share on other sites
0x00000000
__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

[HexDigit1][HexDigit2]

decimal number = (HexDigit1 * 16) + HexDigit2

Share on other sites
I see, but what if there is 3 numbers. Say 123, how whould you turn that into a decimal. Or can hexideciamls only be 2 digits. Thanks

-Rob

Share on other sites
123 = 0x7b

b = 11

((16^1) * 7 ) + ((16^0) * 11) = 123

Hope this helps

[edited by - KillSwitch414 on February 20, 2004 11:05:16 AM]

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 12
• 14
• 9
• Forum Statistics

• Total Topics
633363
• Total Posts
3011514
• Who's Online (See full list)

There are no registered users currently online

×