diff options
Diffstat (limited to 'macros/latex/contrib/wargame/doc/tutorial/export.tex')
-rw-r--r-- | macros/latex/contrib/wargame/doc/tutorial/export.tex | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/macros/latex/contrib/wargame/doc/tutorial/export.tex b/macros/latex/contrib/wargame/doc/tutorial/export.tex index adbb65ba6e..d51ecf0e5c 100644 --- a/macros/latex/contrib/wargame/doc/tutorial/export.tex +++ b/macros/latex/contrib/wargame/doc/tutorial/export.tex @@ -15,7 +15,7 @@ % % The trick is to prepare a separate \LaTeX{} document, say % \texttt{export.tex} as in this tutorial, which exports the images as -% single pages. Then, the Python script \texttt{export.py} +% single pages. Then, the Python script \texttt{wgexport.py} % distributed with the \textsf{wargame} package picks up this output % (\texttt{export.pdf} and \texttt{export.json}) and generates a draft % VASSAL module. @@ -202,14 +202,16 @@ % \end{macrocode} % % This looks like -% \tikz{\draw[fill=friendly] (.1,0) rectangle(.5,-.1); -% \draw[fill=friendly] (.1,-.15) rectangle(.3,-.25); -% \draw[fill=friendly] (.1,-.3) rectangle(.2,-.4); -% \draw[fill=hostile] (-.1,0) rectangle(-.3,-.25);} -% -% Normally the \texttt{export.py} script used the \emph{undo} image +% \tikz{ +% \draw[fill=friendly] (.1,0) rectangle(.5,-.1); +% \draw[fill=friendly] (.1,-.15) rectangle(.3,-.25); +% \draw[fill=friendly] (.1,-.3) rectangle(.2,-.4); +% \draw[fill=hostile] (-.1,0) rectangle(-.3,-.25);} +% +% Normally the \texttt{wgexport.py} script used the \emph{undo} mage % for the flip button. However, that may be a bit confusing, so we -% will use a large ``F'' instead. \tikz{\node[color=blue!75!black,font=\sffamily\bfseries\LARGE]{F}} +% will use a large ``F'' +% instead. \tikz{\node[color=blue!75!black,font=\sffamily\bfseries\LARGE]{F}} % % And similarly for the ``Eliminate''\tikz{\node[color=red!75!black,font=\sffamily\bfseries\LARGE]{E}} % @@ -245,11 +247,11 @@ % We run \LaTeX{} on the above \texttt{export.tex} file (the source of % this section) to generate \texttt{export.pdf} and % \texttt{export.json}. We then process these with the -% \texttt{export.py} Python script to get the draft VASSAL module +% \texttt{wgexport.py} Python script to get the draft VASSAL module % \texttt{Draft.vmod}. % % \begin{verbatim} -% `kpsewhich export.py` export.pdf export.json +% `kpsewhich wgexport.py` export.pdf export.json % \end{verbatim} % % The utility \texttt{kpsewhich}\footnotemark{\TeX{}Live and similar @@ -273,7 +275,7 @@ % \texttt{game.pdf}, then we can do % % \begin{verbatim} -% `kpsewhich export.py` export.pdf export.json \ +% `kpsewhich wgexport.py` export.pdf export.json \ % -r game.pdf -o Game.vmod % \end{verbatim} % @@ -298,7 +300,7 @@ % complete module, we would do something like % % \begin{verbatim} -% `kpsewhich export.py` export.pdf export.json \ +% `kpsewhich wgexport.py` export.pdf export.json \ % -r game.pdf -o Game.vmod \ % -t "LaTeX Wargame tutorial" \ % -d "Example of using wargame to make a module" \ @@ -313,7 +315,7 @@ % % We will take one more step on the VASSAL module, and then we will % get back to the Print'n'Play version of the game. We can provide -% the \texttt{export.py} script with an additional Python script that +% the \texttt{wgexport.py} script with an additional Python script that % can tweak the VASSAL module any way we like. We can for example % move counters into their starting positions, to the OOB, adjust % grids, add more materials, and so on. It is only your imagination, @@ -322,7 +324,7 @@ % % Here we will make a simple \texttt{patch.py} Python script which % does very little. The \textsf{wargame} package, -% \textsf{wgexport} class, and \texttt{export.py} script has already +% \textsf{wgexport} class, and \texttt{wgexport.py} script has already % done the heavy work for us. Not least be because we have taken care % to add in \texttt{zone} styles where needed. % @@ -332,7 +334,7 @@ % do much. % % \begin{verbatim} -% `kpsewhich export.py` export.pdf export.json \ +% `kpsewhich wgexport.py` export.pdf export.json \ % -r game.pdf -o Game.vmod % -t "LaTeX Wargame tutorial" \ % -d "Example of using wargame to make a module" \ @@ -344,37 +346,34 @@ % \begin{verbatim} % def patch(build,data,vmod,verbose=False): % # We need to import the export module :-) -% import export +% import wgexport as wg % % # Get the game and last free GPID -% game = export.get_game(build) +% game = wg.get_game(build) % gpid = int(game.getAttribute('nextPieceSlotId')) % % # Get all boards -% maps = export.get_maps(build) +% maps = wg.get_maps(build) % board = maps['Board'] % -% mkeys = export.get_masskey(board,'name') -% export.set_node_attr(mkeys['Eliminate'], -% icon='eliminate-icon.png') -% export.set_node_attr(mkeys['Flip'], -% icon='flip-icon.png') +% mkeys = wg.get_masskey(board,'name') +% wg.set_node_attr(mkeys['Eliminate'],icon='eliminate-icon.png') +% wg.set_node_attr(mkeys['Flip'],icon='flip-icon.png') % % # Get main map % pool = maps['DeadMap'] -% export.set_node_attr(pool,icon='pool-icon.png') +% wg.set_node_attr(pool,icon='pool-icon.png') % -% mkeys = export.get_masskey(pool,'name') -% export.set_node_attr(mkeys['Restore'], -% icon='restore-icon.png') +% mkeys = wg.get_masskey(pool,'name') +% wg.set_node_attr(mkeys['Restore'],icon='restore-icon.png') % % # Get the OOB map -% oob = export.get_chartwindows(game)['OOBs'] -% export.set_node_attr(oob,icon='oob-icon.png') +% oob = wg.get_chartwindows(game)['OOBs'] +% wg.set_node_attr(oob,icon='oob-icon.png') % \end{verbatim} % % In the \texttt{patch.py} script we can use all the functionality -% provided by \texttt{export.py}. Elements are XML elements that we +% provided by \texttt{wgexport.py}. Elements are XML elements that we % apply \texttt{xml.dom.minidom} operations on. % % \iffalse |