Check out Grant Acedrex, our featured variant for April, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Question for HG Muller[Subject Thread] [Add Response]
H. G. Muller wrote on Tue, Sep 12, 2023 07:13 AM UTC in reply to wdtr2 from Mon Sep 11 08:29 PM:

Well, what sucked was the fact that for shortage of piece images I had to assign some images with a strong association to a move to a completely different piece. Such as the Camel and Knight that you mention.

And indeed, Jocly slices the desired part out of a file that contains all pieces. The instructions for which area to take out of the file are in the game's *-view.js file. It appears that I indeed did not backport Chu Shogi to source code yet, but in the library file http://hgm.nubati.net/jocly/jocly-master/dist/browser/games/chessbase/chu-chess-view.js you can see how the association is made by searching for 'sprites' on that page. There you find something like (reformatted for the purpose of showing here):

View.Game.cbFairyPieceStyle=function(e){
return $.extend(!0, {
      1: {default:{"2d":{clipy:0}}},
    -1": {default:{"2d":{clipy:100}}},
  default: {
        "3d":{display:this.cbDisplayPieceFn(this.cbFairyPieceStyle3D)},
        "2d":{file:this.mViewOptions.fullPath+"/res/fairy/wikipedia-fairy-sprites.png",
              clipwidth:100,
              clipheight:100
             }
  },
"sh-pawn":{"2d":{clipx:0}},
"sh-shuttle":{"2d":{clipx:2700}},
"sh-copper":{"2d":{clipx:2400}},
"sh-silver":{"2d":{clipx:900}},

The clipwidth, clipheight, clipy and clipx parameters specified there determine which part of the image should be used. Apparently the square size is 100 x 100 pixel here.

Rather than replacing some of the pictograms in the file, I would recommend extending the file with some new pictograms on the right, and then modify the code in chu-chess-view.js to use those image for the corresponding pieces by changing their clipx.