1
So guys, I’m in big trouble rsrs, I’m creating an editing tool for a PS2 football game.
And this game has two "systems" of colors, which are they:
The "normal" RGB that is; R: 0 to 255, G: 0 to 255, B: 0 to 255.
And the, or think is rsrs 5bitRGB; R: 0 to 31, G: 0 to 31, B: 0 to 31.
And here’s the thing, the "normal" RGB I can send its value to the textbox. And after sending the value to the textbox, I save this value directly in the game file via Hex, thus changing to the color I want, until then beauty.
This works because... because the "slot" of bytes of this color in the game file are actually 3 bytes, so saving the value sent in Hex of the textbox works.
Except that now the problem is the 5bitRGB, the "slot" of it in the game file is only 2 bytes, not 3, and colorDialog the color options are "normal" from 0 to 255 both in R, G and B, there is no way to do only from 0 to 31, and the worst problem, how to send the value of colorDialog in this 5bitRGB format in 2 bytes to the textbox? rsrs will be possible?
I did some tests here and the RGB565 seems to be the correct one, but this way it still does not give the correct value, choosing the white color it even gives the correct value that is 65535 in Hex FFFF. I noticed that the RGB555 has the value from 0 to 32767 while the RGB565 has the value of 32768 which is correct in Hex 0080 (Black color) up to 65535 which is also correct in Hex FFFF, so I think that something else is missing to give the correct value to convert to Hex.
– Pedro Silva
Your comment is a bit confusing. In which situations RGB565 does not give the correct value?
– ramaral
So I did the following to get the value of colorDialog in RGB565: pictureBox1.Backcolor = colorDialog1.Color; var C1 = Convert8888rgbto555rgb(colorDialog1.Color); var C2 = Convert.Tostring(C1); Messagebox.Show(C2); Messagebox.Show(((int)C1).Tostring("X2")); it give the value of normal and is converted into Hex which is what I want.
– Pedro Silva
@ramaral just for the record: http://answall.com/questions/194790/70
– Bacco
Already get here guys thanks there for the help! :D
– Pedro Silva
@Bacco My code is correct or not?
– ramaral
@ramaral I imagine so, the author even accepted. I only mentioned the other one so you were aware that it was the same subject. About be 555, 565, by the posted images I deduce that it is 555 (all sliders stop at 31), but then only the author testing same.
– Bacco