Пример #1
0
        DrawTile(short[] pixelLookupTable,
                 DisplayDefinition disDef, uint[] bitmapData, uint[] pixelBuffer,
                 int stride, byte[] tileData,
                 int pX, int pY, int maxPx, int maxPy)
        {
            // We iterate for the actual bytes
            for (int j = 0; j < tileData.Length; j += 2)
            {
                int pixelY = pY + (j / 2);
                if (pixelY < 0)
                {
                    continue;
                }
                if (pixelY >= maxPy)
                {
                    break;
                }                            // We can continue no further

                int index = pixelY * stride; // Only add every 2 bytes
                DisFuncs.GetPixelsFromTileBytes(pixelLookupTable,
                                                ref pixelBuffer,
                                                disDef.TilePallete,
                                                disDef.PixelPerTileX,
                                                tileData[j], tileData[j + 1]);
                for (int i = 0; i < 8; i++)
                {
                    int pixelX = pX + i;
                    if (pixelX < 0)
                    {
                        continue;
                    }
                    if (pixelX >= maxPx)
                    {
                        break;
                    }
                    int pIndex = index + pixelX;
                    bitmapData[pIndex] = pixelBuffer[i];
                }
            }
        }