Move core of the shogi theme into a library.
[tagua/yd.git] / data / themes / pieces / ShogiTTF / theme.lua
blob52516927e7e7da891a0c6a779e8892e447af5b73
1 import("piece_theme.lua")
2 import("shogi_themelib.lua")
4 shadow=7.0
5 shadow_color="#404050"
6 shadow_offset_x=6
7 shadow_offset_y=4
8 shadow_grow=5
10 theme.options = OptList {
11 BoolOpt("moves_overlay", "Moves overlay", true)
14 function addChar(char, promoted)
15 return function(i, size)
16 i:draw_glyph(Rect(0,0,size,size), "Shogi.ttf", char,
17 promoted and "#d00000" or "#004000",
18 "#fff3c8", 4, false)
19 return i
20 end
21 end
23 function shogi_piece(char, white, promoted, ratio, ...)
24 return addShadow(overlay(tile(white, ratio),
25 shogi_moves(...),
26 addChar(char, promoted)))
27 end
29 theme.black_king = shogi_piece("0x6B", false, false, 1,
30 {-1,1},{0,1},{1,1},
31 {-1,0},{1,0},
32 {-1,-1},{0,-1},{1,-1})
33 theme.black_rook = shogi_piece("0x72", false, false, 0.96,
34 {-1,0,1},{1,0,1},{0,-1,1},{0,1,1})
35 theme.black_p_rook = shogi_piece("0x52", false, true, 0.96,
36 {-1,0,1},{1,0,1},{0,-1,1},{0,1,1},
37 {-1,-1},{1,-1},{-1,1},{1,1})
38 theme.black_bishop = shogi_piece("0x62", false, false, 0.93,
39 {-1,-1,1},{1,-1,1},{-1,1,1},{1,1,1})
40 theme.black_p_bishop = shogi_piece("0x42", false, true, 0.93,
41 {-1,-1,1},{1,-1,1},{-1,1,1},{1,1,1},
42 {-1,0},{1,0},{0,-1},{0,1})
43 theme.black_gold = shogi_piece("0x67", false, false, 0.9,
44 {-1,1},{0,1},{1,1},
45 {-1,0},{1,0},{0,-1})
46 theme.black_silver = shogi_piece("0x73", false, false, 0.9,
47 {-1,1},{0,1},{1,1},
48 {-1,-1},{1,-1})
49 theme.black_p_silver = shogi_piece("0x53", false, true, 0.9,
50 {-1,1},{0,1},{1,1},
51 {-1,0},{1,0},{0,-1})
52 theme.black_knight = shogi_piece("0x68", false, false, 0.86,
53 {-1,2},{1,2})
54 theme.black_p_knight = shogi_piece("0x48", false, true, 0.86,
55 {-1,1},{0,1},{1,1},
56 {-1,0},{1,0},{0,-1})
57 theme.black_lance = shogi_piece("0x6C", false, false, 0.83,
58 {0,1,1})
59 theme.black_p_lance = shogi_piece("0x4C", false, true, 0.83,
60 {-1,1},{0,1},{1,1},
61 {-1,0},{1,0},{0,-1})
62 theme.black_pawn = shogi_piece("0x70", false, false, 0.8,
63 {0,1})
64 theme.black_p_pawn = shogi_piece("0x50", false, true, 0.8,
65 {-1,1},{0,1},{1,1},
66 {-1,0},{1,0},{0,-1})
68 theme.white_king = shogi_piece("0x6B", true, false, 1,
69 {-1,1},{0,1},{1,1},
70 {-1,0},{1,0},
71 {-1,-1},{0,-1},{1,-1})
72 theme.white_rook = shogi_piece("0x72", true, false, 0.96,
73 {-1,0,1},{1,0,1},{0,-1,1},{0,1,1})
74 theme.white_p_rook = shogi_piece("0x52", true, true, 0.96,
75 {-1,0,1},{1,0,1},{0,-1,1},{0,1,1},
76 {-1,-1},{1,-1},{-1,1},{1,1})
77 theme.white_bishop = shogi_piece("0x62", true, false, 0.93,
78 {-1,-1,1},{1,-1,1},{-1,1,1},{1,1,1})
79 theme.white_p_bishop = shogi_piece("0x42", true, true, 0.93,
80 {-1,-1,1},{1,-1,1},{-1,1,1},{1,1,1},
81 {-1,0},{1,0},{0,-1},{0,1})
82 theme.white_gold = shogi_piece("0x67", true, false, 0.9,
83 {-1,1},{0,1},{1,1},
84 {-1,0},{1,0},{0,-1})
85 theme.white_silver = shogi_piece("0x73", true, false, 0.9,
86 {-1,1},{0,1},{1,1},
87 {-1,-1},{1,-1})
88 theme.white_p_silver = shogi_piece("0x53", true, true, 0.9,
89 {-1,1},{0,1},{1,1},
90 {-1,0},{1,0},{0,-1})
91 theme.white_knight = shogi_piece("0x68", true, false, 0.86,
92 {-1,2},{1,2})
93 theme.white_p_knight = shogi_piece("0x48", true, true, 0.86,
94 {-1,1},{0,1},{1,1},
95 {-1,0},{1,0},{0,-1})
96 theme.white_lance = shogi_piece("0x6C", true, false, 0.83,
97 {0,1,1})
98 theme.white_p_lance = shogi_piece("0x4C", true, true, 0.83,
99 {-1,1},{0,1},{1,1},
100 {-1,0},{1,0},{0,-1})
101 theme.white_pawn = shogi_piece("0x70", true, false, 0.8,
102 {0,1})
103 theme.white_p_pawn = shogi_piece("0x50", true, true, 0.8,
104 {-1,1},{0,1},{1,1},
105 {-1,0},{1,0},{0,-1})
107 -- To be able to adapt this theme to chess too
108 -- should use a Free King (\u5954\u738b) instead
109 theme.black_queen = theme.black_gold
110 theme.white_queen = theme.white_gold