This is code snippet that align text center and middle of Box.

    DrawRectangle(x, y, width, height, DARKGREEN);   // rect.height 를 40으로 가정하자 
    int length = MeasureText(title.c_str(), 20);     // 글자의 포인트는 20으로 가정할 것이다. 
 
    DrawText(title.c_str(), x  + (width / 2) - (length / 2), y + (height /2) - (20 / 2), 20, DARKBROWN); // 글자를 가운데로 정렬한다.