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
43
44
45
46
47
48
49
50
|
#include <Magick++.h>
#include <tclap/CmdLine.h>
#include <iostream>
#include <string>
#include "cardset.h"
#include "imagestore.h"
#include "wizard.h"
int main(int argc, char** argv) {
Magick::InitializeMagick(nullptr);
std::random_device randomDevice;
std::mt19937 rng(5); // randomDevice());
try {
TCLAP::CmdLine cmd("Spelling things with MTG cards", ' ', "1.0");
TCLAP::ValueArg<std::string> cardsPath("c", "cards",
"Path to the card definitions file",
true, "", "filename");
cmd.add(cardsPath);
TCLAP::ValueArg<std::string> cachePath(
"i", "image-cache", "Path to store cached card image downloads", true,
"", "filename");
cmd.add(cachePath);
TCLAP::ValueArg<std::string> outputPath(
"o", "output", "Path to write image output to", true, "", "filename");
cmd.add(outputPath);
TCLAP::ValueArg<std::string> textInput("t", "text", "Text to render", true,
"", "text");
cmd.add(textInput);
cmd.parse(argc, argv);
cardset cards(cardsPath.getValue());
imagestore images(cachePath.getValue());
wizard app(cards, images, textInput.getValue(), rng);
Magick::Image result = app.run();
result.write(outputPath.getValue());
} catch (const TCLAP::ArgException& e) {
std::cerr << "Error: " << e.error() << " for arg " << e.argId()
<< std::endl;
}
}
|