/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/text_renderer.cc

  • Committer: Tim Marston
  • Date: 2012-03-10 01:25:02 UTC
  • Revision ID: tim@ed.am-20120310012502-v0jwfjghpp63un6n
removed time singleton, not cause it saved much space, but cause i don't want singletons in this project!

Show diffs side-by-side

added added

removed removed

39
39
// output buffer
40
40
static unsigned char _output_buffer;
41
41
 
42
 
// does buffer need rendering?
43
 
static bool _need_render;
44
 
 
45
42
 
46
43
// cache a glyph
47
44
void cache_glyph( char c )
370
367
                int pos = x / 8;
371
368
                if( pos < message_len )
372
369
                {
373
 
                        // ensure correct glyph is cached and pull out column of data
 
370
                        // ensure correct glyph is cached and pull out colun of data
374
371
                        cache_glyph( message[ pos ] );
375
372
                        glyph_col = _glyph_cache[ x % 8 ];
376
373
                }
395
392
void TextRenderer::reset_buffer()
396
393
{
397
394
        _output_buffer = 0;
398
 
        _need_render = false;
399
 
}
400
 
 
401
 
 
402
 
void TextRenderer::buffer_in_use()
403
 
{
404
 
        _need_render = true;
405
395
}
406
396
 
407
397
 
408
398
void TextRenderer::output_buffer()
409
399
{
410
 
        if( !_need_render ) return;
411
 
 
412
400
        for( int a = 8; a >= 0; a-- ) {
413
401
                led( a, ( _output_buffer & 1 )? true : false );
414
402
                _output_buffer >>= 1;
417
405
}
418
406
 
419
407
 
420
 
int TextRenderer::get_font()
421
 
{
422
 
        return _font;
423
 
}
424
 
 
425
 
 
426
 
void TextRenderer::inc_font()
427
 
{
428
 
        if( ++_font >= 4 )
429
 
                _font = 0;
 
408
void TextRenderer::select_font( int font_num )
 
409
{
 
410
        _font = font_num;
430
411
}