sdlterm/src/sdlterm.h
changeset 49 1611c462c3e3
parent 48 1f00e90fd72a
child 50 c5b8b9d2da95
equal deleted inserted replaced
48:1f00e90fd72a 49:1611c462c3e3
    43 
    43 
    44 struct TerminalCell
    44 struct TerminalCell
    45 {
    45 {
    46 	Uint16 ch;
    46 	Uint16 ch;
    47 	Uint16 attr;
    47 	Uint16 attr;
       
    48 	bool operator !=(const TerminalCell &rhs) const { return ch != rhs.ch || attr != rhs.attr; };
    48 };
    49 };
    49 
    50 
    50 
    51 
    51 class TerminalScreen
    52 class TerminalScreen
    52 {
    53 {
    53 public:
    54 public:
    54 	TerminalScreen(): _screen_surface(NULL), _cells(NULL), _render() {};
    55 	TerminalScreen(): _screen_surface(NULL), _render() {};
    55 	~TerminalScreen();
    56 	~TerminalScreen() {};
    56 
    57 
    57 	void select_font(const char *fname_regular, const char *fname_bold, int ptsize);
    58 	void select_font(const char *fname_regular, const char *fname_bold, int ptsize);
    58 	void resize(int pxwidth, int pxheight);
    59 	void resize(int pxwidth, int pxheight);
    59 
    60 
    60 	void erase();
    61 	void erase();
    66 	int get_cell_width() { return _cell_width; };
    67 	int get_cell_width() { return _cell_width; };
    67 	int get_cell_height() { return _cell_height; };
    68 	int get_cell_height() { return _cell_height; };
    68 
    69 
    69 private:
    70 private:
    70 	SDL_Surface *_screen_surface;
    71 	SDL_Surface *_screen_surface;
    71 	TerminalCell *_cells;
    72 	std::vector<TerminalCell> _cells_front;
       
    73 	std::vector<TerminalCell> _cells_back;
    72 	GlyphRenderer _render;
    74 	GlyphRenderer _render;
    73 
    75 
    74 	int _pixel_width;  // terminal window width in pixels
    76 	int _pixel_width;  // terminal window width in pixels
    75 	int _pixel_height;
    77 	int _pixel_height;
    76 	int _width;  // width in characters
    78 	int _width;  // width in characters
   133 	Uint16 _attr;
   135 	Uint16 _attr;
   134 	int _cursor_x;
   136 	int _cursor_x;
   135 	int _cursor_y;
   137 	int _cursor_y;
   136 	bool _cursor_visible;
   138 	bool _cursor_visible;
   137 
   139 
       
   140 	int _mousemove_last_x;
       
   141 	int _mousemove_last_y;
       
   142 
   138 	const char *_translate_keyname(SDLKey sym);
   143 	const char *_translate_keyname(SDLKey sym);
   139 };
   144 };
   140 
   145