Debian Codegraph @

texmf-dist/source/latex/wargame/hex/extra.dtx

raw
1 % \iffalse
2 % --------------------------------------------------------------------
3 %<*hex>
4 % \fi
5 %
6 % \subsubsection{Extra graphics}
7 % \label{sec:impl:hex:extra}
8 %
9 % To make the interface a bit more flexible we allow for adding
10 % arbitrary stuff to the hexes.
11 %
12 % Some examples of \spec{pic}tures to add in the \spec{extra} stuff.
13 %
14 % \begin{HexKey}{hex/fortress}
15 %
16 % Draw a fortress. An example of a extra graphics entity.
17 %
18 % \begin{macrocode}
19 \tikzset{%
20 hex/fortress/.pic={
21 \path[draw,solid,pic actions]
22 (0: .9) --
23 (0: .7) --
24 (60: .7) -- ( 60:.9) -- ( 60:.7) --
25 (120:.7) -- (120:.9) -- (120:.7) --
26 (180:.7) -- (180:.9) -- (180:.7) --
27 (240:.7) -- (240:.9) -- (240:.7) --
28 (300:.7) -- (300:.9) -- (300:.7) --
29 (0: .7) -- cycle;}}
30 % \end{macrocode}
31 % \end{HexKey}
32 %
33 % \begin{HexKey}{hex/fortress 2}
34 %
35 % Draw a fortress. An example of a extra graphics entity.
36 %
37 % \begin{macrocode}
38 \tikzset{
39 hex/fortress 2/.pic={%
40 \draw[pic actions,transform shape] (0:0.64)
41 foreach \a in {15,45,...,345}{
42 --(\a:0.64)
43 --(\a:0.80)
44 --(\a+15:0.80)
45 --(\a+15:0.64)}
46 --cycle;
47 },
48 }
49 % \end{macrocode}
50 % \end{HexKey}
51 %
52 % \iffalse
53 % --------------------------------------------------------------------
54 % \fi
55 %
56 % \subsubsection{Some macros}
57 %
58 %
59 % \begin{macrocode}
60 \DeclareRobustCommand\fortmark[1][scale=.25]{\tikz[#1,transform shape]{%
61 \pic{hex/fortress 2}}}
62 \providecommand\terrainmark[2][scale=.2]{%
63 \tikz[#1]{\hex[label=,terrain=#2]}}
64 \providecommand\clearhex[1][scale=.2]{\tikz[#1]{\hex[label=]}}
65 \providecommand\woodshex[1][scale=.2]{\terrainmark[#1]{woods}}
66 \providecommand\mountainhex[1][scale=.2]{\terrainmark[#1]{mountains}}
67 \providecommand\cityhex[1][scale=.2]{\terrainmark[#1]{city}}
68 \providecommand\beachhex[1][scale=.2]{\terrainmark[#1]{beach}}
69 \providecommand\seahex[1][scale=.2]{\tikz[#1]{\hex[label=,fill=sea]}}
70 \providecommand\riverhex[1][scale=.2]{%
71 \tikz[#1]{%
72 \hex[label=](c=0,r=0)%
73 \river[](hex cs:e=SW)--(hex cs:e=NE);}}
74 \providecommand\roadhex[1][scale=.2]{%
75 \tikz[#1]{%
76 \hex[label=](c=0,r=0)%
77 \road(hex cs:e=SW)--(hex cs:e=NE);}}
78 % \end{macrocode}
79 %
80 % \iffalse
81 %</hex>
82 % --------------------------------------------------------------------
83 % \fi