(in c++ )
Here, I made a simple console brick maker (I know how to make graphic programs of course, but why bother with a gui if you're just entering text) that can make simple, non-special bricks:
#include <iostream>
#include <fstream>
#include <zip.cpp>
#include <zip.h>
using namespace std;
string fnam = "";
string dim = "";
string ndim = "";
int szipadd(HZIP hz,string in)
{
return ZipAdd(hz,in.c_str(),in.c_str());
}
string cget()
{
string tmp = "";
cin>>tmp;
return tmp;
}
string ask(string question)
{
cout<<question<<"\n";
return cget();
}
int main()
{
cout<<"Syerjchep Blockland Brick Creator\n";
cout<<"Version 1\n\n\n";
cout<<"Would you like to make a normal, no print, no texture, not round, brick?\n";
string in = cget();
if(in == "yes" || in == "y")
{
cout<<"You choose yes.\n";
while(true)
{
string l = ask("What do you want the length of the brick to be:");
string w = ask("What do you want the width of the brick to be:");
string h = ask("What do you want the height of the brick to be:");
dim = l+" "+w+" "+h;
ndim = l+"x"+w+"x"+h;
cout<<"The dimensions of this brick will be:\n";
cout<<dim<<"\n";
string t = ask("Is this okay?");
if(t == "y" || t == "yes")
{
cout<<"You entered yes, continuing.\n";
break;
}
else cout<<"You entred no, choose again...\n";
}
ofstream disc("description.txt");
disc<<"A normal brick with the deminsions: "<<dim<<"\n";
disc<<"Author: Drendran, Syerjchep\n";
disc.close();
ofstream blb((ndim+"brick.blb").c_str());
blb<<dim<<"\n";
blb<<"BRICK\n";
blb.close();
ofstream scs("server.cs");
scs<<"datablock fxDTSBrickData (brick"+ndim+"BrickData)\n";
scs<<"{\n";
scs<<"brickFile = \"./"+ndim+"brick.blb\";\n";
scs<<"category = \"Bricks\";\n";
scs<<"uiName = \""+ndim+" Brick\";\n";
scs<<"subCategory = \"Custom Bricks\"\n";
scs<<"};\n";
scs.close();
HZIP hz = CreateZip(("Brick_"+ndim+".zip").c_str(),0);
szipadd(hz,"description.txt");
szipadd(hz,(ndim+"brick.blb").c_str());
szipadd(hz,"server.cs");
CloseZip(hz);
remove("server.cs");
remove("description.txt");
remove((ndim+"brick.blb").c_str());
}
else cout<<"You choose no: This program does not yet support special bricks.\n";
cout<<"Input anything to exit.\n";
cget();
return 0;
}