summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty')
-rw-r--r--Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty110
1 files changed, 71 insertions, 39 deletions
diff --git a/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty b/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
index 711b0e919ae..aacfcb12414 100644
--- a/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
+++ b/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
@@ -2,7 +2,8 @@
% licence........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{PixelArtTikz}[2024/04/16 v0.1.4 PixelArts with csv and TikZ]
+\ProvidesPackage{PixelArtTikz}[2024/10/31 v0.1.5 PixelArts with csv and TikZ]
+% 0.1.5 Amélioration du code interne + possibilité de créer des grilles avec des symboles choisis dans une liste
% 0.1.4 Cylinder anamorphic pixelart
% 0.1.3 Split PA into grid
% 0.1.2 Mini pixerlart
@@ -23,6 +24,7 @@
\RequirePackage{xstring}
\RequirePackage{multicol}
\RequirePackage{listofitems}
+\RequirePackage{ifthen}
%librairies tikz
%\usetikzlibrary{calc,shapes.geometric}
%cvs
@@ -33,6 +35,19 @@
\RequirePackage[l3]{csvsimple}
\fi
+\NewDocumentCommand\TraiteListeSymbPixelArt{ m }{%
+ \IfSubStr{#1}{§}%
+ {%
+ \setsepchar{§}%
+ \readlist*\lstPAchoices{#1}%
+ \xdef\lstPAchoicesrand{\fpeval{randint(1,\lstPAchoiceslen)}}%
+ \lstPAchoices[\lstPAchoicesrand]%
+ }%
+ {%c'est normal
+ #1%
+ }%
+}
+
%------clés [fr] / keys [en]
\defKV[pixelarttkz]{%
Codes=\def\PATlettres{#1},%
@@ -60,36 +75,43 @@
\IfBooleanTF{#1}{}{\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#3]}
\ifboolKV[pixelarttkz]{Correction}%
{%
+ \readlist*\LCPA\PATcouleurs%
\csvloop{file=#4,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCPA\PATcouleurs%
+ %\setsepchar{,}%
+ %\readlist*\LCPA\PATcouleurs%
\StrPosition{\PATlettres}{\l}[\pixcnt]%
- \xintifboolexpr{\pixcnt>0}%
- {%
- \itemtomacro\LCPA[\pixcnt]\pixcol%
- \ifboolKV[pixelarttkz]{BordCases}%
- {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
- {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
- }%
- {}%
+ \ifnum\pixcnt>0%
+ \ifboolKV[pixelarttkz]{BordCases}%
+ {\draw[fill={\LCPA[\pixcnt]}] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
+ {\filldraw[{\LCPA[\pixcnt]}] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
+ \fi%
+ %\xintifboolexpr{\pixcnt>0}%
+ % {%
+ % %\itemtomacro\LCPA[\pixcnt]\pixcol%
+ % \ifboolKV[pixelarttkz]{BordCases}%
+ % {\draw[fill={\LCPA[\pixcnt]}] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
+ % {\filldraw[{\LCPA[\pixcnt]}] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
+ % }%
+ % {}%
}%
}%
}%
}%
{%
\ifboolKV[pixelarttkz]{Symb}{%affichage du pixelart versions chiffres si besoin
+ \readlist*\LCNA\PATchiffres%
\csvloop{file=#4,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCNA\PATchiffres%
+ %\setsepchar{,}%
+ %\readlist*\LCNA\PATchiffres%
\StrPosition{\PATlettres}{\l}[\pixpos]%
\xintifboolexpr{\pixpos>0}%
{%
\itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
+ \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{}%
}%
@@ -145,11 +167,12 @@
\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
\ifboolKV[pixelarttkz]{Correction}%
{%
+ \readlist*\LCPA\PATcouleurs%
\csvloop{file=#3,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCPA\PATcouleursù
+ %\setsepchar{,}%
+ %\readlist*\LCPA\PATcouleurs%
\StrPosition{\PATlettres}{\l}[\pixcnt]%
\xintifboolexpr{\pixcnt>0}%
{%
@@ -165,16 +188,17 @@
}%
{%
\ifboolKV[pixelarttkz]{Symb}{%affichage du pixelart versions chiffres si besoin
+ \readlist*\LCNA\PATchiffres%
\csvloop{file=#3,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCNA\PATchiffres%
+ %\setsepchar{,}%
+ %\readlist*\LCNA\PATchiffres%
\StrPosition{\PATlettres}{\l}[\pixpos]%
\xintifboolexpr{\pixpos>0}%
{%
\itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
+ \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{}%
}%
@@ -226,11 +250,12 @@
\IfBooleanTF{#1}{}{\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#3]}
\ifboolKV[pixelarttkzen]{Correction}%
{%
+ \readlist*\LCPA\PATcouleurs%
\csvloop{file=#4,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCPA\PATcouleurs%
+ %\setsepchar{,}%
+ %\readlist*\LCPA\PATcouleurs%
\StrPosition{\PATlettres}{\l}[\pixcnt]%
\xintifboolexpr{\pixcnt>0}%
{%
@@ -246,16 +271,17 @@
}%
{%
\ifboolKV[pixelarttkzen]{Symb}{%affichage du pixelart versions chiffres si besoin
+ \readlist*\LCNA\PATchiffres%
\csvloop{file=#4,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCNA\PATchiffres%
+ %\setsepchar{,}%
+ %\readlist*\LCNA\PATchiffres%
\StrPosition{\PATlettres}{\l}[\pixpos]%
\xintifboolexpr{\pixpos>0}%
{%
\itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
+ \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{}%
}%
@@ -311,11 +337,12 @@
\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
\ifboolKV[pixelarttkzen]{Correction}%
{%
+ \readlist*\LCPA\PATcouleurs%
\csvloop{file=#3,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCPA\PATcouleurs%
+ %\setsepchar{,}%
+ %\readlist*\LCPA\PATcouleurs%
\StrPosition{\PATlettres}{\l}[\pixcnt]%
\xintifboolexpr{\pixcnt>0}%
{%
@@ -331,16 +358,17 @@
}%
{%
\ifboolKV[pixelarttkzen]{Symb}{%affichage du pixelart versions chiffres si besoin
+ \readlist*\LCNA\PATchiffres%
\csvloop{file=#3,no head,command={%
\foreach \l [count=\n] in \csvline {%
\StrDel{\l}{ }[\l]%
- \setsepchar{,}%
- \readlist*\LCNA\PATchiffres%
+ %\setsepchar{,}%
+ %\readlist*\LCNA\PATchiffres%
\StrPosition{\PATlettres}{\l}[\pixpos]%
\xintifboolexpr{\pixpos>0}%
{%
\itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
+ \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{}%
}%
@@ -476,13 +504,14 @@
\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
\ifboolKV[pixelarttkz]{Correction}%
{%
+ \readlist*\LCPA\PATcouleurs%
\csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
\foreach \l [count=\n] in \csvline {%
\xintifboolexpr{ \n >= (\NbColBloc*(\NumBlocCol-1)+1) 'and' \n <= (\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}%
{%
\StrDel{\l}{ }[\l]%
\setsepchar{,}%
- \readlist*\LCPA\PATcouleurs%
+ %\readlist*\LCPA\PATcouleurs%
\StrPosition{\PATlettres}{\l}[\pixcnt]%
\xintifboolexpr{\pixcnt>0}%
{%
@@ -500,18 +529,19 @@
}%
{%
\ifboolKV[pixelarttkz]{Symb}{%affichage du pixelart versions chiffres si besoin
+ \readlist*\LCNA\PATchiffres%
\csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
\foreach \l [count=\n] in \csvline {%
\xintifboolexpr{ \n >= (\NbColBloc*(\NumBlocCol-1)+1) 'and' \n <= (\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}%
{%
\StrDel{\l}{ }[\l]%
\setsepchar{,}%
- \readlist*\LCNA\PATchiffres%
+ %\readlist*\LCNA\PATchiffres%
\StrPosition{\PATlettres}{\l}[\pixpos]%
\xintifboolexpr{\pixpos>0}%
{%
\itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
+ \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{}%
}%
@@ -629,13 +659,14 @@
\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
\ifboolKV[pixelarttkzen]{Correction}%
{%
+ \readlist*\LCPA\PATcouleurs%
\csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
\foreach \l [count=\n] in \csvline {%
\xintifboolexpr{ \n >= (\NbColBloc*(\NumBlocCol-1)+1) 'and' \n <= (\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}%
{%
\StrDel{\l}{ }[\l]%
\setsepchar{,}%
- \readlist*\LCPA\PATcouleurs%
+ %\readlist*\LCPA\PATcouleurs%
\StrPosition{\PATlettres}{\l}[\pixcnt]%
\xintifboolexpr{\pixcnt>0}%
{%
@@ -653,18 +684,19 @@
}%
{%
\ifboolKV[pixelarttkzen]{Symb}{%affichage du pixelart versions chiffres si besoin
+ \readlist*\LCNA\PATchiffres%
\csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
\foreach \l [count=\n] in \csvline {%
\xintifboolexpr{ \n >= (\NbColBloc*(\NumBlocCol-1)+1) 'and' \n <= (\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}%
{%
\StrDel{\l}{ }[\l]%
\setsepchar{,}%
- \readlist*\LCNA\PATchiffres%
+ %\readlist*\LCNA\PATchiffres%
\StrPosition{\PATlettres}{\l}[\pixpos]%
\xintifboolexpr{\pixpos>0}%
{%
\itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
+ \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{}%
}%
@@ -909,10 +941,10 @@
\itemtomacro\LCNA[\pixpos]\pixchf%
\ifboolKV[PixelArtCylinder]{Swap}%
{%
- \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{%
- \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
}%
{%
@@ -1002,10 +1034,10 @@
\itemtomacro\LCNA[\pixpos]\pixchf%
\ifboolKV[PixlArtCylinder]{Swap}%
{%
- \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
{%
- \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
}%
}%
{%