1
by thindil
Initial import |
1 |
/*
|
165
by thindil
update to libtcod version 1.5.1 |
2 |
* libtcod 1.5.1
|
3 |
* Copyright (c) 2008,2009,2010 Jice & Mingos
|
|
1
by thindil
Initial import |
4 |
* All rights reserved.
|
5 |
*
|
|
6 |
* Redistribution and use in source and binary forms, with or without
|
|
7 |
* modification, are permitted provided that the following conditions are met:
|
|
8 |
* * Redistributions of source code must retain the above copyright
|
|
9 |
* notice, this list of conditions and the following disclaimer.
|
|
10 |
* * Redistributions in binary form must reproduce the above copyright
|
|
11 |
* notice, this list of conditions and the following disclaimer in the
|
|
12 |
* documentation and/or other materials provided with the distribution.
|
|
165
by thindil
update to libtcod version 1.5.1 |
13 |
* * The name of Jice or Mingos may not be used to endorse or promote products
|
1
by thindil
Initial import |
14 |
* derived from this software without specific prior written permission.
|
15 |
*
|
|
165
by thindil
update to libtcod version 1.5.1 |
16 |
* THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY
|
1
by thindil
Initial import |
17 |
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
165
by thindil
update to libtcod version 1.5.1 |
19 |
* DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY
|
1
by thindil
Initial import |
20 |
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
23 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26 |
*/
|
|
27 |
||
28 |
#ifndef _TCOD_BSP_H
|
|
29 |
#define _TCOD_BSP_H
|
|
30 |
||
31 |
typedef struct { |
|
32 |
TCOD_tree_t tree; /* pseudo oop : bsp inherit tree */ |
|
33 |
int x,y,w,h; /* node position & size */ |
|
34 |
int position; /* position of splitting */ |
|
35 |
uint8 level; /* level in the tree */ |
|
36 |
bool horizontal; /* horizontal splitting ? */ |
|
37 |
} TCOD_bsp_t; |
|
38 |
||
39 |
typedef bool (*TCOD_bsp_callback_t)(TCOD_bsp_t *node, void *userData); |
|
40 |
||
41 |
TCODLIB_API TCOD_bsp_t *TCOD_bsp_new(); |
|
42 |
TCODLIB_API TCOD_bsp_t *TCOD_bsp_new_with_size(int x,int y,int w, int h); |
|
43 |
TCODLIB_API void TCOD_bsp_delete(TCOD_bsp_t *node); |
|
44 |
||
45 |
TCODLIB_API TCOD_bsp_t * TCOD_bsp_left(TCOD_bsp_t *node); |
|
46 |
TCODLIB_API TCOD_bsp_t * TCOD_bsp_right(TCOD_bsp_t *node); |
|
47 |
TCODLIB_API TCOD_bsp_t * TCOD_bsp_father(TCOD_bsp_t *node); |
|
48 |
||
49 |
TCODLIB_API bool TCOD_bsp_is_leaf(TCOD_bsp_t *node); |
|
50 |
TCODLIB_API bool TCOD_bsp_traverse_pre_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); |
|
51 |
TCODLIB_API bool TCOD_bsp_traverse_in_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); |
|
52 |
TCODLIB_API bool TCOD_bsp_traverse_post_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); |
|
53 |
TCODLIB_API bool TCOD_bsp_traverse_level_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); |
|
54 |
TCODLIB_API bool TCOD_bsp_traverse_inverted_level_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); |
|
55 |
TCODLIB_API bool TCOD_bsp_contains(TCOD_bsp_t *node, int x, int y); |
|
56 |
TCODLIB_API TCOD_bsp_t * TCOD_bsp_find_node(TCOD_bsp_t *node, int x, int y); |
|
57 |
TCODLIB_API void TCOD_bsp_resize(TCOD_bsp_t *node, int x,int y, int w, int h); |
|
58 |
TCODLIB_API void TCOD_bsp_split_once(TCOD_bsp_t *node, bool horizontal, int position); |
|
59 |
TCODLIB_API void TCOD_bsp_split_recursive(TCOD_bsp_t *node, TCOD_random_t randomizer, int nb, |
|
60 |
int minHSize, int minVSize, float maxHRatio, float maxVRatio); |
|
61 |
TCODLIB_API void TCOD_bsp_remove_sons(TCOD_bsp_t *node); |
|
62 |
||
63 |
#endif
|