🕸💡📝Fergus Duniho wrote on Fri, May 2, 2014 05:27 PM UTC:
I fixed up how Game Courier was displaying Shogi boards. Unlike most of the boards here, some of the boards I made for Shogi have coordinates written on them. This throws off the symmetry of the boards. The normal assumption for any board image is that the playing area is centered in the board image. But the playing area is not centered in the board images for Shogi with coordinates already drawn on them. For these boards, I manually adjusted the $offy variable, which is normally calculated on the assumption that the playing area is centered, and I set up a flag called $drawcoordinates, which can be set to false for these boards.
I could not find a perfect value for $offy, though, because some Shogi pieces are optimized, and some are not. All the ones I made are optimized, meaning that the image file does not include anything above, below, or to the sides of the piece image. But I've also included Kinki and Ryoko images, which are all the same dimensions, irrespective of the piece size. And I can't easily optimize these, since the images include shading, so that the area outside the piece is not a single uniform color. So I have compromised on a value for $offy that roughly centers the optimized pieces and keeps the Kinki and Ryoko pieces from spilling onto neighboring spaces.
Another issue with the Shogi boards was that I made boards in two sizes. Besides the ones with coordinates, I made some without coordinates, which have narrower spaces between the board and the off-board areas. So the code now recognizes which size board is being used for Shogi and adjusts the file widths accordingly.
When playing Shogi or other games using the same boards, you can now choose from all the Shogi boards available. Since boards with coordinates are paired with upside-down versions with the coordinates right-side up, the list now includes only one board from each list of paired boards. Depending on your side, the appropriate board will be used.
Finally, I updated the code for customizing boards when playing, moving pieces, or viewing a game.