Piece Set Customization
From Jin
This article explains how to create new piece sets for Jin. The mechanism for customizing Jin is explained in the Customization article (which you should read first). All the file names mentioned here refer to files inside the resource archive.
For an example of a piece set, unzip xboard.zip from $JIN/resources/pieces/ and examine its structure.
The definition file
At the root of the resource file is the definition file. This file tells Jin the basic information about the piece set. It is a properties file and should contain the following properties:
classname- This property tells Jin what kind of a resource sits in the file. For piece sets, the value is
free.jin.board.PieceSet. id- A short string identifying the piece set. This will not be visible to the user and must be unique between all piece sets.
name- The name of the piece set. This is the name that will be shown to the user.
piecePainter.classname- The name of the Java class that will draw the piece set. For regular, image based piece sets, use
free.chess.ImagePiecePainteras the value of this property. If you wish to make a special, non image based piece set, you will need to implement thefree.chess.PiecePainterinterface (look in Jin's source code) and put the class file of your class in the resource file (and set thepiecePainter.classnameproperty accordingly, of course). minJavaVersion- This is an optional property which tells Jin the minimum required version of Java that this piece set can be used in. For example, PNG based piece sets can't be used in Java 1.1, so if you use PNG images for the pieces, set this property to
1.2. Note: starting with version 2.14 Jin itself only works on Java 1.4 or later, which supports most popular image file formats, so this property is not as important anymore.
Using free.chess.ImagePiecePainter
If you are using free.chess.ImagePiecePainter (which is currently your only choice except writing your own piece painter), the following properties must also be set in the definition file:
ext- The type, or extension, of the image files (
gif,pngetc.). If this property is not specified, it will default togif. size.list- A list of space separated integers specifying the sizes in which the piece images are available (in pixels). When the chess board is resized, Jin will automatically pick the best available size, so it is very important to provide as many sizes as possible (but not so many that the piece set becomes huge).
For each size specified in size.list, a directory named as the size must be present in the root of the resource file. Each such directory must contain the following image files of the corresponding size:
bb.[ext]- Black Bishop.bk.[ext]- Black King.bn.[ext]- Black Knight.bp.[ext]- Black Pawn.bq.[ext]- Black Queen.br.[ext]- Black Rook.wb.[ext]- White Bishop.wk.[ext]- White King.wn.[ext]- White Knight.wp.[ext]- White Pawn.wq.[ext]- White Queen.wr.[ext]- White Rook.
