1 import("piece_theme.lua")
2 import("shogi_themelib.lua")
10 theme
.options
= OptList
{
11 BoolOpt("moves_overlay", "Moves overlay", true),
12 BoolOpt("single_kanji", "Single kanji on tiles", false),
13 SelectOpt("symbols", "Symbol set", BoolOptList
{
14 -- BoolOpt("use_predefined", "Predefined", true, OptList {
15 -- ComboOpt("font", "Symbol set", fontnames)
17 BoolOpt("use_custom", "Custom font", false, OptList
{
18 UrlOpt("file", "SVG glyph directory", "../../figurines/ShogiTTF/mikachan.ttf")
20 -- BoolOpt("use_system", "System font", false, OptList {
21 -- FontOpt("font", "System font", Font("Arial", true, true))
26 function addChar(complete
, single
, promoted
)
27 return function(i
, size
)
28 font
= theme
.options
.symbols
.options
.use_custom
.sub_options
.file
.value
29 if theme
.options
.single_kanji
.value
then
30 i
:draw_glyph(Rect(size
*0.2,size
*0.25,size
*0.6,size
*0.6), font
, single
,
31 promoted
and "#d00000" or "#004000",
34 --local charsize, margin1, margin2 = 0.45, 0.09, -0.02 -- epgyobld
35 local charsize
, margin1
, margin2
= 0.4, 0.12, 0
36 i
:draw_glyph(Rect(size
*(0.5-charsize
/2),size
*margin1
,size
*charsize
,size
*charsize
),
37 font
, complete
[1], promoted
and "#d00000" or "#004000",
39 i
:draw_glyph(Rect(size
*(0.5-charsize
/2),size
*(0.5+margin2
),size
*charsize
,size
*charsize
),
40 font
, complete
[2], promoted
and "#d00000" or "#004000",
47 function shogi_piece(first
, char
, white
, promoted
, ratio
, moves
)
48 return addShadow(overlay(tile(white
, ratio
),
50 addChar(first
, char
, promoted
)))
53 theme
.black_king
= shogi_piece(shogichars
["jade general"][2], shogichars
["jade general"][1],
54 false, false, 1, shogimoves_king
);
55 theme
.black_rook
= shogi_piece(shogichars
["flying chariot"][2], shogichars
["flying chariot"][1],
56 false, false, 0.96, shogimoves_rook
)
57 theme
.black_dragonking
= shogi_piece(shogichars
["dragon king"][2], shogichars
["dragon king"][1],
58 false, true, 0.96, shogimoves_dragon
)
59 theme
.black_bishop
= shogi_piece(shogichars
["bishop"][2], shogichars
["bishop"][1],
60 false, false, 0.93, shogimoves_bishop
)
61 theme
.black_dragonhorse
= shogi_piece(shogichars
["dragon horse"][2], shogichars
["dragon horse"][1],
62 false, true, 0.93, shogimoves_horse
)
63 theme
.black_gold
= shogi_piece(shogichars
["gold general"][2], shogichars
["gold general"][1],
64 false, false, 0.9, shogimoves_gold
)
65 theme
.black_silver
= shogi_piece(shogichars
["silver general"][2], shogichars
["silver general"][1],
66 false, false, 0.9, shogimoves_silver
)
67 theme
.black_narigin
= shogi_piece(shogichars
["narigin"][2], shogichars
["narigin"][1],
68 false, true, 0.9, shogimoves_gold
)
69 theme
.black_knight
= shogi_piece(shogichars
["knight"][2], shogichars
["knight"][1],
70 false, false, 0.86, shogimoves_knight
)
71 theme
.black_narikei
= shogi_piece(shogichars
["narikei"][2], shogichars
["narikei"][1],
72 false, true, 0.86, shogimoves_gold
)
73 theme
.black_lance
= shogi_piece(shogichars
["incense chariot"][2], shogichars
["incense chariot"][1],
74 false, false, 0.83, shogimoves_lance
)
75 theme
.black_narikyo
= shogi_piece(shogichars
["narikyo"][2], shogichars
["narikyo"][1],
76 false, true, 0.83, shogimoves_gold
)
77 theme
.black_pawn
= shogi_piece(shogichars
["pawn"][2], shogichars
["pawn"][1],
78 false, false, 0.8, shogimoves_pawn
)
79 theme
.black_tokin
= shogi_piece(shogichars
["tokin"][2], shogichars
["tokin"][1],
80 false, true, 0.8, shogimoves_gold
)
82 theme
.white_king
= shogi_piece(shogichars
["king"][2], shogichars
["king"][1],
83 true, false, 1, shogimoves_king
)
84 theme
.white_rook
= shogi_piece(shogichars
["flying chariot"][2], shogichars
["flying chariot"][1],
85 true, false, 0.96, shogimoves_rook
)
86 theme
.white_dragonking
= shogi_piece(shogichars
["dragon king"][2], shogichars
["dragon king"][1],
87 true, true, 0.96, shogimoves_dragon
)
88 theme
.white_bishop
= shogi_piece(shogichars
["bishop"][2], shogichars
["bishop"][1],
89 true, false, 0.93, shogimoves_bishop
)
90 theme
.white_dragonhorse
= shogi_piece(shogichars
["dragon horse"][2], shogichars
["dragon horse"][1],
91 true, true, 0.93, shogimoves_horse
)
92 theme
.white_gold
= shogi_piece(shogichars
["gold general"][2], shogichars
["gold general"][1],
93 true, false, 0.9, shogimoves_gold
)
94 theme
.white_silver
= shogi_piece(shogichars
["silver general"][2], shogichars
["silver general"][1],
95 true, false, 0.9, shogimoves_silver
)
96 theme
.white_narigin
= shogi_piece(shogichars
["narigin"][2], shogichars
["narigin"][1],
97 true, true, 0.9, shogimoves_gold
)
98 theme
.white_knight
= shogi_piece(shogichars
["knight"][2], shogichars
["knight"][1],
99 true, false, 0.86, shogimoves_knight
)
100 theme
.white_narikei
= shogi_piece(shogichars
["narikei"][2], shogichars
["narikei"][1],
101 true, true, 0.86, shogimoves_gold
)
102 theme
.white_lance
= shogi_piece(shogichars
["incense chariot"][2], shogichars
["incense chariot"][1],
103 true, false, 0.83, shogimoves_lance
)
104 theme
.white_narikyo
= shogi_piece(shogichars
["narikyo"][2], shogichars
["narikyo"][1],
105 true, true, 0.83, shogimoves_gold
)
106 theme
.white_pawn
= shogi_piece(shogichars
["pawn"][2], shogichars
["pawn"][1],
107 true, false, 0.8, shogimoves_pawn
)
108 theme
.white_tokin
= shogi_piece(shogichars
["tokin"][2],shogichars
["tokin"][1],
109 true, true, 0.8, shogimoves_gold
)
113 theme
.black_drunkenelephant
= shogi_piece(shogichars
["drunken elephant"][2], shogichars
["drunken elephant"][1],
114 false, false, 1, shogimoves_drunken_elephant
)
115 theme
.black_crownprince
= shogi_piece(shogichars
["crown prince"][2], shogichars
["crown prince"][1],
116 false, true, 1, shogimoves_king
)
118 theme
.white_drunkenelephant
= shogi_piece(shogichars
["drunken elephant"][2], shogichars
["drunken elephant"][1],
119 true, false, 1, shogimoves_drunken_elephant
)
120 theme
.white_crownprince
= shogi_piece(shogichars
["crown prince"][2], shogichars
["crown prince"][1],
121 true, true, 1, shogimoves_king
)
123 -- This is part of Dai Shohi
125 theme
.black_freeking
= shogi_piece(shogichars
["free king"][2], shogichars
["free king"][1],
126 false, false, 1, shogimoves_freeking
)
127 theme
.white_freeking
= shogi_piece(shogichars
["free king"][2], shogichars
["free king"][1],
128 true, false, 1, shogimoves_freeking
)
130 -- To be able to adapt this theme to chess too
131 theme
.black_queen
= theme
.black_freeking
132 theme
.white_queen
= theme
.white_freeking