Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


colors...weird way of naming them


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 05 August 1999 - 02:53 PM

I want to make Everquest in VB. hehehe, just kidding. Now, I am working on a cool project, what i will not say. It uses Direct3D, however. I've looked through numerous samples, and see them declare colors like this: 0xFFFFFFFF for white. What is that? Can someone disect that and tell me what each part means? And then can you tell me how to make the color I want by creating one of those 0x******** things? like a Red or a light green for example? Through some quick investigetion, I know that those things are DWORDS. Thanks in advance!


Sponsor:

#2   Guests   -  Reputation: 0

Like
Likes
Like

Posted 28 July 1999 - 07:24 PM

well I haven't played with D3D before so this is just a guess...

0xFFFFFFFF

fist off this is a Hex number... if you don't know what it is I'd recomend you look up Hex numbers on the net because your going to see them a LOT more of them.

next I'm going to guess at the structure of the number.

Guess 1

Hex Ident. R G B A
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue
A=Alpha

Guess 2

Hex Ident. A R G B
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue
A=Alpha

Guess 3

Hex Ident. R G B Place Holder
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue

Guess 4

Hex Ident. PH R G B
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue

guess 1 is probably the closest

ok now lets create colors

bright red
R=FF
G=00
B=00
A=FF if it is alpha

bright Green
R=00
G=FF
B=00
A=FF if it is alpha

bright blue
R=00
G=00
B=FF
A=FF if it is alpha

Purple
R=FF
G=00
B=FF
A=FF if it is alpha

Gray
R=AA
G=AA
B=AA
A=FF if it is alpha

you get the idea play with it a bit...

------------------
Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech


#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 29 July 1999 - 05:38 PM

Alright, then can anyone give me some help with writing a function that will let me input an r g b and a value (0 - 255) that will return a color in this format? Something weird is happening also. I have fog, and i have a background color. If I set them to the same 0x00AA55FF (or whatever) value, they are not the same color! wtf! I checked, they're both DWORD's. AAHHH! Anyway, help with that function would be greatly appreciated.

#4 jens   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 July 1999 - 09:14 AM

hi,
a function like this is very simple. You have to use the binary shift-left operator. In C this would be "<<". I'll just write you a simple C function. It's not tested and there might be a bug (or two) in it. I'll use ARGB-format, since I'm used to it:

DWORD argb(USHORT alpha, USHORT red, USHORT green, USHORT blue)
{
return ((alpha << 24) + (red << 16) + green << 8) + blue);
};

I hope you got the idea. If not, just ask...

ciao...
...jens


#5 Un0   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 August 1999 - 02:53 PM

I do this:

#define COLOR_BLACK RGB(0, 0, 0)
#define COLOR_BLUE RGB(0, 0,255)
#define COLOR_BLUE_SKY RGB(0, 10,255)
#define COLOR_CYAN RGB(0, 255, 255)
#define COLOR_GREEN RGB(0, 255, 0)
#define COLOR_MAGENTA RGB(255, 0, 255)
#define COLOR_RED RGB(255, 0, 0)
#define COLOR_WHITE RGB(255, 255, 255)
#define COLOR_YELLOW RGB(255, 255, 0)


Its a pre-defined macro..I think u need to add windows.h...

[This message has been edited by Un0 (edited August 05, 1999).]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS