summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/puyotikz/puyotikz.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/puyotikz/puyotikz.sty')
-rw-r--r--Master/texmf-dist/tex/latex/puyotikz/puyotikz.sty64
1 files changed, 64 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/puyotikz/puyotikz.sty b/Master/texmf-dist/tex/latex/puyotikz/puyotikz.sty
new file mode 100644
index 00000000000..4a5c4dd2005
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/puyotikz/puyotikz.sty
@@ -0,0 +1,64 @@
+% PuyoTikZ package for LaTeX.
+% Created by amosborne (GitHub) / terramyst (Twitter).
+% MIT License
+
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesPackage{puyotikz}[2020/12/23 v1.0.0 PuyoTikZ]
+
+\RequirePackage{pythontex}
+\RequirePackage{tikz}
+\RequirePackage{keyval}
+
+\pyc{import puyotikz as puyo}
+
+\def\puyosmallscale{0.34}
+\def\puyobigscale{0.65}
+
+\newenvironment{puyotikz}[1][\puyobigscale]
+ {\begin{tikzpicture}[scale=#1, every node/.style={transform shape}]}
+ {\end{tikzpicture}}
+
+\define@key{puyoboard}{ncols}{\def\puyo@ncols{#1}}
+\define@key{puyoboard}{nrows}{\def\puyo@nrows{#1}}
+\define@key{puyoboard}{nhidrows}{\def\puyo@nhidrows{#1}}
+\define@key{puyoboard}{showlabels}{\def\puyo@showlabels{#1}}
+\setkeys{puyoboard}{ncols=6, nrows=12, nhidrows=1, showlabels=True}
+
+\setpythontexcontext{
+ ncols=\puyo@ncols,
+ nrows=\puyo@nrows,
+ nhidrows=\puyo@nhidrows,
+ showlabels=\puyo@showlabels
+}
+
+\newcommand{\puyoboard}[3][]{
+ \setkeys{puyoboard}{#1}
+ \pyc{puyo.puyoboard(cols=int(pytex.context.ncols), %
+ rows=int(pytex.context.nrows), %
+ hrows=int(pytex.context.nhidrows), %
+ boardpuyos="#2", %
+ nextpuyos="#3", %
+ label=pytex.context.showlabels=="True")}
+}
+
+\newcommand{\puyomarker}[1]{\pyc{puyo.puyomarker("#1")}}
+
+\newcommand{\puyogrid}[2][]{
+ \setkeys{puyoboard}{nhidrows=0, showlabels=False}
+ \begin{puyotikz}[\puyosmallscale]
+ \puyoboard[#1]{#2}{}
+ \end{puyotikz}
+}
+
+\newcommand{\puyocolor}[2]{
+ \definecolor{#1puyo}{RGB}{#2}
+ \colorlet{dark#1puyo}{#1puyo!80!black}
+}
+\puyocolor{red}{255,82,98}
+\puyocolor{green}{82,213,98}
+\puyocolor{blue}{32,115,213}
+\puyocolor{yellow}{255,220,24}
+\puyocolor{purple}{131,90,213}
+\puyocolor{gray}{180,172,189}
+
+\endinput