| 1 |
% \iffalse |
| 2 |
% <*chit> |
| 3 |
% -------------------------------------------------------------------- |
| 4 |
% \fi |
| 5 |
% \subsubsection{Some utilities} |
| 6 |
% |
| 7 |
% This style allows us to add a fading drop-shadow to chits. |
| 8 |
% |
| 9 |
% \begin{macrocode} |
| 10 |
\usetikzlibrary{shadows.blur} |
| 11 |
\newif\ifwg@chit@drop\wg@chit@dropfalse |
| 12 |
\tikzset{ |
| 13 |
chit has drop/.is if=wg@chit@drop, |
| 14 |
chit has drop/.default=true, |
| 15 |
chit has drop/.initial=false, |
| 16 |
/tikz/render blur shadow/.add code={% |
| 17 |
\chit@dbg{2}{Number of blur steps: \pgfbs@steps}% |
| 18 |
\ifnum\pgfbs@steps=0\else |
| 19 |
\chit@dbg{2}{Making shadow blur}% |
| 20 |
}{\fi}} |
| 21 |
\tikzset{% |
| 22 |
chit drop/.code={% |
| 23 |
%% \message{^^J Args `#1'}% |
| 24 |
\pgfkeysalso{% |
| 25 |
chit has drop=true, |
| 26 |
/tikz/blur shadow={shadow blur steps=5, |
| 27 |
shadow opacity=30, |
| 28 |
shadow xshift=.05cm, |
| 29 |
shadow yshift=-.05cm, |
| 30 |
shadow blur radius=.05cm, |
| 31 |
#1}}% |
| 32 |
\ifnum\pgfbs@steps=0% |
| 33 |
\gdef\wg@drop@margin{0pt}% |
| 34 |
\else% |
| 35 |
\ifwg@chit@drop% |
| 36 |
\pgfmathparse{ |
| 37 |
\pgfbs@radius+ |
| 38 |
veclen( |
| 39 |
\pgfkeysvalueof{/tikz/shadow xshift}, |
| 40 |
\pgfkeysvalueof{/tikz/shadow yshift})} |
| 41 |
\xdef\wg@drop@margin{\pgfmathresult pt}% |
| 42 |
\else% |
| 43 |
\gdef\wg@drop@margin{0pt}% |
| 44 |
\fi |
| 45 |
%% \message{^^J Drop margin is `\wg@drop@margin' |
| 46 |
%% `\pgfbs@radius' |
| 47 |
%% `\pgfkeysvalueof{/tikz/shadow xshift}', |
| 48 |
%% `\pgfkeysvalueof{/tikz/shadow yshift}'}% |
| 49 |
\fi% |
| 50 |
},% |
| 51 |
chit drop/.default=,% |
| 52 |
no chit drop/.code={% |
| 53 |
\pgfkeysalso{ |
| 54 |
/tikz/blur shadow={shadow blur steps=0}} |
| 55 |
\gdef\wg@drop@margin{0pt}% |
| 56 |
} |
| 57 |
}% |
| 58 |
% \end{macrocode} |
| 59 |
% |
| 60 |
% Game turn marker |
| 61 |
% |
| 62 |
% \begin{macrocode} |
| 63 |
\tikzset{ |
| 64 |
chit/text base/.style={ |
| 65 |
shape=rectangle, |
| 66 |
inner sep=0pt, |
| 67 |
align=center, |
| 68 |
text width=1.1cm}, |
| 69 |
chit/number/.style={ |
| 70 |
chit/text base, |
| 71 |
font=\sffamily\bfseries\fontsize{12}{14}\selectfont}, |
| 72 |
chit/game turn/.style={ |
| 73 |
chit/text base, |
| 74 |
font=\sffamily\bfseries}, |
| 75 |
chit/text/.style={ |
| 76 |
chit/text base, |
| 77 |
font=\sffamily\bfseries}, |
| 78 |
chit/small text/.style={ |
| 79 |
chit/text base, |
| 80 |
font=\sffamily\bfseries\fontsize{9}{10}\selectfont}, |
| 81 |
chit/number/.pic={\node[chit/number]{#1};}, |
| 82 |
chit/game turn/.pic={\node[chit/game turn]{Game\\Turn};}, |
| 83 |
chit/text/.pic={\node[chit/text]{#1};}, |
| 84 |
chit/small text/.pic={\node[chit/small text]{#1};}, |
| 85 |
game turn chit/.style={ |
| 86 |
/chit/full={chit/game turn}, |
| 87 |
color=black, |
| 88 |
fill=white}, |
| 89 |
game turn chit flipped/.style={game turn chit}, |
| 90 |
dummy chit/.style={fill=white}, |
| 91 |
} |
| 92 |
% \end{macrocode} |
| 93 |
% |
| 94 |
% Marks of chits |
| 95 |
% |
| 96 |
% \begin{macrocode} |
| 97 |
\providecommand\chitmark[2][]{\tikz[scale=.25,#1]{\chit[#2]}} |
| 98 |
% \end{macrocode} |
| 99 |
% |
| 100 |
% Stacking mark |
| 101 |
% |
| 102 |
% \begin{macrocode} |
| 103 |
\tikzset{ |
| 104 |
wg stacking/.style={fill=white, |
| 105 |
/chit/symbol={[faction=friendly,command=land]}}, |
| 106 |
} |
| 107 |
\DeclareRobustCommand\stackmark[1][]{% |
| 108 |
\tikz[baseline=(current bounding box.center),scale=.3,#1]{ |
| 109 |
\stackchits(0,0)(.3,-.3){% |
| 110 |
\noexpand\chit[wg stacking], |
| 111 |
\noexpand\chit[wg stacking], |
| 112 |
\noexpand\chit[wg stacking]}}} |
| 113 |
% \end{macrocode} |
| 114 |
% |
| 115 |
% ZOC mark |
| 116 |
% |
| 117 |
% \begin{macrocode} |
| 118 |
\DeclareRobustCommand\zocmark[1][]{% |
| 119 |
\tikz[baseline=($(current bounding box.center)!.5!(current bounding box.south)$),scale=.1,#1]{% |
| 120 |
\begin{scope}[hex/first row and column are=0, |
| 121 |
hex/row direction is=normal, |
| 122 |
hex/column direction is=normal, |
| 123 |
hex/short columns=none] |
| 124 |
\hex[label=,fill=gray](c=1,r=1)% |
| 125 |
\hex[label=,fill=white](c=1,r=2)% |
| 126 |
\hex[label=,fill=white](c=1,r=0)% |
| 127 |
\hex[label=,fill=white](c=0,r=0)% |
| 128 |
\hex[label=,fill=white](c=0,r=1)% |
| 129 |
\hex[label=,fill=white](c=2,r=1)% |
| 130 |
\hex[label=,fill=white](c=2,r=0) |
| 131 |
\end{scope}}} |
| 132 |
% \end{macrocode} |
| 133 |
% |
| 134 |
% Dummy implementations of zones hooks when exporting. Here, these do |
| 135 |
% nothing, but in the \textsf{wgexport} class these are |
| 136 |
% re-implemented. |
| 137 |
% |
| 138 |
% \begin{macrocode} |
| 139 |
\tikzset{ |
| 140 |
zone point/.code n args={3}{}, |
| 141 |
zone oob point/.code n args={3}{}} |
| 142 |
% \end{macrocode} |
| 143 |
% |
| 144 |
% \iffalse |
| 145 |
% </chit> |
| 146 |
% \fi |