sdlterm/src/sdlterm.h
changeset 53 c4263588b716
parent 52 50a1857557da
child 54 86b84535726e
--- a/sdlterm/src/sdlterm.h	Sat Jan 05 23:00:41 2013 +0100
+++ b/sdlterm/src/sdlterm.h	Sun Jan 06 13:55:02 2013 +0100
@@ -37,7 +37,7 @@
     };
 
 public:
-    void index_to_rgb(int index, SDL_Color &color);
+    void index_to_rgb(int index, SDL_Color &color) const;
 };
 
 
@@ -66,8 +66,8 @@
     // do not free surface returned!
     SDL_Surface *render_cell(Uint32 ch, Uint32 attr);
 
-    int get_cell_width() { return _cell_width; };
-    int get_cell_height() { return _cell_height; };
+    int get_cell_width() const { return _cell_width; };
+    int get_cell_height() const { return _cell_height; };
 
 private:
     TTF_Font *_font_regular;
@@ -100,6 +100,8 @@
 {
     Uint32 ch;
     Uint32 attr;
+
+    TerminalCell() : ch(0), attr(7) {};
     bool operator !=(const TerminalCell &rhs) const { return ch != rhs.ch || attr != rhs.attr; };
 };
 
@@ -118,12 +120,16 @@
 
     void erase();
     void putch(int x, int y, Uint32 ch, Uint32 attr);
+    void toggle_cursor(int x, int y);
     void commit();
 
-    int get_width() { return _width; };
-    int get_height() { return _height; };
-    int get_cell_width() { return _cell_width; };
-    int get_cell_height() { return _cell_height; };
+    // force full redraw on next commit()
+    void redraw();
+
+    int get_width() const { return _width; };
+    int get_height() const { return _height; };
+    int get_cell_width() const { return _cell_width; };
+    int get_cell_height() const { return _cell_height; };
 
 private:
     SDL_Surface *_screen_surface;
@@ -175,18 +181,18 @@
 
     void erase() { _screen.erase(); };
     void putch(int x, int y, Uint32 ch) { _screen.putch(x, y, ch, _attr); };
-    void commit() { _screen.commit(); };
+    void commit();
 
     Uint32 prepare_attr(Uint8 fg, Uint8 bg, Uint8 style) { return (Uint32)fg | (Uint32)bg << 8 | (Uint32)style << 24; };
     void set_attr(Uint32 value) { _attr = value; };
 
-    void set_cursor(int x, int y) { _cursor_x = x; _cursor_y = y; };
-    void show_cursor(bool visible) { _cursor_visible = visible; };
+    void show_cursor(int x, int y) { _cursor_x = x; _cursor_y = y; _cursor_visible = true; };
+    void hide_cursor() { _cursor_visible = false; };
 
     void get_next_event(Event &event);
 
-    int get_width() { return _screen.get_width(); };
-    int get_height() { return _screen.get_height(); };
+    int get_width() const { return _screen.get_width(); };
+    int get_height() const { return _screen.get_height(); };
 
 private:
     TerminalScreen _screen;