card game

This commit is contained in:
2026-05-31 14:39:45 -05:00
parent 5cc62433bd
commit 6abe253547
18 changed files with 2713 additions and 20 deletions

View File

@@ -0,0 +1,41 @@
const fs = require('fs');
const path = require('path');
const { buildCardSVG, SUITS } = require('./trox_card');
/* ============================================================
TROX Kartenvorderseiten Generator
node generate_cards.js tgc | original | both
Nutzt das gemeinsame Modul trox_card.js (eine Quelle fürs Design).
Codes: R=Red(Trumpf), Y=Yellow, G=Green, S=Black.
============================================================ */
const MODE = (process.argv[2] || 'both').toLowerCase();
const SPECS = {
tgc: { width: 825, height: 1125, safe: 75, cornerRadius: 0, dir: 'karten_export_tgc' },
original: { width: 694, height: 1069, safe: 35, cornerRadius: 35, dir: 'karten_export_original' },
};
function generate(variant) {
const spec = SPECS[variant];
const outputDir = path.join(__dirname, spec.dir);
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
let count = 0;
for (const colorName of Object.keys(SUITS)) {
for (let num = 1; num <= 20; num++) {
const svg = buildCardSVG(colorName, num, {
width: spec.width, height: spec.height, safe: spec.safe, cornerRadius: spec.cornerRadius,
});
const fileName = `${colorName}_${String(num).padStart(2, '0')}.svg`;
fs.writeFileSync(path.join(outputDir, fileName), svg);
count++;
}
}
console.log(` [${variant}] ${count} Karten -> ${spec.dir}/ (${spec.width}x${spec.height})`);
}
console.log('TROX Karten werden generiert ...');
if (MODE === 'tgc' || MODE === 'both') generate('tgc');
if (MODE === 'original' || MODE === 'both') generate('original');
console.log('Fertig.');