Ejemplo n.º 1
0
        private Rectangle RenderCell()
        {
            int columns = image.GetWidth() / cellSize;
            int rows    = image.GetHeight() / cellSize;

            int cellSearcher = 0;

            //Run through the tiles in the TileSet until you hit the index of the given celll
            for (int row = 0; row < rows; row++)
            {
                for (int col = 0; col < columns; col++)
                {
                    cellSearcher++;

                    if (cellSearcher == cellIndex)
                    {
                        Rectangle rendercell = new Rectangle(cellSize * col, cellSize * row, cellSize, cellSize);
                        return(rendercell);
                    }
                }
            }

            throw new CellNotFoundException();
        }