GetNumberOfTilesWide() public static method

public static GetNumberOfTilesWide ( int imageWidth, int margin, int tileWidth, int spacing ) : int
imageWidth int
margin int
tileWidth int
spacing int
return int
Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }