Chess Assets
Posted: Fri Apr 17, 2020 9:16 am
I'm going to make a pgn viewer with it, but it's good for a lot of projects in the chess realm. Fully scalable and customizable.
Code: Select all
;300,sz
;///////////////////////////////////////////////////
;
; Module: Chess Assets
; All assets drawn with Vector library
; Copied from a popular public-domain design
; Author: netmaestro
; Date: April 17, 2020
; license: Do as you like, modify, say you
; wrote it, whatever. Make me proud.
;
;///////////////////////////////////////////////////
DeclareModule ChessAssets
Structure Square
x.i
y.i
size.i
pid.s
EndStructure
Global NewMap square.square()
Global w.d,h.d
Declare WhiteKing (sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
Declare WhiteQueen (sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
Declare WhiteRook (sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
Declare WhiteBishop(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
Declare WhiteKnight(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
Declare WhitePawn (sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
Declare BlackKing (sz.d, gradient.b=0, linecolor.q=$FFFFFFFF, fillcolor.q=$FF000000)
Declare BlackQueen (sz.d, gradient.b=0, linecolor.q=$FFFFFFFF, fillcolor.q=$FF000000)
Declare BlackRook (sz.d, gradient.b=0, linecolor.q=$FFFFFFFF, fillcolor.q=$FF000000)
Declare BlackBishop(sz.d, gradient.b=0, linecolor.q=$FFFFFFFF, fillcolor.q=$FF000000)
Declare BlackKnight(sz.d, gradient.b=0, linecolor.q=$FFFFFFFF, fillcolor.q=$FF000000)
Declare BlackPawn (sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FF000000)
Declare ChessBoardWhitePlayer (size, color1=$FFb7866e, color2=$FFfcfdf8)
Declare ChessBoardBlackPlayer (size, color1=$FFb7866e, color2=$FFfcfdf8)
Macro GetFill_White()
If gradient
VectorSourceLinearGradient(0.0000*sz,0.5000*sz,1.0000*sz,0.5000*sz)
VectorSourceGradientColor(fillcolor, 0.0)
VectorSourceGradientColor(fillcolor, 0.3)
VectorSourceGradientColor(RGBA(Red(fillcolor)*0.85,Green(fillcolor)*0.85,Blue(fillcolor)*0.85,255), 1.0)
Else
VectorSourceColor(fillcolor)
EndIf
EndMacro
Macro GetFill_Black()
If gradient
VectorSourceLinearGradient(0.0000*sz,0.5000*sz,1.0000*sz,0.5000*sz)
VectorSourceGradientColor(RGBA(Red(fillcolor)+60,Green(fillcolor)+60,Blue(fillcolor)+60,255), 0.0)
VectorSourceGradientColor(fillcolor, 1.0)
Else
VectorSourceColor(fillcolor)
EndIf
EndMacro
EndDeclareModule
Module ChessAssets
Procedure WhiteKing(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.5*sz,0.5*sz)
AddPathCurve(0.6933*sz,0.0867*sz,1.1400*sz,0.4667*sz,0.7433*sz,0.6633*sz)
AddPathLine(0.7447*sz,0.8366*sz)
AddPathCurve(0.6333*sz,0.9100*sz,0.3666*sz,0.9100*sz,0.2533*sz,0.8366*sz)
AddPathLine(0.2567*sz,0.6633*sz)
AddPathCurve(-0.1400*sz,0.4667*sz,0.3067*sz,0.0867*sz,0.5*sz,0.5*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_Preserve)
MovePathCursor(0.4300*sz,0.3900*sz)
AddPathCurve(0.4333*sz,0.3600*sz,0.3833*sz,0.2600*sz,0.5*sz,0.22*sz)
AddPathCurve(0.6166*sz,0.2600*sz,0.5666*sz,0.3600*sz,0.5700*sz,0.3900*sz)
AddPathLine(0.5*sz,0.5*sz)
AddPathLine(0.4300*sz,0.3900*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
MovePathCursor(0.5*sz,0.5*sz)
AddPathLine(0.5*sz,0.6033*sz)
MovePathCursor(0.5*sz,0.073*sz)
AddPathLine(0.5*sz,0.22*sz)
MovePathCursor(0.44*sz,0.121*sz)
AddPathLine(0.56*sz,0.121*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
MovePathCursor(0.2533*sz,0.6633*sz)
AddPathCurve(0.3666*sz,0.5900*sz,0.6333*sz,0.5900*sz,0.7433*sz,0.6633*sz)
MovePathCursor(0.2533*sz,0.7466*sz)
AddPathCurve(0.3666*sz,0.6766*sz,0.6333*sz,0.6766*sz,0.7433*sz,0.7433*sz)
MovePathCursor(0.2533*sz,0.8366*sz)
AddPathCurve(0.3666*sz,0.7633*sz,0.6333*sz,0.7633*sz,0.7433*sz,0.8366*sz)
StrokePath(0.0366*sz)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure WhiteQueen(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.8900*sz,0.2700*sz)
AddPathLine(0.7533*sz,0.6867*sz)
AddPathCurve(0.7433*sz,0.7100*sz,0.7500*sz,0.7333*sz,0.7600*sz,0.7600*sz)
AddPathCurve(0.7867*sz,0.7733*sz,0.7867*sz,0.7967*sz,0.7800*sz,0.8200*sz)
AddPathCurve(0.8000*sz,0.8400*sz,0.8067*sz,0.8533*sz,0.7867*sz,0.8767*sz)
AddPathCurve(0.5933*sz,0.9067*sz,0.4000*sz,0.9067*sz,0.2133*sz,0.8767*sz)
AddPathCurve(0.1867*sz,0.8600*sz,0.1867*sz,0.8400*sz,0.2133*sz,0.8200*sz)
AddPathCurve(0.2067*sz,0.8000*sz,0.2067*sz,0.7733*sz,0.2400*sz,0.7600*sz)
AddPathCurve(0.2533*sz,0.7367*sz,0.2533*sz,0.7100*sz,0.2433*sz,0.6867*sz)
AddPathLine(0.1100*sz,0.2700*sz)
AddPathLine(0.2900*sz,0.5533*sz)
AddPathLine(0.2900*sz,0.1967*sz)
AddPathLine(0.4300*sz,0.5433*sz)
AddPathLine(0.5000*sz,0.1633*sz)
AddPathLine(0.5700*sz,0.5433*sz)
AddPathLine(0.7067*sz,0.2000*sz)
AddPathLine(0.7067*sz,0.5533*sz)
AddPathLine(0.8900*sz,0.2700*sz)
AddPathCircle(0.0900*sz,0.2233*sz,0.0500*sz)
AddPathCircle(0.2900*sz,0.1433*sz,0.0500*sz)
AddPathCircle(0.5000*sz,0.1133*sz,0.0500*sz)
AddPathCircle(0.7100*sz,0.1433*sz,0.0500*sz)
AddPathCircle(0.9067*sz,0.2233*sz,0.0500*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
MovePathCursor(0.7967*sz,0.5733*sz)
AddPathCurve(0.6067*sz,0.5333*sz,0.3900*sz,0.5333*sz,0.2000*sz,0.5733*sz)
MovePathCursor(0.2400*sz,0.7567*sz)
AddPathCurve(0.4133*sz,0.7333*sz,0.5867*sz,0.7333*sz,0.7600*sz,0.7567*sz)
MovePathCursor(0.2333*sz,0.6700*sz)
AddPathCurve(0.4100*sz,0.6400*sz,0.5900*sz,0.6400*sz,0.7667*sz,0.6700*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_DiagonalCorner)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure WhiteRook(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.2167*sz,0.2733*sz)
AddPathLine(0.2167*sz,0.1567*sz)
AddPathLine(0.3133*sz,0.1567*sz)
AddPathLine(0.3133*sz,0.2000*sz)
AddPathLine(0.4400*sz,0.2000*sz)
AddPathLine(0.4400*sz,0.1567*sz)
AddPathLine(0.5600*sz,0.1567*sz)
AddPathLine(0.5600*sz,0.2000*sz)
AddPathLine(0.6867*sz,0.2000*sz)
AddPathLine(0.6867*sz,0.1567*sz)
AddPathLine(0.7800*sz,0.1567*sz)
AddPathLine(0.7800*sz,0.2667*sz)
AddPathLine(0.6767*sz,0.3833*sz)
AddPathLine(0.6767*sz,0.6233*sz)
AddPathLine(0.7567*sz,0.7267*sz)
AddPathLine(0.7567*sz,0.8200*sz)
AddPathLine(0.8333*sz,0.8200*sz)
AddPathLine(0.8333*sz,0.8933*sz)
AddPathLine(0.1667*sz,0.8933*sz)
AddPathLine(0.1667*sz,0.8200*sz)
AddPathLine(0.2433*sz,0.8200*sz)
AddPathLine(0.2433*sz,0.7267*sz)
AddPathLine(0.3233*sz,0.6233*sz)
AddPathLine(0.3233*sz,0.3833*sz)
AddPathLine(0.2133*sz,0.2633*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
MovePathCursor(0.2200*sz,0.2767*sz)
AddPathLine(0.7833*sz,0.2767*sz)
MovePathCursor(0.2467*sz,0.7267*sz)
AddPathLine(0.7567*sz,0.7267*sz)
MovePathCursor(0.2100*sz,0.8200*sz)
AddPathLine(0.8000*sz,0.8200*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_RoundCorner)
MovePathCursor(0.3267*sz,0.3867*sz)
AddPathLine(0.6733*sz,0.3867*sz)
MovePathCursor(0.3233*sz,0.6200*sz)
AddPathLine(0.6767*sz,0.6200*sz)
StrokePath(0.0167*sz,#PB_Path_RoundCorner)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure WhiteBishop(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.5000*sz,0.2067*sz)
AddPathCurve(0.7333*sz,0.2800*sz,0.7900*sz,0.5433*sz,0.6100*sz,0.5867*sz)
AddPathCurve(0.7167*sz,0.6500*sz,0.7567*sz,0.7700*sz,0.5000*sz,0.7833*sz)
AddPathCurve(0.6167*sz,0.8733*sz,0.8000*sz,0.7633*sz,0.9033*sz,0.8833*sz)
AddPathCurve(0.8800*sz,0.9267*sz,0.8500*sz,0.8700*sz,0.7067*sz,0.8833*sz)
AddPathCurve(0.6367*sz,0.8833*sz,0.5667*sz,0.8933*sz,0.5000*sz,0.8667*sz)
AddPathCurve(0.4533*sz,0.8833*sz,0.4167*sz,0.8900*sz,0.2933*sz,0.8833*sz)
AddPathCurve(0.1500*sz,0.8700*sz,0.1300*sz,0.9267*sz,0.1000*sz,0.8833*sz)
AddPathCurve(0.1500*sz,0.7767*sz,0.3833*sz,0.8667*sz,0.5000*sz,0.7833*sz)
AddPathCurve(0.1800*sz,0.7700*sz,0.3567*sz,0.5800*sz,0.3900*sz,0.5833*sz)
AddPathCurve(0.2100*sz,0.5167*sz,0.2667*sz,0.2800*sz,0.5000*sz,0.2067*sz)
AddPathCircle(0.5000*sz,0.1400*sz,0.0600*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
MovePathCursor(0.3867*sz,0.5867*sz)
AddPathLine(0.6100*sz,0.5867*sz)
MovePathCursor(0.3167*sz,0.6867*sz)
AddPathLine(0.6833*sz,0.6867*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_Preserve)
MovePathCursor(0.4367*sz,0.3867*sz)
AddPathLine(0.5633*sz,0.3867*sz)
MovePathCursor(0.5000*sz,0.3233*sz)
AddPathLine(0.5000*sz,0.4500*sz)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure WhiteKnight(sz.d, gradient.b=0, linecolor.q=$FF000000, fillcolor.q=$FFFFFFFF)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.5233*sz,0.1667*sz)
AddPathCurve(0.8667*sz,0.2133*sz,0.9067*sz,0.5267*sz,0.8933*sz,0.8867*sz)
AddPathLine(0.3267*sz,0.8867*sz)
AddPathCurve(0.3000*sz,0.7000*sz,0.5767*sz,0.6667*sz,0.5033*sz,0.4800*sz)
AddPathCurve(0.4667*sz,0.5167*sz,0.4333*sz,0.5267*sz,0.3767*sz,0.5467*sz)
AddPathCurve(0.3233*sz,0.5800*sz,0.2800*sz,0.6333*sz,0.2533*sz,0.6967*sz)
AddPathCurve(0.2200*sz,0.7267*sz,0.1833*sz,0.7000*sz,0.2033*sz,0.6667*sz)
AddPathCurve(0.1267*sz,0.7167*sz,0.0167*sz,0.6000*sz,0.1533*sz,0.4500*sz)
AddPathCurve(0.2500*sz,0.3333*sz,0.1667*sz,0.2833*sz,0.2700*sz,0.2167*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
MovePathCursor(0.2867*sz,0.2500*sz)
AddPathCurve(0.2600*sz,0.2100*sz,0.2433*sz,0.1367*sz,0.2467*sz,0.0867*sz)
AddPathCurve(0.3000*sz,0.0967*sz,0.3500*sz,0.1300*sz,0.4033*sz,0.1867*sz)
AddPathCurve(0.4133*sz,0.1567*sz,0.4300*sz,0.1233*sz,0.4600*sz,0.1000*sz)
AddPathCurve(0.5133*sz,0.1333*sz,0.5233*sz,0.1667*sz,0.5300*sz,0.2333*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
MovePathCursor(0.2067*sz,0.6667*sz)
AddPathLine(0.2300*sz,0.6267*sz)
MovePathCursor(0.5033*sz,0.4800*sz)
AddPathCurve(0.5433*sz,0.4467*sz,0.5400*sz,0.4100*sz,0.5433*sz,0.3667*sz)
MovePathCursor(0.4000*sz,0.1833*sz)
MovePathCursor(0.2667*sz,0.3700*sz)
AddPathCurve(0.2733*sz,0.3400*sz,0.2933*sz,0.3100*sz,0.3200*sz,0.2933*sz)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
AddPathCircle(0.2933*sz,0.3467*sz,0.0233*sz)
FillPath()
MovePathCursor(0.1500*sz,0.5933*sz)
AddPathCurve(0.1467*sz,0.5733*sz,0.1633*sz,0.5533*sz,0.1667*sz,0.5500*sz)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
ProcedureReturn result
EndProcedure
Procedure WhitePawn(sz.d, gradient.b = 0, linecolor.q = $FF000000, fillcolor.q = $FFFFFFFF)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.6033*sz,0.5633*sz)
AddPathCurve(0.7667*sz,0.6333*sz,0.7800*sz,0.8167*sz,0.7833*sz,0.8933*sz)
AddPathLine(0.2200*sz,0.8933*sz)
AddPathCurve(0.2233*sz,0.8167*sz,0.2400*sz,0.6333*sz,0.3933*sz,0.5633*sz)
AddPathCurve(0.3133*sz,0.4867*sz,0.3133*sz,0.3700*sz,0.4133*sz,0.3000*sz)
AddPathCurve(0.3200*sz,0.0800*sz,0.6800*sz,0.0800*sz,0.5900*sz,0.3000*sz)
AddPathCurve(0.6867*sz,0.3700*sz,0.6867*sz,0.4867*sz,0.6033*sz,0.5633*sz)
GetFill_White()
FillPath(#PB_Path_Preserve)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz, #PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure BlackKing(sz.d, gradient.b=0, linecolor.q=$FFFFFFFF, fillcolor.q=$FF000000)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
;Black Shape & Fill
GetFill_Black()
MovePathCursor(0.5*sz,0.5*sz)
AddPathCurve(0.6933*sz,0.0867*sz,1.1400*sz,0.4667*sz,0.7433*sz,0.6633*sz)
AddPathLine(0.7447*sz,0.8366*sz)
AddPathCurve(0.6333*sz,0.9100*sz,0.3666*sz,0.9100*sz,0.2533*sz,0.8366*sz)
AddPathLine(0.2567*sz,0.6633*sz)
AddPathCurve(-0.1400*sz,0.4667*sz,0.3067*sz,0.0867*sz,0.5*sz,0.5*sz)
FillPath(#PB_Path_Preserve)
MovePathCursor(0.4300*sz,0.3900*sz)
AddPathCurve(0.4333*sz,0.3600*sz,0.3833*sz,0.2600*sz,0.5*sz,0.22*sz)
AddPathCurve(0.6166*sz,0.2600*sz,0.5666*sz,0.3600*sz,0.5700*sz,0.3900*sz)
AddPathLine(0.5*sz,0.5*sz)
AddPathLine(0.4300*sz,0.3900*sz)
FillPath(#PB_Path_Preserve)
MovePathCursor(0.5*sz,0.5*sz)
AddPathLine(0.5*sz,0.6033*sz)
MovePathCursor(0.5*sz,0.073*sz)
AddPathLine(0.5*sz,0.22*sz)
MovePathCursor(0.44*sz,0.121*sz)
AddPathLine(0.56*sz,0.121*sz)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
; Light Lines
MovePathCursor(0.5000*sz,0.5533*sz)
AddPathCurve(0.6600*sz,0.0867*sz,1.1133*sz,0.4667*sz,0.7367*sz,0.6433*sz)
MovePathCursor(0.5000*sz,0.5533*sz)
AddPathCurve(0.3400*sz,0.0867*sz,-0.1067*sz,0.4667*sz,0.2567*sz,0.6433*sz)
MovePathCursor(0.5*sz,0.55*sz)
AddPathLine(0.5*sz,0.6033*sz)
MovePathCursor(0.2533*sz,0.6633*sz)
AddPathCurve(0.3666*sz,0.5900*sz,0.6333*sz,0.5900*sz,0.7433*sz,0.6633*sz)
MovePathCursor(0.2533*sz,0.7466*sz)
AddPathCurve(0.3666*sz,0.6766*sz,0.6333*sz,0.6766*sz,0.7433*sz,0.7433*sz)
MovePathCursor(0.2533*sz,0.8366*sz)
AddPathCurve(0.3666*sz,0.7633*sz,0.6333*sz,0.7633*sz,0.7433*sz,0.8366*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure BlackQueen(sz.d, gradient.b = 0, linecolor.q=$FFFFFFFF, fillcolor.q = $FF000000)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
;Black Shape & Fill
MovePathCursor(0.8900*sz,0.2700*sz)
AddPathLine(0.7533*sz,0.6867*sz)
AddPathCurve(0.7433*sz,0.7100*sz,0.7500*sz,0.7333*sz,0.7600*sz,0.7600*sz)
AddPathCurve(0.7867*sz,0.7733*sz,0.7867*sz,0.7967*sz,0.7800*sz,0.8200*sz)
AddPathCurve(0.8000*sz,0.8400*sz,0.8067*sz,0.8533*sz,0.7867*sz,0.8767*sz)
AddPathCurve(0.5933*sz,0.9067*sz,0.4000*sz,0.9067*sz,0.2133*sz,0.8767*sz)
AddPathCurve(0.1867*sz,0.8600*sz,0.1867*sz,0.8400*sz,0.2133*sz,0.8200*sz)
AddPathCurve(0.2067*sz,0.8000*sz,0.2067*sz,0.7733*sz,0.2400*sz,0.7600*sz)
AddPathCurve(0.2533*sz,0.7367*sz,0.2533*sz,0.7100*sz,0.2433*sz,0.6867*sz)
AddPathLine(0.1100*sz,0.2700*sz)
AddPathLine(0.2900*sz,0.5533*sz)
AddPathLine(0.2900*sz,0.1967*sz)
AddPathLine(0.4300*sz,0.5433*sz)
AddPathLine(0.5000*sz,0.1633*sz)
AddPathLine(0.5700*sz,0.5433*sz)
AddPathLine(0.7067*sz,0.2000*sz)
AddPathLine(0.7067*sz,0.5533*sz)
AddPathLine(0.8900*sz,0.2700*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
StrokePath(0.0366*sz)
AddPathCircle(0.0900*sz,0.2233*sz,0.0500*sz)
AddPathCircle(0.2900*sz,0.1433*sz,0.0500*sz)
AddPathCircle(0.5000*sz,0.1133*sz,0.0500*sz)
AddPathCircle(0.7100*sz,0.1433*sz,0.0500*sz)
AddPathCircle(0.9067*sz,0.2233*sz,0.0500*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
StrokePath(0.03366*sz,#PB_Path_DiagonalCorner)
; Light Lines
MovePathCursor(0.2400*sz,0.6300*sz)
AddPathCurve(0.4000*sz,0.5667*sz,0.5900*sz,0.5667*sz,0.7567*sz,0.6300*sz)
MovePathCursor(0.2567*sz,0.7067*sz)
AddPathLine(0.7433*sz,0.7067*sz)
MovePathCursor(0.2333*sz,0.7833*sz)
AddPathCurve(0.4067*sz,0.8133*sz,0.5867*sz,0.8133*sz,0.7633*sz,0.7833*sz)
MovePathCursor(0.2033*sz,0.8500*sz)
AddPathCurve(0.4067*sz,0.8833*sz,0.6033*sz,0.8833*sz,0.7800*sz,0.8500*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz, #PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure BlackRook(sz.d, gradient.b = 0, linecolor.q=$FFFFFFFF, fillcolor.q = $FF000000)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.2167*sz,0.2733*sz)
AddPathLine(0.2167*sz,0.1567*sz)
AddPathLine(0.3133*sz,0.1567*sz)
AddPathLine(0.3133*sz,0.2000*sz)
AddPathLine(0.4400*sz,0.2000*sz)
AddPathLine(0.4400*sz,0.1567*sz)
AddPathLine(0.5600*sz,0.1567*sz)
AddPathLine(0.5600*sz,0.2000*sz)
AddPathLine(0.6867*sz,0.2000*sz)
AddPathLine(0.6867*sz,0.1567*sz)
AddPathLine(0.7800*sz,0.1567*sz)
AddPathLine(0.7800*sz,0.2667*sz)
AddPathLine(0.6767*sz,0.3833*sz)
AddPathLine(0.6767*sz,0.6233*sz)
AddPathLine(0.7567*sz,0.7267*sz)
AddPathLine(0.7567*sz,0.8200*sz)
AddPathLine(0.8333*sz,0.8200*sz)
AddPathLine(0.8333*sz,0.8933*sz)
AddPathLine(0.1667*sz,0.8933*sz)
AddPathLine(0.1667*sz,0.8200*sz)
AddPathLine(0.2433*sz,0.8200*sz)
AddPathLine(0.2433*sz,0.7267*sz)
AddPathLine(0.3233*sz,0.6233*sz)
AddPathLine(0.3233*sz,0.3833*sz)
AddPathLine(0.2133*sz,0.2633*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
StrokePath(0.0366*sz,#PB_Path_RoundCorner)
MovePathCursor(0.2267*sz,0.2767*sz)
AddPathLine(0.7700*sz,0.2767*sz)
MovePathCursor(0.2667*sz,0.7267*sz)
AddPathLine(0.7367*sz,0.7267*sz)
MovePathCursor(0.2467*sz,0.8200*sz)
AddPathLine(0.7600*sz,0.8200*sz)
MovePathCursor(0.3267*sz,0.3867*sz)
AddPathLine(0.6733*sz,0.3867*sz)
MovePathCursor(0.3233*sz,0.6200*sz)
AddPathLine(0.6767*sz,0.6200*sz)
VectorSourceColor(linecolor)
StrokePath(0.0240*sz,#PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure BlackBishop(sz.d, gradient.b = 0, linecolor.q=$FFFFFFFF, fillcolor.q = $FF000000)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.5000*sz,0.2067*sz)
AddPathCurve(0.7333*sz,0.2800*sz,0.7900*sz,0.5433*sz,0.6100*sz,0.5867*sz)
AddPathCurve(0.7167*sz,0.6500*sz,0.7567*sz,0.7700*sz,0.5000*sz,0.7833*sz)
AddPathCurve(0.6167*sz,0.8733*sz,0.8000*sz,0.7633*sz,0.9033*sz,0.8833*sz)
AddPathCurve(0.8800*sz,0.9267*sz,0.8500*sz,0.8700*sz,0.7067*sz,0.8833*sz)
AddPathCurve(0.6367*sz,0.8833*sz,0.5667*sz,0.8933*sz,0.5000*sz,0.8667*sz)
AddPathCurve(0.4533*sz,0.8833*sz,0.4167*sz,0.8900*sz,0.2933*sz,0.8833*sz)
AddPathCurve(0.1500*sz,0.8700*sz,0.1300*sz,0.9267*sz,0.1000*sz,0.8833*sz)
AddPathCurve(0.1500*sz,0.7767*sz,0.3833*sz,0.8667*sz,0.5000*sz,0.7833*sz)
AddPathCurve(0.1800*sz,0.7700*sz,0.3567*sz,0.5800*sz,0.3900*sz,0.5833*sz)
AddPathCurve(0.2100*sz,0.5167*sz,0.2667*sz,0.2800*sz,0.5000*sz,0.2067*sz)
AddPathCircle(0.5000*sz,0.1400*sz,0.0600*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
MovePathCursor(0.3867*sz,0.5867*sz)
AddPathLine(0.6100*sz,0.5867*sz)
MovePathCursor(0.3167*sz,0.6867*sz)
AddPathLine(0.6833*sz,0.6867*sz)
MovePathCursor(0.4367*sz,0.3867*sz)
AddPathLine(0.5633*sz,0.3867*sz)
MovePathCursor(0.5000*sz,0.3233*sz)
AddPathLine(0.5000*sz,0.4500*sz)
VectorSourceColor(linecolor)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure BlackKnight(sz.d, gradient.b = 0, linecolor.q=$FFFFFFFF, fillcolor.q = $FF000000)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.5233*sz,0.1667*sz)
AddPathCurve(0.8667*sz,0.2133*sz,0.9067*sz,0.5267*sz,0.8933*sz,0.8867*sz)
AddPathLine(0.3267*sz,0.8867*sz)
AddPathCurve(0.3000*sz,0.7000*sz,0.5767*sz,0.6667*sz,0.5033*sz,0.4800*sz)
AddPathCurve(0.4667*sz,0.5167*sz,0.4333*sz,0.5267*sz,0.3767*sz,0.5467*sz)
AddPathCurve(0.3233*sz,0.5800*sz,0.2800*sz,0.6333*sz,0.2533*sz,0.6967*sz)
AddPathCurve(0.2200*sz,0.7267*sz,0.1833*sz,0.7000*sz,0.2067*sz,0.6667*sz)
AddPathCurve(0.1267*sz,0.7167*sz,0.0167*sz,0.6000*sz,0.1533*sz,0.4500*sz)
AddPathCurve(0.2500*sz,0.3333*sz,0.1667*sz,0.2833*sz,0.2700*sz,0.2167*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
MovePathCursor(0.3533*sz,0.2333*sz)
AddPathCircle(0.3533*sz,0.2333*sz,0.0167*sz,260,50,#PB_Path_CounterClockwise)
AddPathCurve(0.7667*sz,0.1233*sz,0.8333*sz,0.5100*sz,0.8033*sz,0.8600*sz)
AddPathLine(0.8767*sz,0.8600*sz)
AddPathCurve(0.9167*sz,0.2667*sz,0.6333*sz,0.1000*sz,0.3433*sz,0.2200*sz)
VectorSourceColor(linecolor)
FillPath()
MovePathCursor(0.2867*sz,0.2500*sz)
AddPathCurve(0.2600*sz,0.2100*sz,0.2433*sz,0.1367*sz,0.2467*sz,0.0867*sz)
AddPathCurve(0.3000*sz,0.0967*sz,0.3500*sz,0.1300*sz,0.4033*sz,0.1867*sz)
MovePathCursor(0.4033*sz,0.2533*sz)
AddPathCurve(0.4133*sz,0.1567*sz,0.4300*sz,0.1233*sz,0.4600*sz,0.1000*sz)
AddPathCurve(0.5133*sz,0.1333*sz,0.5233*sz,0.1667*sz,0.5300*sz,0.2333*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
StrokePath(0.0366*sz,#PB_Path_RoundEnd)
MovePathCursor(0.2067*sz,0.6667*sz)
AddPathLine(0.2300*sz,0.6267*sz)
MovePathCursor(0.5033*sz,0.4800*sz)
AddPathCurve(0.5433*sz,0.4467*sz,0.5400*sz,0.4100*sz,0.5433*sz,0.3667*sz)
MovePathCursor(0.4000*sz,0.1833*sz)
MovePathCursor(0.2667*sz,0.3700*sz)
AddPathCurve(0.2733*sz,0.3400*sz,0.2933*sz,0.3100*sz,0.3200*sz,0.2933*sz)
VectorSourceColor(linecolor)
StrokePath(0.0267*sz,#PB_Path_RoundEnd)
AddPathCircle(0.2933*sz,0.3467*sz,0.0233*sz)
FillPath()
MovePathCursor(0.1500*sz,0.5933*sz)
AddPathCurve(0.1467*sz,0.5733*sz,0.1633*sz,0.5533*sz,0.1667*sz,0.5500*sz)
StrokePath(0.0267*sz,#PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure BlackPawn(sz.d, gradient.b = 0, linecolor.q = $FF000000, fillcolor.q = $FF000000)
result = CreateImage(#PB_Any, sz, sz, 32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(result))
MovePathCursor(0.6033*sz,0.5633*sz)
AddPathCurve(0.7667*sz,0.6333*sz,0.7800*sz,0.8167*sz,0.7833*sz,0.8933*sz)
AddPathLine(0.2200*sz,0.8933*sz)
AddPathCurve(0.2233*sz,0.8167*sz,0.2400*sz,0.6333*sz,0.3933*sz,0.5633*sz)
AddPathCurve(0.3133*sz,0.4867*sz,0.3133*sz,0.3700*sz,0.4133*sz,0.3000*sz)
AddPathCurve(0.3200*sz,0.0800*sz,0.6800*sz,0.0800*sz,0.5900*sz,0.3000*sz)
AddPathCurve(0.6867*sz,0.3700*sz,0.6867*sz,0.4867*sz,0.6033*sz,0.5633*sz)
GetFill_Black()
FillPath(#PB_Path_Preserve)
VectorSourceColor(linecolor)
StrokePath(0.0100*sz, #PB_Path_RoundEnd)
StopVectorDrawing()
ProcedureReturn result
EndProcedure
Procedure ChessBoardWhitePlayer(size, color1=$FFb7866e, color2=$FFfcfdf8)
Protected ret.i, p.d=size
Shared w.d, h.d
ret = CreateImage(#PB_Any, size, size,32, #PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(ret))
squareids = LoadFont(#PB_Any, "Arial", 11, #PB_Font_Bold)
squaretamps = LoadFont(#PB_Any, "verdana", 10)
VectorSourceColor(color2)
AddPathBox(0, 0, size, size)
FillPath()
MovePathCursor(0,0)
AddPathBox(0, 0, size, size)
VectorSourceColor($ff000000)
StrokePath(2)
VectorSourceColor(color1)
MovePathCursor(0,0)
AddPathBox(0.04*p,0.04*p,0.92*p,0.92*p)
StrokePath(0.0075*p)
AddPathBox(0.05*p, 0.05*p,0.90*p, 0.90*p)
StrokePath(0.004*p)
x.d = 0.05*p : y.d = 0.05*p : yy.d = y
w.d = (p-(0.05*p)*2)/8 : h.d = w
For i=1 To 4
AddPathBox(x+w,yy,w,h)
AddPathBox(x+w*3,yy,w,h)
AddPathBox(x+w*5,yy,w,h)
AddPathBox(x+w*7,yy,w,h)
yy+h
AddPathBox(x,yy,w,h)
AddPathBox(x+w*2,yy,w,h)
AddPathBox(x+w*4,yy,w,h)
AddPathBox(x+w*6,yy,w,h)
yy+h
Next
VectorSourceColor(color1)
FillPath()
For j=1 To 8
For i=1 To 8
With square(Chr(j+96)+Str(i))
\x = x + w * (j-1)
\y = y + h * (8-i)
EndWith
Next
Next
; ForEach square()
; text$ = square()\id
; MovePathCursor(square()\x,square()\y)
; VectorFont(FontID(squaretamps))
; VectorSourceColor(RGBA(0,0,0,255))
; DrawVectorText(text$)
; Next
VectorFont(FontID(squareids), p/36)
y=0.05*p + h/2 - p/64
For i=8 To 1 Step -1
MovePathCursor(p*0.012, y)
DrawVectorText(Str(i))
MovePathCursor((p-p*0.012)-VectorTextWidth(Str(i)), y)
DrawVectorText(Str(i))
y+h
Next
x=0.05*p + w/2 - VectorTextWidth("A")/2
y=p-p*0.003-VectorTextHeight("A")
For i=97 To 104
MovePathCursor(x, y)
DrawVectorText(Chr(i))
MovePathCursor(x, p*0.0035)
DrawVectorText(Chr(i))
x+w
Next
StopVectorDrawing()
ProcedureReturn ret
EndProcedure
Procedure ChessBoardBlackPlayer(size, color1=$FFb7866e, color2=$FFfcfdf8)
Protected ret.i, p.d=size
ret = CreateImage(#PB_Any, size, size)
StartVectorDrawing(ImageVectorOutput(ret))
squareids = LoadFont(#PB_Any, "Arial", 11, #PB_Font_Bold)
squaretamps = LoadFont(#PB_Any, "verdana", 10)
VectorSourceColor(color2)
AddPathBox(0, 0, size, size)
FillPath()
MovePathCursor(0,0)
AddPathBox(0, 0, size, size)
VectorSourceColor(RGBA(0,0,0,255))
StrokePath(2)
VectorSourceColor(color1)
MovePathCursor(0,0)
AddPathBox(0.04*p,0.04*p,0.92*p,0.92*p)
StrokePath(0.0075*p)
AddPathBox(0.05*p, 0.05*p,0.90*p, 0.90*p)
StrokePath(0.004*p)
x.d = 0.05*p : y.d = 0.05*p
w.d = (p-(0.05*p)*2)/8 : h.d = w
For i=1 To 4
AddPathBox(x+w,y,w,h)
AddPathBox(x+w*3,y,w,h)
AddPathBox(x+w*5,y,w,h)
AddPathBox(x+w*7,y,w,h)
y+h
AddPathBox(x,y,w,h)
AddPathBox(x+w*2,y,w,h)
AddPathBox(x+w*4,y,w,h)
AddPathBox(x+w*6,y,w,h)
y+h
Next
VectorSourceColor(color1)
FillPath()
For j=8 To 1 Step -1
For i=8 To 1 Step -1
With square(Chr(j+96)+Str(i))
\x = x + w * (8-j)
\y = y + h * (i-9)
EndWith
Next
Next
; ForEach square()
; text$ = square()\id
; MovePathCursor(square()\x,square()\y)
; VectorFont(FontID(squaretamps))
; VectorSourceColor(RGBA(0,0,0,255))
; DrawVectorText(text$)
; Next
VectorFont(FontID(squareids), p/36)
y=0.05*p + h/2 - p/64
For i=1 To 8
MovePathCursor(p*0.012, y)
DrawVectorText(Str(i))
MovePathCursor((p-p*0.012)-VectorTextWidth(Str(i)), y)
DrawVectorText(Str(i))
y+h
Next
x=0.05*p + w/2 - VectorTextWidth("A")/2
y=p-p*0.003-VectorTextHeight("A")
For i=104 To 97 Step -1
MovePathCursor(x, y)
DrawVectorText(Chr(i))
MovePathCursor(x, p*0.0035)
DrawVectorText(Chr(i))
x+w
Next
StopVectorDrawing()
ProcedureReturn ret
EndProcedure
EndModule
;Test:
UseModule ChessAssets
board = ChessBoardBlackPlayer(900)
wk = WhiteKing (w,1)
wq = WhiteQueen (w,1)
wr = WhiteRook (w,1)
wb = WhiteBishop(w,1)
wn = WhiteKnight(w,1)
wp = WhitePawn (w,1)
bk = BlackKing (w,1)
bq = BlackQueen (w,1)
br = BlackRook (w,1)
bb = BlackBishop(w,1)
bn = BlackKnight(w,1)
bp = BlackPawn (w,1)
StartDrawing(ImageOutput(board))
DrawAlphaImage(ImageID(wk),square("e1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wq),square("d1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wb),square("c1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wn),square("b1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wr),square("a1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wb),square("f1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wn),square("g1")\x,square("e1")\y)
DrawAlphaImage(ImageID(wr),square("h1")\x,square("e1")\y)
For i=97 To 104
DrawAlphaImage(ImageID(wp),square(Chr(i)+"2")\x,square(Chr(i)+"2")\y)
Next
DrawAlphaImage(ImageID(bk),square("e8")\x,square("e8")\y)
DrawAlphaImage(ImageID(bq),square("d8")\x,square("e8")\y)
DrawAlphaImage(ImageID(bb),square("c8")\x,square("e8")\y)
DrawAlphaImage(ImageID(bn),square("b8")\x,square("e8")\y)
DrawAlphaImage(ImageID(br),square("a8")\x,square("e8")\y)
DrawAlphaImage(ImageID(bb),square("f8")\x,square("e8")\y)
DrawAlphaImage(ImageID(bn),square("g8")\x,square("e8")\y)
DrawAlphaImage(ImageID(br),square("h8")\x,square("e8")\y)
For i=97 To 104
DrawAlphaImage(ImageID(bp),square(Chr(i)+"7")\x,square(Chr(i)+"7")\y)
Next
StopDrawing()
OpenWindow(0,0,0,ImageWidth(board),ImageHeight(board),"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ImageGadget(0,0,0,0,0,ImageID(board))
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow