sdlterm/src/sdlterm.h
changeset 60 fccca2a60492
parent 58 50308ed5e4f9
child 61 15088f62c4ac
--- a/sdlterm/src/sdlterm.h	Tue Jan 08 23:59:55 2013 +0100
+++ b/sdlterm/src/sdlterm.h	Wed Jan 09 22:32:15 2013 +0100
@@ -10,10 +10,10 @@
 namespace Style
 {
     enum {
-        BOLD      = 1 << 0,  // bold font
-        UNDERLINE = 1 << 1,  // underline text
-        STANDOUT  = 1 << 2,  // inverse bg/fg
-        BLINK     = 1 << 3,  // blinking
+        BOLD      = 1 << 24,  // bold font
+        UNDERLINE = 1 << 25,  // underline text
+        STANDOUT  = 1 << 26,  // inverse bg/fg
+        BLINK     = 1 << 27,  // blinking
     };
 };
 
@@ -76,7 +76,7 @@
     void close_font();
 
     // do not free surface returned!
-    SDL_Surface *render_cell(Uint32 ch, Uint32 attr);
+    SDL_Surface *render_cell(Uint32 ch, Uint32 attr, bool blink_state);
 
     int get_cell_width() const { return _cell_width; };
     int get_cell_height() const { return _cell_height; };
@@ -124,7 +124,7 @@
     TerminalScreen():
         _screen_surface(NULL), _cells_front(0), _cells_back(0), _render(),
         _pixel_width(0), _pixel_height(0), _width(0), _height(0),
-        _cell_width(0), _cell_height(0) {};
+        _cell_width(0), _cell_height(0), _blink_state(1) {};
     ~TerminalScreen() {};
 
     void select_font(const char *fname_regular, const char *fname_bold, int ptsize);
@@ -133,6 +133,7 @@
     void erase();
     void putch(int x, int y, Uint32 ch, Uint32 attr);
     void toggle_cursor(int x, int y);
+    void toggle_blink() { _blink_state = !_blink_state; _draw_blink(); };
     void commit();
 
     // force full redraw on next commit()
@@ -156,7 +157,10 @@
     int _cell_width;  // character cell width in pixels
     int _cell_height;
 
+    int _blink_state; // 0 - blink chars hidden, 1 - visible
+
     void _reset_cells();
+    void _draw_blink();
 };
 
 
@@ -223,6 +227,7 @@
 
     const char *_translate_keyname(SDLKey sym);
     static Uint32 _wait_event_callback(Uint32 interval, void *param);
+    static Uint32 _blink_toggle_callback(Uint32 interval, void *param);
 };