Changeset 514 for trunk/src/gui/gui_ascii_renderer.cc
- Timestamp:
- 08/08/16 18:25:48 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/gui_ascii_renderer.cc
r487 r514 15 15 struct ascii_render_data : public render_data 16 16 { 17 ascii_render_data() {}18 bool clear;19 bool border;20 char border_chars[8];21 uint32border_color;22 uint32text_color;17 bool clear; 18 bool border; 19 char border_chars[8]; 20 ivec2 padding; 21 term_color border_color; 22 term_color text_color; 23 23 }; 24 24 … … 38 38 er->border = false; 39 39 er->clear = false; 40 er->text_color = 0;41 40 e->m_render_data = er; 42 41 } … … 57 56 58 57 m_style.get( e, "ascii_color", selector, color ); 59 er->text_color = uint32( color );58 er->text_color = term_color::color( color ); 60 59 er->border = false; 60 vec4 padding; 61 m_style.get( e, "ascii_padding", selector, padding ); 62 er->padding = ivec2( int( padding.x ), int( padding.y ) ); 63 61 64 if ( m_style.get( e, "ascii_border", selector, path ) ) 62 65 { … … 65 68 int border_color = 0; 66 69 if ( m_style.get( e, "ascii_border_color", selector, border_color ) ) 67 er->border_color = uint32( border_color );70 er->border_color = term_color::color( border_color ); 68 71 for ( uint32 i = 0; i < 8 && i < path.length(); i++ ) 69 72 er->border_chars[i] = path[i]; … … 76 79 ascii_render_data* er = static_cast< ascii_render_data* >( e->m_render_data ); 77 80 rectangle abs = e->m_absolute; 78 if ( er->clear ) m_terminal->clear( abs );81 if ( er->clear ) m_terminal->clear( abs, term_color::LIGHTGRAY, term_color() ); 79 82 if ( er->border ) 80 83 { 81 84 for ( int x = 0; x < abs.get_width(); ++x ) 82 85 { 83 m_terminal->print( position( abs.ul.x + x, abs.ul.y ), er->border_color, er->border_chars[0] );84 m_terminal->print( position( abs.ul.x + x, abs.lr.y ), er->border_color, er->border_chars[1] );86 m_terminal->print( position( abs.ul.x + x, abs.ul.y ), er->border_color, term_color(), er->border_chars[0] ); 87 m_terminal->print( position( abs.ul.x + x, abs.lr.y ), er->border_color, term_color(), er->border_chars[1] ); 85 88 } 86 89 87 90 for ( int y = 0; y < abs.get_height(); ++y ) 88 91 { 89 m_terminal->print( position( abs.ul.x, abs.ul.y + y ), er->border_color, er->border_chars[2] );90 m_terminal->print( position( abs.lr.x, abs.ul.y + y ), er->border_color, er->border_chars[3] );92 m_terminal->print( position( abs.ul.x, abs.ul.y + y ), er->border_color, term_color(), er->border_chars[2] ); 93 m_terminal->print( position( abs.lr.x, abs.ul.y + y ), er->border_color, term_color(), er->border_chars[3] ); 91 94 } 92 95 93 m_terminal->print( abs.ul, er->border_color, er->border_chars[4] );94 m_terminal->print( abs.ur(), er->border_color, er->border_chars[5] );95 m_terminal->print( abs.ll(), er->border_color, er->border_chars[6] );96 m_terminal->print( abs.lr, er->border_color, er->border_chars[7] );96 m_terminal->print( abs.ul, er->border_color, term_color(), er->border_chars[4] ); 97 m_terminal->print( abs.ur(), er->border_color, term_color(), er->border_chars[5] ); 98 m_terminal->print( abs.ll(), er->border_color, term_color(), er->border_chars[6] ); 99 m_terminal->print( abs.lr, er->border_color, term_color(), er->border_chars[7] ); 97 100 m_terminal->update(); 98 101 } 99 102 if ( !e->m_text.empty() ) 100 103 { 101 position p = abs.ul ;104 position p = abs.ul + er->padding; 102 105 for ( char c : e->m_text ) 103 106 { 104 m_terminal->print( p, er->text_color, c );107 m_terminal->print( p, er->text_color, term_color(), c ); 105 108 ++p.x; 106 109 }
Note: See TracChangeset
for help on using the changeset viewer.