void drawCrossPlayer(GContext* ctx, GPoint center) {

  graphics_context_set_stroke_color(ctx, COLOR_FOREGROUND);

  graphics_draw_line_wide(ctx, GPoint(center.x-12, center.y-12), GPoint(center.x+12, center.y+12));
  graphics_draw_line_wide(ctx, GPoint(center.x-12, center.y+12), GPoint(center.x+12, center.y-12));

}
void drawWinLine(GContext* ctx, GPoint leftmostPoint, GPoint rightmostPoint) {

  // Note: The point names are there for a reason. :)
  // TODO: Make it work either way.

  // Make the ends of the line extend past the edges of the board.

  if (leftmostPoint.x != rightmostPoint.x) {
    // It's not a vertical line so adjust the X axis.
    leftmostPoint.x -= 18;
    rightmostPoint.x += 18;
  }

  if (leftmostPoint.y != rightmostPoint.y) {
    // It's not a horizontal line so adjust the Y axis.
    if (leftmostPoint.y < rightmostPoint.y) {
      leftmostPoint.y -= 18;
      rightmostPoint.y += 18;
    } else {
      leftmostPoint.y += 18;
      rightmostPoint.y -= 18;
    }
  }

  graphics_draw_line_wide(ctx, leftmostPoint, rightmostPoint);
}
示例#3
0
void board_layer_update_callback(Layer *layer, GContext* ctx) {
  graphics_context_set_stroke_color(ctx, COLOR_FOREGROUND);

  // Horizontal line
  graphics_draw_line_wide(ctx, GPoint(10, 89), GPoint(130, 89));
  draw_circle(ctx, GPoint(10, 10));
}