summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/hex/extra.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/wargame/source/hex/extra.dtx')
-rw-r--r--macros/latex/contrib/wargame/source/hex/extra.dtx83
1 files changed, 83 insertions, 0 deletions
diff --git a/macros/latex/contrib/wargame/source/hex/extra.dtx b/macros/latex/contrib/wargame/source/hex/extra.dtx
new file mode 100644
index 0000000000..05f7215297
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/hex/extra.dtx
@@ -0,0 +1,83 @@
+% \iffalse
+% --------------------------------------------------------------------
+%<*hex>
+% \fi
+%
+% \subsubsection{Extra graphics}
+% \label{sec:impl:hex:extra}
+%
+% To make the interface a bit more flexible we allow for adding
+% arbitrary stuff to the hexes.
+%
+% Some examples of \spec{pic}tures to add in the \spec{extra} stuff.
+%
+% \begin{HexKey}{hex/fortress}
+%
+% Draw a fortress. An example of a extra graphics entity.
+%
+% \begin{macrocode}
+\tikzset{%
+ hex/fortress/.pic={
+ \path[draw,pic actions]
+ (0: .9) --
+ (0: .7) --
+ (60: .7) -- ( 60:.9) -- ( 60:.7) --
+ (120:.7) -- (120:.9) -- (120:.7) --
+ (180:.7) -- (180:.9) -- (180:.7) --
+ (240:.7) -- (240:.9) -- (240:.7) --
+ (300:.7) -- (300:.9) -- (300:.7) --
+ (0: .7) -- cycle;}}
+% \end{macrocode}
+% \end{HexKey}
+%
+% \begin{HexKey}{hex/fortress 2}
+%
+% Draw a fortress. An example of a extra graphics entity.
+%
+% \begin{macrocode}
+\tikzset{
+ hex/fortress 2/.pic={%
+ \draw[pic actions,transform shape] (0:0.64)
+ foreach \a in {15,45,...,345}{
+ --(\a:0.64)
+ --(\a:0.80)
+ --(\a+15:0.80)
+ --(\a+15:0.64)}
+ --cycle;
+ },
+}
+% \end{macrocode}
+% \end{HexKey}
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+%
+% \subsubsection{Some macros}
+%
+%
+% \begin{macrocode}
+\DeclareRobustCommand\fortmark[1][scale=.25]{\tikz[#1,transform shape]{%
+ \pic{hex/fortress 2}}}
+\providecommand\terrainmark[2][scale=.2]{%
+ \tikz[#1]{\hex[label=,terrain=#2]}}
+\providecommand\clearhex[1][scale=.2]{\tikz[#1]{\hex[label=]}}
+\providecommand\woodshex[1][scale=.2]{\terrainmark[#1]{woods}}
+\providecommand\mountainhex[1][scale=.2]{\terrainmark[#1]{mountains}}
+\providecommand\cityhex[1][scale=.2]{\terrainmark[#1]{city}}
+\providecommand\beachhex[1][scale=.2]{\terrainmark[#1]{beach}}
+\providecommand\seahex[1][scale=.2]{\tikz[#1]{\hex[label=,fill=sea]}}
+\providecommand\riverhex[1][scale=.2]{%
+ \tikz[#1]{%
+ \hex[label=](c=0,r=0)%
+ \river[](hex cs:e=SW)--(hex cs:e=NE);}}
+\providecommand\roadhex[1][scale=.2]{%
+ \tikz[#1]{%
+ \hex[label=](c=0,r=0)%
+ \road(hex cs:e=SW)--(hex cs:e=NE);}}
+% \end{macrocode}
+%
+% \iffalse
+%</hex>
+% --------------------------------------------------------------------
+% \fi