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

  • Committer: Tim Marston
  • Date: 2012-03-10 01:01:54 UTC
  • Revision ID: tim@ed.am-20120310010154-lv041mt4275k5jxo
removed most OOP/inheritance crap, saved loads of space!

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
        bool draw_hour = segment == _hour_segment;
55
55
        bool draw_hour_side = 2 >=
56
56
                ( abs( _hour_segment - segment ) + NUM_SEGMENTS ) % NUM_SEGMENTS;
 
57
                
 
58
//              ( segment == ( _hour_segment + 1 ) % NUM_SEGMENTS ) ||
 
59
//              ( segment == ( _hour_segment + NUM_SEGMENTS - 1 ) % NUM_SEGMENTS );
57
60
        bool draw_minute = segment == _minute_segment;
58
61
        bool draw_minute_side = 1 >=
59
62
                ( abs( _minute_segment - segment ) + NUM_SEGMENTS ) % NUM_SEGMENTS;
75
78
 
76
79
void analogue_clock_draw_reset()
77
80
{
 
81
        Time &time = Time::get_instance();
 
82
 
78
83
        // calculate hand locations
79
 
        _hour_segment = ( Time::get_hours() % 12 ) * 5 * NUM_SECOND_SEGMENTS +
80
 
                ( 5 * NUM_SECOND_SEGMENTS * Time::get_minutes() / 60 );
81
 
        _minute_segment = Time::get_minutes() * NUM_SECOND_SEGMENTS +
82
 
                ( NUM_SECOND_SEGMENTS * Time::get_seconds() / 60 );
83
 
        _second_segment = Time::get_seconds() * NUM_SECOND_SEGMENTS;
84
 
}
85
 
 
86
 
 
87
 
void analogue_clock_activate()
88
 
{
89
 
        _flavour = 0;
 
84
        _hour_segment = ( time.get_hours() % 12 ) * 5 * NUM_SECOND_SEGMENTS +
 
85
                ( 5 * NUM_SECOND_SEGMENTS * time.get_minutes() / 60 );
 
86
        _minute_segment = time.get_minutes() * NUM_SECOND_SEGMENTS +
 
87
                ( NUM_SECOND_SEGMENTS * time.get_seconds() / 60 );
 
88
        _second_segment = time.get_seconds() * NUM_SECOND_SEGMENTS;
90
89
}