/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-10 12:56:55 UTC
  • Revision ID: tim@ed.am-20120310125655-z72qh4bqou2byi2r
added frame reset code and inited minor mode flavours on mode activation

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
 
 
54
51
 
55
52
void reset_message_param( int message_num )
56
53
{
105
102
void Text::reset_message( int message_num, char mode )
106
103
{
107
104
        _message_modes[ message_num ] = mode;
108
 
        _message_recalc_flags |= 1 << message_num;
 
105
        reset_message_param( message_num );
109
106
}
110
107
 
111
108
 
115
112
        _duration = 0;
116
113
        _last_millis = ::millis();
117
114
        _do_draw_reset = false;
118
 
        _message_recalc_flags = 0;
119
115
 
120
116
        // reset the text renderer's output buffer
121
117
        TextRenderer::reset_buffer();
136
132
 
137
133
void Text::draw( int message_num, int segment )
138
134
{
139
 
        TextRenderer::buffer_in_use();
140
 
 
141
135
        // perform a mid-frame reset, as necessary
142
136
        if( _do_draw_reset && segment > NUM_SEGMENTS / 2 ) {
143
137
                _do_draw_reset = false;
144
138
 
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 ) {
 
139
                if( _message_modes[ message_num ] & MODE_HSCROLL )
 
140
                {
 
141
                        // add to horizontal scroll position
153
142
                        _message_params[ message_num ] +=
154
143
                                _duration * TEXT_SCROLL_SPEED / 1000;
155
144
                        long excess = _message_params[ message_num ] -