#ifndef H_Display #define H_Display #include #include #include #include //ioctl() and TIOCGWINSZ #include // for STDOUT_FILENO #include class Display { public: Display(); unsigned int Rows() const; unsigned int Cols() const; /// Returns a constant reference to a given line of the screen. std::string const& GetLine(unsigned int i) const; /// Sets the line i to str. /!\ Warning : the line will be truncated at its max length of Cols(). void SetLine(unsigned int i, std::string const& str); /// Get reference to "pixel" at row i, column j. char & GetPixel(unsigned int i, unsigned int j); /// Clears all the screen lines stored within the object and recreates new empty lines of the right size. void ClearScreenLines(); /// Draws all the screen lines stored within the object. You must call ClearScreen() in order to draw in-place. void DrawScreenLines(); /// Updates the screen size stored internally. void UpdateScreenSize(); /// Highlights the line i by inverting its colors (black on white background). void HighlightLine(unsigned int i, bool highlight); /// Returns a winsize structure with size.ws_row is the number of rows, size.ws_col is the number of columns. static winsize GetTerminalSize(); /// Clears the whole screen. static void ClearScreen(); protected: unsigned int screenRows;// lines;//