cube/src/ncdraw.h (923B)
/**
* @file ncdraw.h
* @author Michael Neuper (michael@michaelneuper.com)
*
* Low-level ncurses drawing primitives: canvas initialisation,
* single-pixel rendering, and Bresenham line drawing.
*/
#ifndef NCDRAW_H_
#define NCDRAW_H_
/**
* Represents a single pixel.
*/
typedef struct {
int row, col; /**< coordinates on the screen */
} Pixel;
/**
* Initialises the canvas for drawing.
* Expects <code>endwin()</code> to be called before
* terminating.
*/
void init_canvas(void);
/**
* Draws a single pixel to <code>stdscr<\code>.
* Expects the pixel to fit within the screen.
*
* @param[in] p
* the point to draw
*/
void draw_pixel(Pixel p);
/**
* Draws a line between points two points to
* <code>stdscr<\code> using Bresenham’s line algorithm.
*
* @param[in] p
* starting point
* @param[in] q
* ending point
*/
void draw_line(Pixel p, Pixel q);
#endif // NCDRAW_H_