/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-21 19:37:33 UTC
  • Revision ID: tim@ed.am-20120321193733-29euxt0t0h9dwsj3
added .dep directories to bzrignore

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "Arduino.h"
26
26
#include <avr/pgmspace.h>
27
27
#include "common.h"
28
 
#include "nvram.h"
29
28
 
30
29
 
31
30
// cached glyph
351
350
}
352
351
 
353
352
 
354
 
void TextRenderer::init()
355
 
{
356
 
        Nvram::load( Nvram::NVRAM_FONT, _font );
357
 
        if( _font < 0 || _font >= 4 ) _font = 0;
358
 
}
359
 
 
360
 
 
361
 
int TextRenderer::get_width( int message_len, int scale )
362
 
{
363
 
        return message_len * 8 * scale;
 
353
int TextRenderer::get_width( int message_len )
 
354
{
 
355
        return message_len * 8 * TEXT_SCALE;
364
356
}
365
357
 
366
358
 
367
359
void TextRenderer::render( const char *message, int message_len, int x,
368
 
                                                   bool y_flip, int y_shift, int scale )
 
360
                                                   bool y_flip, int y_shift )
369
361
{
370
362
        char glyph_col = 0;
371
363
 
373
365
        if( x >= 0 )
374
366
        {
375
367
                // scale font
376
 
                x /= scale;
 
368
                x /= TEXT_SCALE;
377
369
 
378
370
                int pos = x / 8;
379
371
                if( pos < message_len )
435
427
{
436
428
        if( ++_font >= 4 )
437
429
                _font = 0;
438
 
        Nvram::save( Nvram::NVRAM_FONT, _font );
439
430
}