Simple question
#1

Are colors floats?
Reply
#2

No. They are like hexadecimal values.
Reply
#3

Quote:
Originally Posted by Backwardsman97
Посмотреть сообщение
No. They are like hexadecimal values.
No shit?
I know that, but are they concidered a float?
Reply
#4

Quote:
Originally Posted by [KO]KillerThriller
Посмотреть сообщение
Are colors floats?
No, if you are to store them in an array you can store them like a number; as they are hexadecimal.
Reply
#5

a hex number Is a 32 bit-non-signed integer. if any number gets defined starting with 0x, then its a hex notation.
9=0x00000009
10=0x0000000a
255=0x000000ff
you will find a lot of color defines in scripts which looks equal to
Код:
#define red=0xff0000ff; //or
#define green=0x00ff00ff; //or
#define blue=0x0000ffff; //or
const red=0xff000000;// the last 00 instead of the ff wont matter in the chat, but its the same color (red), or
new FactionColor[3]={0xff0000ff,0x00ff00ff,0x0000ff00};
the important parts in the color value are the RR (red), GG (green) and BB (blue) values like here..
Код:
0xRRGGBBaa
where the aa represents the alphachanncel (handy when you want transparent gangzones f.ex),
if you define a simple value (like 255, thats 0xff), its like defining no color, coz 0xff is a small number. it could look like 0x000000ff aswell - multiply that (no color but full alphachannel atm) by 256 (thats 0x100), then you get a
Код:
0x000000ff * 0x100 (0x100 are 2 digits and causes the ff shifting to the left.
remember: 1 shift to the left (0x10) is 16 in decimal notation, thats why 0x100=256 (16*16 or 0x10*0x10))
is:
0x0000ff00
and thats a blue color. another *256 will give you 0x00ff0000, thats green
i hope it helped you a bit. hexadecimal values can be confusing, but they are vital when you want to modify color values
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)