Changeset 514 for trunk/src/curses/curses_terminal.cc
- Timestamp:
- 08/08/16 18:25:48 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/curses/curses_terminal.cc
r487 r514 28 28 PDC_save_key_modifiers( true ); 29 29 30 init_pair( 1, 0, 0 ); 31 init_pair( 2, 1, 0 ); 32 init_pair( 3, 2, 0 ); 33 init_pair( 4, 3, 0 ); 34 init_pair( 5, 4, 0 ); 35 init_pair( 6, 5, 0 ); 36 init_pair( 7, 6, 0 ); 37 init_pair( 8, 7, 0 ); 30 for ( short i = 0; i < 64; ++i ) 31 init_pair( i+1, i % 8, i / 8 ); 38 32 39 33 clear(); … … 53 47 } 54 48 55 void curses_terminal::print( position p, uint32color, char ch )49 void curses_terminal::print( position p, term_color fgcolor, term_color bgcolor, char ch ) 56 50 { 51 uint32 fcolor = fgcolor.get_color(); 52 uint32 bcolor = ( bgcolor.get_color() % 8 ) * 8; 57 53 m_update_needed = true; 58 if ( color > 7 ) 59 { 60 attrset(((static_cast<uint32>(color-7) << 24) & 0xff000000ul ) | 0x00800000ul); 61 } 62 else 63 { 64 attrset((static_cast<uint32>(color+1) << 24) & 0xff000000ul); 65 } 54 chtype attr = static_cast<chtype>( ( fcolor > 7 ? fcolor - 7 + bcolor : fcolor + bcolor + 1 ) << 24 ); 55 if ( fcolor > 7 ) attr = attr | 0x00800000ul; 56 attrset(attr); 66 57 mvaddch( p.y-1, p.x-1, chtype(ch) ); 67 58 ::move( m_cursor.y-1, m_cursor.x-1 ); 68 59 } 69 60 70 void curses_terminal::clear( rectangle r )61 void curses_terminal::clear( rectangle r, term_color fgcolor, term_color bgcolor ) 71 62 { 72 attrset( 0x00000000ul | 0x00800000ul ); 63 uint32 fcolor = fgcolor.get_color(); 64 uint32 bcolor = ( bgcolor.get_color() % 8 ) * 8; 65 chtype attr = static_cast<chtype>( ( fcolor > 7 ? fcolor - 7 + bcolor : fcolor + bcolor + 1 ) << 24 ); 66 if ( fcolor > 7 ) attr = attr | 0x00800000ul; 67 attrset( attr ); 73 68 for ( int x = r.ul.x-1; x <= r.lr.x-1; ++x ) 74 69 for ( int y = r.ul.y-1; y <= r.lr.y-1; ++y )
Note: See TracChangeset
for help on using the changeset viewer.