commit 257ae3e0d8a8a0ad6db2cddb1963259667c5b493 Author: Matuush Date: Tue Jun 13 13:16:32 2023 +0200 git diff --git a/Bez_nadeje.png b/Bez_nadeje.png new file mode 100644 index 0000000..799b6fa Binary files /dev/null and b/Bez_nadeje.png differ diff --git a/cards/factions.json b/cards/factions.json new file mode 100644 index 0000000..89c9b94 --- /dev/null +++ b/cards/factions.json @@ -0,0 +1,7 @@ +[ + "universal", + "northern-kingdoms", + "monsters", + "nilfgaard", + "scoiatael" +] diff --git a/cards/images/factions/universal.png b/cards/images/factions/universal.png new file mode 100644 index 0000000..799b6fa Binary files /dev/null and b/cards/images/factions/universal.png differ diff --git a/cards/images/lines/front.png b/cards/images/lines/front.png new file mode 100644 index 0000000..799b6fa Binary files /dev/null and b/cards/images/lines/front.png differ diff --git a/cards/images/traits/double.png b/cards/images/traits/double.png new file mode 100644 index 0000000..799b6fa Binary files /dev/null and b/cards/images/traits/double.png differ diff --git a/cards/images/traits/spy.png b/cards/images/traits/spy.png new file mode 100644 index 0000000..799b6fa Binary files /dev/null and b/cards/images/traits/spy.png differ diff --git a/cards/lines.json b/cards/lines.json new file mode 100644 index 0000000..42fdebf --- /dev/null +++ b/cards/lines.json @@ -0,0 +1,5 @@ +[ + "front", + "middle", + "back" +] diff --git a/cards/northern-kingdoms/brambor.json b/cards/northern-kingdoms/brambor.json new file mode 100644 index 0000000..437fdc9 --- /dev/null +++ b/cards/northern-kingdoms/brambor.json @@ -0,0 +1,12 @@ +{ + "display": "oligarchie", + "faction": "northern-kingdoms", + "line": "front", + "name": "brambor", + "power": 1, + "traits": [ + "spy", + "double", + "call-to-arms" + ] +} diff --git a/cards/template.json b/cards/template.json new file mode 100644 index 0000000..a59d053 --- /dev/null +++ b/cards/template.json @@ -0,0 +1,10 @@ +{ + "name": "card", + "display": "The Name", + "faction": "My Ass", + "line": "balls", + "power": 0, + "traits": [ + + ] +} diff --git a/cards/traits.json b/cards/traits.json new file mode 100644 index 0000000..0ccd866 --- /dev/null +++ b/cards/traits.json @@ -0,0 +1,9 @@ +[ + "spy", + "double", + "boost", + "call-to-arms", + "horn", + "revive", + "destroy" +] diff --git a/cards/universal/images/test.png b/cards/universal/images/test.png new file mode 100644 index 0000000..c5946fe Binary files /dev/null and b/cards/universal/images/test.png differ diff --git a/cards/universal/test.json b/cards/universal/test.json new file mode 100644 index 0000000..feed130 --- /dev/null +++ b/cards/universal/test.json @@ -0,0 +1,11 @@ +{ + "display": "Tester", + "faction": "universal", + "line": "front", + "name": "test", + "power": 0, + "traits": [ + "spy", + "double" + ] +} diff --git a/cards/universal/test.png b/cards/universal/test.png new file mode 100644 index 0000000..799b6fa Binary files /dev/null and b/cards/universal/test.png differ diff --git a/folders.cpp b/folders.cpp new file mode 100644 index 0000000..dac83c8 --- /dev/null +++ b/folders.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include +#include + +using nlohmann::json; +using std::string; + +int main() { + std::ifstream f1("cards/template.json"); + json data = json::parse(f1); + + std::ifstream f2("cards/traits.json"); + json traits = json::parse(f2); + + + std::ifstream f3("cards/factions.json"); + json factions = json::parse(f3); + + std::ifstream f4("cards/lines.json"); + json lines = json::parse(f4); + + for(auto f : factions) { + string command = "mkdir cards/" + string(f) + "/images"; + std::system(command.c_str()); + } + + //std::ofstream out("cards/"+factions[faction]+"/"+name+".json"); + return 0; +} diff --git a/generate b/generate new file mode 100755 index 0000000..4b84457 Binary files /dev/null and b/generate differ diff --git a/generate.cpp b/generate.cpp new file mode 100644 index 0000000..16ecfca --- /dev/null +++ b/generate.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include + +using nlohmann::json; +using std::string; + +int main() { + std::ifstream f1("cards/template.json"); + json data = json::parse(f1); + + std::ifstream f2("cards/traits.json"); + json traits = json::parse(f2); + + + std::ifstream f3("cards/factions.json"); + json factions = json::parse(f3); + + std::ifstream f4("cards/lines.json"); + json lines = json::parse(f4); + + std::cout << "Name: "; + string name; std::cin >> name; data["name"] = name; + + std::cout << "Display name: "; + std::cin.ignore(); + string display; std::getline(std::cin, display); data["display"] = display; + + std::cout << "Faction (0:Universal,1:SK,2:M,3:N,4:S): "; + int faction; std::cin >> faction; data["faction"] = factions[faction]; + + std::cout << "Line (0:front, 1:middle, 2:back): "; + int line; std::cin >> line; data["line"] = lines[line]; + + std::cout << "Power: "; + int power; std::cin >> power; data["power"] = power; + + std::cout << "Traits (0:End,1:Spy,2:Double,3:Boost,4:Call-to-arms,5:Horn,6:Revive,7:Destroy): "; + int trait = -1; + while(trait != 0) { + if(trait != -1) data["traits"].push_back(traits[trait-1]); + std::cin >> trait; + } + + std::ofstream out("cards/"+string(factions[faction])+"/"+name+".json"); + + out << data.dump(2) << std::endl; + return 0; +} diff --git a/icom b/icom new file mode 100755 index 0000000..f7c75f3 --- /dev/null +++ b/icom @@ -0,0 +1 @@ +g++ image.cpp -o image -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs diff --git a/image b/image new file mode 100755 index 0000000..5d076fc Binary files /dev/null and b/image differ diff --git a/image.cpp b/image.cpp new file mode 100644 index 0000000..3bcb278 --- /dev/null +++ b/image.cpp @@ -0,0 +1,91 @@ +#include +#include +#include + +#include + +#include +#include +#include + +using namespace cv; +using nlohmann::json; +using std::string; + +#define H 800 +#define W 300 +#define M 30 +#define R 60 + +Mat source_image = Mat::zeros(Size(H,W),CV_8UC1); +void render(int i, int j, int y_s, int x_s, Mat *img) { + if(i >= y_s && i <= y_s+R-1 && j >= x_s && j <= x_s+R-1) { + source_image.at(i,j)=img->at(i-y_s,j-x_s); + } +} + +int main(int argc, char** argv) { + + // FACTION + int fac; + if(argc <= 1) { + std::cout << "0:U,1:SK,2:M,3:N,4:S"; + std::cin >> fac; + } + else fac = std::atoi(argv[1]); + + std::ifstream ff("cards/factions.json"); + json factions = json::parse(ff); + string faction = factions[fac]; + + // NAME + string name; + if(argc <= 2) std::cin >> name; + else name = argv[2]; + std::ifstream f("cards/"+faction+"/"+name+".json"); + json data = json::parse(f); + + // LOAD IMAGES + Mat i_look = imread("cards/"+faction+"/images/"+name+".png",IMREAD_GRAYSCALE); + Mat i_faction = imread("cards/images/factions/"+faction+".png",IMREAD_GRAYSCALE); + Mat i_line = imread("cards/images/lines/"+string(data["line"])+".png",IMREAD_GRAYSCALE); + + // RENDER IMAGES + std::vector i_traits; + for(auto trait : data["traits"]) { + i_traits.push_back(imread("cards/images/traits/"+string(trait)+".png",IMREAD_GRAYSCALE)); + } + + for(int i=0;i(i,j)=i_look.at(i,j); + + // RENDER POWER AND TRAITS + string bruh = std::to_string((int)data["power"]); + for(int i=0;i