Skip to content

Commit

Permalink
gif
Browse files Browse the repository at this point in the history
  • Loading branch information
marknote committed Apr 8, 2017
1 parent 9ff2468 commit d0276f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
27 changes: 13 additions & 14 deletions GoTao/GoTao/Game/GobanView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GobanView: UIView {
let background = UIImage(named:"board_back")

ctx?.draw(background!.cgImage!, in: rec!)
let space = w!/20.0
let space = w! / 20.0
drawLines(ctx!,space:space,w:w!)
drawDots(ctx!,space:space)
if (moves != nil && moves?.count > 0) {
Expand All @@ -59,15 +59,15 @@ class GobanView: UIView {
for i in 0...18
{

ctx.move(to: CGPoint(x: (CGFloat(i+1))*space, y: space))
ctx.addLine(to: CGPoint(x: (CGFloat(i+1))*space, y: w-space))
ctx.move(to: CGPoint(x: (CGFloat(i + 1))*space, y: space))
ctx.addLine(to: CGPoint(x: (CGFloat(i + 1))*space, y: w - space))
ctx.strokePath()
}
for i in 0...18
{

ctx.move(to: CGPoint(x: space, y: (CGFloat(i+1))*space));
ctx.addLine(to: CGPoint(x: w-space, y: (CGFloat(i+1))*space));
ctx.move(to: CGPoint(x: space, y: (CGFloat(i + 1))*space));
ctx.addLine(to: CGPoint(x: w - space, y: (CGFloat(i + 1))*space));
ctx.strokePath();
}

Expand All @@ -84,8 +84,6 @@ class GobanView: UIView {

ctx.addEllipse(in:frame)

//CGContextAddArc(ctx, (CGFloat(1+3+6*i))*space ,CGFloat(1+3+6*j)*space, 2, 0, CGFloat(2.0*M_PI), 1);

ctx.strokePath();
}
}
Expand All @@ -110,19 +108,20 @@ class GobanView: UIView {
if move.isDead {
continue
}
let imageRect = CGRect( x: (CGFloat(move.location.x)+0.5)*stoneSize,y: (CGFloat(move.location.y)+0.5)*stoneSize, width: stoneSize, height: stoneSize);
if move.type == .white
{
let imageRect = CGRect( x: (CGFloat(move.location.x) + 0.5)*stoneSize,
y: (CGFloat(move.location.y) + 0.5)*stoneSize,
width: stoneSize,
height: stoneSize);
if move.type == .white {
ctx.draw((imgWhite?.cgImage)!, in: imageRect)
}else
{
} else {
ctx.draw((imgBlack?.cgImage)!, in: imageRect)

}
if move.groupName.characters.count > 0 {
//CGContextSetTextMatrix(ctx, CGAffineTransformMakeScale(1.0, -1.0))
ctx.setStrokeColor(red: 1, green: 0, blue: 0, alpha: 1)
let p = CGPoint(x: (CGFloat(move.location.x)+0.5)*stoneSize,y: (CGFloat(move.location.y)+0.5)*stoneSize);
let p = CGPoint(x: (CGFloat(move.location.x) + 0.5)*stoneSize,
y: (CGFloat(move.location.y) + 0.5)*stoneSize);
(move.groupName as NSString).draw(at: p, withAttributes:textFontAttributes)
}
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GoTao
Swift based iOS app to read game records and play the game of Go, also known as Weiqi.
Swift 3 based iOS app to read game records and play the game of Go, also known as Weiqi.

Screenshot:
![screenshot](images/screen.jpg)
![screenshot](images/play.gif)

## Features
- Parse go game records(aka kifu)
Expand Down

0 comments on commit d0276f0

Please sign in to comment.