00001
00002
00003
00004
00005
00006 #ifndef DRAWING_AREA_H_1746585496
00007 #define DRAWING_AREA_H_1746585496
00008 #include <string>
00009 #include <ncurses.h>
00010
00011 namespace crs {
00012
00013 class drawing_area {
00014 protected:
00015 unsigned int width, height;
00016 chtype background;
00017 chtype *buffer;
00018 void resize_buffer();
00019 public:
00020 struct bad_coords{};
00021 drawing_area( const chtype Background, const unsigned int Width, const unsigned int Height );
00022 void resize( const unsigned int Width, const unsigned int Height );
00023 void setText( const std::string &text, const unsigned int x, const unsigned int y );
00024 void putPixel( const unsigned int x, const unsigned int y, const chtype ch );
00025 void fill( const chtype ch );
00026 void drawHLine( const unsigned int x, const unsigned int y, unsigned int len, const chtype ch );
00027 void drawVLine( const unsigned int x, const unsigned int y, unsigned int height, const chtype ch );
00028 void fillRect( const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, const chtype ch );
00029 inline chtype &operator [] ( unsigned int index ) {
00030 return buffer[ index ];
00031 }
00032 };
00033
00034 }
00035
00036 #endif
00037