Exemplo n.º 1
0
	cannon() {
		pos = Vector(0, 0);
		points.push_back(Vector(-5,  2));
		points.push_back(Vector(20,  2));
		points.push_back(Vector(20, -2));
		points.push_back(Vector(-5, -2));
		update_angles();
		angle = PI;
		image = NULL;
	}
Exemplo n.º 2
0
	cannon(std::vector<shot> * Shots) {
		pos = Vector(0, 0);
		points.push_back(Vector(-5,  2));
		points.push_back(Vector(20,  2));
		points.push_back(Vector(20, -2));
		points.push_back(Vector(-5, -2));
		shots = Shots;
		update_angles();
		angle = PI;
	}
Exemplo n.º 3
0
void startup_animation_init() {
  update_angles();
  hour_delta = GPoint(
    DOTS_RADIUS * sin_lookup(hour_angle) / ONE,
    -DOTS_RADIUS * cos_lookup(hour_angle) / ONE);
  gpath_move_to(hour_path, GPoint(CENTER_X + hour_delta.x, CENTER_Y + hour_delta.y));
  min_delta = GPoint(
    DOTS_RADIUS * sin_lookup(min_angle) / ONE,
    -DOTS_RADIUS * cos_lookup(min_angle) / ONE);
  gpath_move_to(min_path, GPoint(CENTER_X + min_delta.x, CENTER_Y + min_delta.y));
  sec_delta = GPoint(
    DOTS_RADIUS * sin_lookup(sec_angle) / ONE,
    -DOTS_RADIUS * cos_lookup(sec_angle) / ONE);
  gpath_move_to(sec_path, GPoint(CENTER_X + sec_delta.x, CENTER_Y + sec_delta.y));
}
Exemplo n.º 4
0
void hands_layer_update_callback(Layer *layer, GContext* ctx) {
#if SCREENSHOT
  now->tm_hour = 10;
  now->tm_min = 9;
  now->tm_sec = 36;
#endif
  update_angles();
  
  // hours and minutes
  gpath_rotate_to(hour_path, hour_angle);
  gpath_rotate_to(min_path, min_angle);
  graphics_context_set_fill_color(ctx, FG_COLOR);
  graphics_context_set_stroke_color(ctx, BG_COLOR);
  gpath_draw_filled(ctx, hour_path);
  gpath_draw_outline(ctx, hour_path);
  graphics_fill_circle(ctx, hour_pos, DOTS_SIZE+3);
  gpath_draw_filled(ctx, min_path);
  gpath_draw_outline(ctx, min_path);
  graphics_fill_circle(ctx, min_pos, DOTS_SIZE+3);

  // seconds
  if (!hide_seconds) {
    GPoint sec_end = GPoint(
      sec_pos.x + SEC_RADIUS * sin_lookup(sec_angle) / ONE,
      sec_pos.y - SEC_RADIUS * cos_lookup(sec_angle) / ONE);
    graphics_context_set_fill_color(ctx, BG_COLOR);
    gpath_rotate_to(sec_path, sec_angle);
    gpath_draw_filled(ctx, sec_path);
    graphics_context_set_stroke_color(ctx, FG_COLOR);
    graphics_context_set_compositing_mode(ctx, GCompOpAssignInverted);
    graphics_draw_line(ctx, sec_pos, sec_end);
  }

  // center dot
  graphics_context_set_fill_color(ctx, BG_COLOR);
  graphics_fill_circle(ctx, min_pos, DOTS_SIZE);
}