Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void render(int xPos, int yPos, int tile, int color, boolean mirrorX, boolean mirrorY)
- {
- xPos -= xOff;
- yPos -= yOff;
- int xTile = tile % 32;
- int yTile = tile / 32;
- int tileOffset = (xTile << 3) + (yTile << 3) * sheet.width;
- for (int y = 0; y < 8; y++)
- {
- if (y + yPos < 0 || y + yPos >= height)
- {
- continue;
- }
- int ySheet = y;
- if (mirrorY)
- {
- ySheet = 7-y;
- }
- for (int x = 0; x < 8; x++)
- {
- if (x + xPos < 0 || x + xPos >= width)
- {
- continue;
- }
- int xSheet = x;
- if (mirrorX)
- {
- xSheet = 7-x;
- }
- int col = (color >> (sheet.pixels[xSheet + ySheet * sheet.width + tileOffset] * 8)) & 255;
- if (col < 255)
- {
- pixels[(x + xPos) + (y + yPos) * width] = col;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment