src/GameOfLife/Inputs/BoardEditor/Options/SelectAreaOption.php
/**
     * Selects an area of fields on the board.
     *
     * @param int $_posXLeft The user inputted posX left
     * @param int $_width The user inputted width
     * @param int $_posYTop The user inputted posY top
     * @param int $_height The user inputted height
     *
     * @return bool Indicates whether the board editing is finished
     *
     * @throws \Exception The exception when the coordinate is invalid.
     */
Selects an area of fields on the board.
@param int $_posXLeft The user inputted posX left
@param int $_width The user inputted width
@param int $_posYTop The user inputted posY top
@param int $_height The user inputted height

@return bool Indicates whether the board editing is finished

@throws \Exception The exception when the coordinate is invalid.
Selects an area of fields on the board . @param int $_posXLeft The user inputted posX left @param int $_width The user inputted width @param int $_posYTop The user inputted posY top @param int $_height The user inputted height @return bool Indicates whether the board editing is finished @throws \ Exception The exception when the coordinate is invalid .
public function selectArea(int $_posXLeft, int $_width, int $_posYTop, int $_height): bool
    {
        $this->parentBoardEditor->checkCoordinate($_posXLeft, "X", 0, $this->parentBoardEditor->board()->width() - 1);
        $this->parentBoardEditor->checkCoordinate($_posYTop, "Y", 0, $this->parentBoardEditor->board()->height() - 1);
        if ($_width == 0) throw new \Exception("The width of the selection may not be 0.");
        $posXRight = $_posXLeft + $_width;
        $this->parentBoardEditor->checkCoordinate($posXRight, "X", 0, $this->parentBoardEditor->board()->width() - 1);
        if ($_height == 0) throw new \Exception("The height of the selection may not be 0.");
        $posYBottom = $_posYTop + $_height;
        $this->parentBoardEditor->checkCoordinate($posYBottom, "Y", 0, $this->parentBoardEditor->board()->height() - 1);
        $this->parentBoardEditor->selectArea($_posXLeft, $_posYTop, $posXRight, $posYBottom);
        $this->parentBoardEditor->outputBoard();
        return false;
    }
public function selectArea ( int $ _posXLeft , int $ _width , int $ _posYTop , int $ _height ) : bool { $ this -> parentBoardEditor -> checkCoordinate ( $ _posXLeft , " X " , 0 , $ this -> parentBoardEditor -> board ( ) -> width ( ) - 1 ) ; $ this -> parentBoardEditor -> checkCoordinate ( $ _posYTop , " Y " , 0 , $ this -> parentBoardEditor -> board ( ) -> height ( ) - 1 ) ; if ( $ _width == 0 ) throw new \ Exception ( " The width of the selection may not be 0. " ) ; $ posXRight = $ _posXLeft + $ _width ; $ this -> parentBoardEditor -> checkCoordinate ( $ posXRight , " X " , 0 , $ this -> parentBoardEditor -> board ( ) -> width ( ) - 1 ) ; if ( $ _height == 0 ) throw new \ Exception ( " The height of the selection may not be 0. " ) ; $ posYBottom = $ _posYTop + $ _height ; $ this -> parentBoardEditor -> checkCoordinate ( $ posYBottom , " Y " , 0 , $ this -> parentBoardEditor -> board ( ) -> height ( ) - 1 ) ; $ this -> parentBoardEditor -> selectArea ( $ _posXLeft , $ _posYTop , $ posXRight , $ posYBottom ) ; $ this -> parentBoardEditor -> outputBoard ( ) ; return false ; }
Selects an area of fields on the board.
Selects an area of fields on the board .