/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 21:24:17 UTC
  • Revision ID: tim@ed.am-20120321212417-dnba5l1oheddeyxw
fixed time centring and display in settings mode

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
// recalculate message params, based on _duration
49
49
static bool _do_draw_reset;
50
50
 
 
51
// recalculate messages parameters (after message reset)
 
52
static unsigned char _message_recalc_flags;
 
53
 
51
54
 
52
55
void reset_message_param( int message_num )
53
56
{
102
105
void Text::reset_message( int message_num, char mode )
103
106
{
104
107
        _message_modes[ message_num ] = mode;
105
 
        reset_message_param( message_num );
 
108
        _message_recalc_flags |= 1 << message_num;
106
109
}
107
110
 
108
111
 
112
115
        _duration = 0;
113
116
        _last_millis = ::millis();
114
117
        _do_draw_reset = false;
 
118
        _message_recalc_flags = 0;
115
119
 
116
120
        // reset the text renderer's output buffer
117
121
        TextRenderer::reset_buffer();
132
136
 
133
137
void Text::draw( int message_num, int segment )
134
138
{
 
139
        TextRenderer::buffer_in_use();
 
140
 
135
141
        // perform a mid-frame reset, as necessary
136
142
        if( _do_draw_reset && segment > NUM_SEGMENTS / 2 ) {
137
143
                _do_draw_reset = false;
138
144
 
139
 
                if( _message_modes[ message_num ] & MODE_HSCROLL )
140
 
                {
141
 
                        // add to horizontal scroll position
 
145
                // reset message param?
 
146
                if( _message_recalc_flags & ( 1 << message_num ) ) {
 
147
                        _message_recalc_flags &= ~( 1 << message_num );
 
148
                        reset_message_param( message_num );
 
149
                }
 
150
 
 
151
                // add to horizontal scroll position
 
152
                if( _message_modes[ message_num ] & MODE_HSCROLL ) {
142
153
                        _message_params[ message_num ] +=
143
154
                                _duration * TEXT_SCROLL_SPEED / 1000;
144
155
                        long excess = _message_params[ message_num ] -