@@ -13,12 +13,14 @@ Board::Board(Connection& c, unsigned size)
1313{
1414 using tank::RectangleShape;
1515
16+ // Create board rectangle
1617 const auto pixelSize = stoneSize * size;
1718 auto g = makeGraphic<tank::RectangleShape>(tank::Vectoru{pixelSize,pixelSize});
1819 g->setFillColor ({0 ,125 ,0 });
1920
2021 const unsigned stoneRadius = /* std::ceil*/ (stoneSize/2.0 );
2122
23+ // Create board lines
2224 for (unsigned i = 0 ; i < size; ++i) {
2325 const unsigned offset = i * stoneSize + stoneRadius;
2426 makeGraphic<RectangleShape>(tank::Rectu{0 , offset, pixelSize, 1 })
@@ -27,13 +29,32 @@ Board::Board(Connection& c, unsigned size)
2729 ->setFillColor ({});
2830 }
2931
30- mark_.setSize ({stoneRadius,stoneRadius});
31- mark_.setFillColor ({127 ,127 ,127 });
32- mark_.setPos (tank::Vectori (mark_.getSize () / 2 ));
32+ // Create hoshi
33+ tank::CircleShape hoshi (3 );
34+ hoshi.setOrigin (hoshi.getSize () / 2 );
35+ hoshi.setFillColor ({});
36+ unsigned reducedSize = size - 6 ;
37+ if (size % 2 == 1 and reducedSize <= size) {
38+ for (unsigned i = 0 ; i < 3 ; ++i) {
39+ unsigned x = (i * std::floor (reducedSize / 2 )) + 3 ;
40+ for (unsigned j = 0 ; j < 3 ; ++j) {
41+ unsigned y = (j * std::floor (reducedSize / 2 )) + 3 ;
42+ auto ss = stoneSize;
43+ makeGraphic<tank::CircleShape>(hoshi)
44+ ->setPos ({x*ss + stoneRadius, y*ss + stoneRadius});
45+ }
46+ }
47+ }
3348
49+ // Create cursor
3450 cursor_ = makeGraphic<tank::CircleShape>(stoneRadius);
3551 hideCursor ();
3652
53+ // Create mark and stone flyweights
54+ mark_.setSize ({stoneRadius,stoneRadius});
55+ mark_.setFillColor ({127 ,127 ,127 });
56+ mark_.setPos (tank::Vectori (mark_.getSize () / 2 ));
57+
3758 stoneFlyweights_[White] = tank::CircleShape (stoneRadius);
3859 stoneFlyweights_[Black] = tank::CircleShape (stoneRadius);
3960 stoneFlyweights_[Empty] = tank::CircleShape (0 );
0 commit comments