private static int CalculateYCoordinate(uint gid, int imageWidth, int tileWidth, int tileHeight, int spacing, int margin) { int tilesWide = TilesetExtensionMethods.GetNumberOfTilesWide( imageWidth, margin, tileWidth, spacing); int normalizedy = (int)(gid / tilesWide); int pixely = normalizedy * (tileHeight + spacing) + margin; return(pixely); }
private static int CalculateXCoordinate(uint gid, int imageWidth, int tileWidth, int spacing, int margin) { var tilesWide = TilesetExtensionMethods.GetNumberOfTilesWide( imageWidth, margin, tileWidth, spacing); int normalizedX = (int)(gid % tilesWide); int pixelX = normalizedX * (tileWidth + spacing) + margin; return(pixelX); }