Development: Difference between revisions
imported>Zekiah More info about pixel packet |
imported>Zekiah m Typo fix on pixel packet |
||
| Line 10: | Line 10: | ||
The pixel packet is one of the simplest. It is a six byte packet, the first byte being the '''code,''' the '''position (board index)''' of the pixel, represented by a 4 byte unsigned 32 bit integer, and finally a byte representing the index of the '''colour''' in the palette that the pixel represents. | The pixel packet is one of the simplest. It is a six byte packet, the first byte being the '''code,''' the '''position (board index)''' of the pixel, represented by a 4 byte unsigned 32 bit integer, and finally a byte representing the index of the '''colour''' in the palette that the pixel represents. | ||
One can retrieve the X and Y from an given pixel index with some basic | One can retrieve the X and Y from an given pixel index with some basic math. To get the X position, we do '''index % CanvasWidth''', and to get the Y position '''Math.Floor(index / CanvasHeight)'''. | ||