/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.cc

  • Committer: Tim Marston
  • Date: 2012-03-21 20:35:28 UTC
  • Revision ID: tim@ed.am-20120321203528-wfhpych1tub75rgj
fixed bug initialising text services on mode activation

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
// mode-specific message parameters
40
40
static signed long _message_params[ NUM_MESSAGE_BUFFERS ];
41
41
 
42
 
// text scaling factors
43
 
static int _message_scale[ NUM_MESSAGE_BUFFERS ];
44
 
 
45
42
// time last frame
46
43
static unsigned long _last_millis;
47
44
 
93
90
                        _message_params[ message_num ] = NUM_SEGMENTS; break;
94
91
                }
95
92
                _message_params[ message_num ] = -( _message_params[ message_num ] -
96
 
                        TextRenderer::get_width( _message_lens[ message_num ],
97
 
                                        _message_scale[ message_num ] ) ) / 2;
 
93
                        TextRenderer::get_width( _message_lens[ message_num ] ) ) / 2;
98
94
        }
99
95
}
100
96
 
106
102
}
107
103
 
108
104
 
109
 
void Text::reset_message( int message_num, char mode, int scale )
 
105
void Text::reset_message( int message_num, char mode )
110
106
{
111
107
        _message_modes[ message_num ] = mode;
112
108
        _message_recalc_flags |= 1 << message_num;
113
 
        _message_scale[ message_num ] = scale;
114
109
}
115
110
 
116
111
 
158
153
                        _message_params[ message_num ] +=
159
154
                                _duration * TEXT_SCROLL_SPEED / 1000;
160
155
                        long excess = _message_params[ message_num ] -
161
 
                                TextRenderer::get_width( _message_lens[ message_num ],
162
 
                                                _message_scale[ message_num ] );
 
156
                                TextRenderer::get_width( _message_lens[ message_num ] );
163
157
                        if( excess >= 0 ) {
164
158
                                reset_message_param( message_num );
165
159
                                _message_params[ message_num ] += excess;
217
211
        TextRenderer::render(
218
212
                _messages[ message_num ], _message_lens[ message_num ],
219
213
                (long)segment + _message_params[ message_num ],
220
 
                ( _message_modes[ message_num ] & 1 ) == 0, 0,
221
 
                _message_scale[ message_num ] );
 
214
                ( _message_modes[ message_num ] & 1 ) == 0, 0 );
222
215
}