summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/chit/modifiers.dtx
blob: b42ee5790f5c4cb363ef04f0a8eb17fe77b39cb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% \iffalse
% --------------------------------------------------------------------
% <*chit>
% \fi
% \subsubsection{Modifications to chits}
%
% These defines overlays one can add on top of chits, for example to
% shade a chit, put a semi-transparent red cover to indicate
% elimination, and similar. 
%
%    \begin{macrocode}
\tikzset{
  pics/chit/shade/.style={
    code={%
      \path[fill=white,opacity=#1,pic actions] (-.6,-.6) rectangle(.6,.6);}},
  pics/chit/eliminate/.style={
    code={%
      \path[fill=red,opacity=#1,pic actions] (-.6,-.6) rectangle(.6,.6);}},
  pics/chit/shade/.default=0.5,
  pics/chit/eliminate/.default=0.25,
  dummy chit/.style={draw=none,fill=none,chit={}},
}
\def\shadechit{%
  \@ifnextchar[{\sh@dechit}{\sh@dechit[.5]}%]
}
\def\eliminatechit{%
  \@ifnextchar[{\elimin@techit}{\elimin@techit[.25]}%]
}
\def\sh@dechit[#1](#2){%
  % \message{^^JShading chit with opacity `#1'}%
  \pic[transform shape] at (#2) {chit/shade=#1};%
  \@ifnextchar;{\@gobble}{}}
\def\elimin@techit[#1](#2){%
  \pic[transform shape] at (#2) {chit/eliminate=#1};%
  \@ifnextchar;{\@gobble}{}}
%    \end{macrocode}
% 
%
% \iffalse
% --------------------------------------------------------------------
% </chit>
% \fi