|
libtcod
|
Classes | |
| struct | TCOD_bresenham_data_t |
| A struct used for computing a bresenham line. More... | |
| class | TCODLineListener |
| class | TCODLine |
Typedefs | |
| typedef bool(* | TCOD_line_listener_t) (int x, int y) |
| A callback to be passed to TCOD_line. | |
Functions | |
| void | TCOD_line_init (int xFrom, int yFrom, int xTo, int yTo) |
| Initialize a line using a global state. | |
| bool | TCOD_line_step (int *xCur, int *yCur) |
| Advance to the next point in a line, returns true once the line has ended. | |
| bool | TCOD_line (int xFrom, int yFrom, int xTo, int yTo, TCOD_line_listener_t listener) |
| Iterate over a line using a callback. | |
| void | TCOD_line_init_mt (int xFrom, int yFrom, int xTo, int yTo, TCOD_bresenham_data_t *data) |
| Initialize a TCOD_bresenham_data_t struct. | |
| bool | TCOD_line_step_mt (int *xCur, int *yCur, TCOD_bresenham_data_t *data) |
| Get the next point on a line, returns true once the line has ended. | |
| bool | TCOD_line_mt (int xFrom, int yFrom, int xTo, int yTo, TCOD_line_listener_t listener, TCOD_bresenham_data_t *data) |
| Iterate over a line using a callback. | |
| typedef bool(* TCOD_line_listener_t) (int x, int y) |
A callback to be passed to TCOD_line.
The points given to the callback include both the starting and ending positions.
| x | |
| y |
| bool TCOD_line | ( | int | xFrom, |
| int | yFrom, | ||
| int | xTo, | ||
| int | yTo, | ||
| TCOD_line_listener_t | listener ) |
Iterate over a line using a callback.
| xo | The origin x position. |
| yo | The origin y position. |
| xd | The destination x position. |
| yd | The destination y position. |
| listener | A TCOD_line_listener_t callback. Iteration stops early if this callback returns false. |
embed:rst:leading-asterisk * .. versionchanged:: 1.6.6 * This function is now reentrant. *
| void TCOD_line_init | ( | int | xFrom, |
| int | yFrom, | ||
| int | xTo, | ||
| int | yTo ) |
Initialize a line using a global state.
| xFrom | The starting x position. |
| yFrom | The starting y position. |
| xTo | The ending x position. |
| yTo | The ending y position. |
embed:rst:leading-asterisk * .. deprecated:: 1.6.6 * This function is not reentrant and will fail if a new line is started * before the last is finished processing. * * Use TCOD_line_init_mt instead. *
| void TCOD_line_init_mt | ( | int | xFrom, |
| int | yFrom, | ||
| int | xTo, | ||
| int | yTo, | ||
| TCOD_bresenham_data_t * | data ) |
Initialize a TCOD_bresenham_data_t struct.
| xFrom | The starting x position. |
| yFrom | The starting y position. |
| xTo | The ending x position. |
| yTo | The ending y position. |
| data | Pointer to a TCOD_bresenham_data_t struct. |
After calling this function you use TCOD_line_step_mt to iterate over the individual points on the line.
| bool TCOD_line_mt | ( | int | xFrom, |
| int | yFrom, | ||
| int | xTo, | ||
| int | yTo, | ||
| TCOD_line_listener_t | listener, | ||
| TCOD_bresenham_data_t * | data ) |
Iterate over a line using a callback.
| xo | The origin x position. |
| yo | The origin y position. |
| xd | The destination x position. |
| yd | The destination y position. |
| listener | A TCOD_line_listener_t callback. |
| data | Pointer to a TCOD_bresenham_data_t struct. |
embed:rst:leading-asterisk * .. deprecated:: 1.6.6 * The `data` parameter for this call is redundant, you should call * TCOD_line instead. *
| bool TCOD_line_step | ( | int * | xCur, |
| int * | yCur ) |
Advance to the next point in a line, returns true once the line has ended.
| xCur | An int pointer to fill with the next x position. |
| yCur | An int pointer to fill with the next y position. |
The starting point is excluded by this function. After the ending point is reached, the next call will return true.
embed:rst:leading-asterisk * .. deprecated:: 1.6.6 * This function is not reentrant and will fail if a new line is started * before the last is finished processing. * * Use TCOD_line_step_mt instead. *
| bool TCOD_line_step_mt | ( | int * | xCur, |
| int * | yCur, | ||
| TCOD_bresenham_data_t * | data ) |
Get the next point on a line, returns true once the line has ended.
| xCur | An int pointer to fill with the next x position. |
| yCur | An int pointer to fill with the next y position. |
| data | Pointer to a initialized TCOD_bresenham_data_t struct. |
The starting point is excluded by this function. After the ending point is reached, the next call will return true.