Exemple #1
0
void RIBBON_GRAPH::draw(float* d, int ln, bool with_ticks) {
    int i;

    data = d;
    len = ln;
    dmax = 0;
    for (i=0; i<len; i++) {
        if (data[i] > dmax) dmax = data[i];
    }
    if (dmax ==0) dmax = 1;

    mode_shaded(color);
    glBegin(GL_QUADS);
    draw_x(0);
    for (i=1; i<len-1; i++) {
        draw_y(i);
        draw_x(i);
    }
    draw_x(len-1);
    if (with_ticks) {
        mode_shaded(tick_color);
        for (i=0; i<3; i++) {
            draw_tick(i);
        }
    }
    glEnd();
}
Exemple #2
0
void Clock::draw() const 
{ cwin << Circle(center, radius); 
  int i; 
  const double HOUR_TICK_LENGTH = 0.2; 
  const double MINUTE_TICK_LENGTH = 0.1; 
  const double HOUR_HAND_LENGTH = 0.6; 
  const double MINUTE_HAND_LENGTH = 0.75; 
  for (i = 0; i < 12; i++) 
  { draw_tick(i * 5, HOUR_TICK_LENGTH); 
    int j; 
    for (j = 1; j <= 4; j++) draw_tick(i*5 + j, MINUTE_TICK_LENGTH); 
  } 
  draw_hand(current_time.get_minutes(), MINUTE_HAND_LENGTH); 
  draw_hand((current_time.get_hours() + 
  current_time.get_minutes()/60.0)*5, HOUR_HAND_LENGTH); 
}