コード例 #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);
        }
コード例 #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);
        }