< index < 14. BSP toolkit | ===================================== 14.1 Creating a BSP tree ===================================== | > 14.2 Splitting a BSP tree

First, you have to create the root node of the tree. This node encompasses the whole rectangular region.

    C++ : TCODBsp::TCODBsp(int x,int y,int w, int h)
    C   : TCOD_bsp_t *TCOD_bsp_new_with_size(int x,int y,int w, int h)
    Py  : bsp_new_with_size(x,y,w, h)

Parameter | Description
--- | ---
x,y,w,h | Top left corner position and size of the rectangular region covered by the BSP tree.

Example :

    C++ : TCODBsp *myBSP = new TCODBsp(0,0,50,50);
    C   : TCOD_bsp_t *my_bsp=TCOD_bsp_new_with_size(0,0,50,50);
    Py  : my_bsp=libtcod.bsp_new_with_size(0,0,50,50)