1 import("piece_theme.lua")
2 import("shogi_themelib.lua")
10 fontnames
= {"Potraced from ???", "Potraced from shogi.net"}
11 fontlist
= {"Shogi.ttf", "Shogi2.ttf"}
13 theme
.options
= OptList
{
14 BoolOpt("moves_overlay", "Moves overlay", true),
15 SelectOpt("symbols", "Symbol set", BoolOptList
{
16 BoolOpt("use_predefined", "Predefined", true, OptList
{
17 ComboOpt("font", "Symbol set", fontnames
)
19 BoolOpt("use_custom", "Custom font", false, OptList
{
20 UrlOpt("file", "SVG glyph directory", "Shogi.ttf")
22 -- BoolOpt("use_system", "System font", false, OptList {
23 -- FontOpt("font", "System font", Font("Arial", true, true))
28 function addChar(char
, promoted
)
29 return function(i
, size
)
30 i
:draw_glyph(Rect(0,0,size
,size
),
31 theme
.options
.symbols
.options
.use_predefined
.value
32 and fontlist
[theme
.options
.symbols
.options
.use_predefined
.sub_options
.font
.selected
+1]
33 or theme
.options
.symbols
.options
.use_custom
.value
34 and theme
.options
.symbols
.options
.use_custom
.sub_options
.file
.value
35 or theme
.options
.symbols
.options
.use_system
.sub_options
.font
.selected
,
36 char
, promoted
and "#d00000" or "#004000",
42 function shogi_piece(char
, white
, promoted
, ratio
, moves
)
43 return addShadow(overlay(tile(white
, ratio
),
45 addChar(char
, promoted
)))
48 theme
.black_king
= shogi_piece("0x6B", false, false, 1, shogimoves_king
)
49 theme
.black_rook
= shogi_piece("0x72", false, false, 0.96, shogimoves_rook
)
50 theme
.black_p_rook
= shogi_piece("0x52", false, true, 0.96, shogimoves_dragon
)
51 theme
.black_bishop
= shogi_piece("0x62", false, false, 0.93, shogimoves_bishop
)
52 theme
.black_p_bishop
= shogi_piece("0x42", false, true, 0.93, shogimoves_horse
)
53 theme
.black_gold
= shogi_piece("0x67", false, false, 0.9, shogimoves_gold
)
54 theme
.black_silver
= shogi_piece("0x73", false, false, 0.9, shogimoves_silver
)
55 theme
.black_p_silver
= shogi_piece("0x53", false, true, 0.9, shogimoves_gold
)
56 theme
.black_knight
= shogi_piece("0x68", false, false, 0.86, shogimoves_knight
)
57 theme
.black_p_knight
= shogi_piece("0x48", false, true, 0.86, shogimoves_gold
)
58 theme
.black_lance
= shogi_piece("0x6C", false, false, 0.83, shogimoves_lance
)
59 theme
.black_p_lance
= shogi_piece("0x4C", false, true, 0.83, shogimoves_gold
)
60 theme
.black_pawn
= shogi_piece("0x70", false, false, 0.8, shogimoves_pawn
)
61 theme
.black_p_pawn
= shogi_piece("0x50", false, true, 0.8, shogimoves_gold
)
63 theme
.white_king
= shogi_piece("0x6B", true, false, 1, shogimoves_king
)
64 theme
.white_rook
= shogi_piece("0x72", true, false, 0.96, shogimoves_rook
)
65 theme
.white_p_rook
= shogi_piece("0x52", true, true, 0.96, shogimoves_dragon
)
66 theme
.white_bishop
= shogi_piece("0x62", true, false, 0.93, shogimoves_bishop
)
67 theme
.white_p_bishop
= shogi_piece("0x42", true, true, 0.93, shogimoves_horse
)
68 theme
.white_gold
= shogi_piece("0x67", true, false, 0.9, shogimoves_gold
)
69 theme
.white_silver
= shogi_piece("0x73", true, false, 0.9, shogimoves_silver
)
70 theme
.white_p_silver
= shogi_piece("0x53", true, true, 0.9, shogimoves_gold
)
71 theme
.white_knight
= shogi_piece("0x68", true, false, 0.86, shogimoves_knight
)
72 theme
.white_p_knight
= shogi_piece("0x48", true, true, 0.86, shogimoves_gold
)
73 theme
.white_lance
= shogi_piece("0x6C", true, false, 0.83, shogimoves_lance
)
74 theme
.white_p_lance
= shogi_piece("0x4C", true, true, 0.83, shogimoves_gold
)
75 theme
.white_pawn
= shogi_piece("0x70", true, false, 0.8, shogimoves_pawn
)
76 theme
.white_p_pawn
= shogi_piece("0x50", true, true, 0.8, shogimoves_gold
)
79 -- To be able to adapt this theme to chess too
80 -- FIXME: should find a FreeKing kanji instead
81 theme
.black_queen
= shogi_piece("0x67", false, false, 1, shogimoves_freeking
)
82 theme
.white_queen
= shogi_piece("0x67", true, false, 1, shogimoves_freeking
)