mirror of
https://github.com/glest/glest-source.git
synced 2025-08-24 08:52:49 +02:00
- changed g3dviewer to default to png (not read glest.ini for screenshot format) but alos added a new commandline option to be able to change the default screenshot format from png if desired
This commit is contained in:
@@ -47,6 +47,9 @@ const char *folderDelimiter = "/";
|
|||||||
|
|
||||||
const string g3dviewerVersionString= "v1.3.6";
|
const string g3dviewerVersionString= "v1.3.6";
|
||||||
|
|
||||||
|
// Because g3d should always support alpha transparency
|
||||||
|
string fileFormat = "png";
|
||||||
|
|
||||||
namespace Glest { namespace Game {
|
namespace Glest { namespace Game {
|
||||||
string getGameReadWritePath(string lookupKey) {
|
string getGameReadWritePath(string lookupKey) {
|
||||||
string path = "";
|
string path = "";
|
||||||
@@ -90,6 +93,7 @@ const wxChar *GAME_ARGS[] = {
|
|||||||
wxT("--zoom-value"),
|
wxT("--zoom-value"),
|
||||||
wxT("--rotate-x-value"),
|
wxT("--rotate-x-value"),
|
||||||
wxT("--rotate-y-value"),
|
wxT("--rotate-y-value"),
|
||||||
|
wxT("--screenshot-format"),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GAME_ARG_TYPE {
|
enum GAME_ARG_TYPE {
|
||||||
@@ -105,6 +109,7 @@ enum GAME_ARG_TYPE {
|
|||||||
GAME_ARG_ZOOM_VALUE,
|
GAME_ARG_ZOOM_VALUE,
|
||||||
GAME_ARG_ROTATE_X_VALUE,
|
GAME_ARG_ROTATE_X_VALUE,
|
||||||
GAME_ARG_ROTATE_Y_VALUE,
|
GAME_ARG_ROTATE_Y_VALUE,
|
||||||
|
GAME_ARG_SCREENSHOT_FORMAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool hasCommandArgument(int argc, wxChar** argv,const string argName,
|
bool hasCommandArgument(int argc, wxChar** argv,const string argName,
|
||||||
@@ -191,6 +196,12 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
|||||||
printf("\n \t\tWhere x is a decimal value from -10.0 to 10.0:");
|
printf("\n \t\tWhere x is a decimal value from -10.0 to 10.0:");
|
||||||
printf("\n \t\texample: %s %s=2.2",argv0,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_ROTATE_Y_VALUE]));
|
printf("\n \t\texample: %s %s=2.2",argv0,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_ROTATE_Y_VALUE]));
|
||||||
|
|
||||||
|
printf("\n%s=x\t\tSpecify which image format to use for screenshots.",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_SCREENSHOT_FORMAT]));
|
||||||
|
printf("\n \t\tWhere x is one of the following supported formats");
|
||||||
|
printf("\n \t\tpng,jpg,tga,bmp");
|
||||||
|
printf("\n \t\t*NOTE: png is the default (and supports transparency)");
|
||||||
|
printf("\n \t\texample: %s %s=jpg",argv0,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_SCREENSHOT_FORMAT]));
|
||||||
|
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,6 +868,7 @@ void MainWindow::onMenumFileToggleScreenshotTransparent(wxCommandEvent &event) {
|
|||||||
try {
|
try {
|
||||||
float alpha = (event.IsChecked() == true ? 0.0f : 1.0f);
|
float alpha = (event.IsChecked() == true ? 0.0f : 1.0f);
|
||||||
renderer->setAlphaColor(alpha);
|
renderer->setAlphaColor(alpha);
|
||||||
|
//printf("alpha = %f\n",alpha);
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
@@ -906,9 +918,8 @@ void MainWindow::saveScreenshot() {
|
|||||||
|
|
||||||
string path = screenShotsPath;
|
string path = screenShotsPath;
|
||||||
if(isdir(path.c_str()) == true) {
|
if(isdir(path.c_str()) == true) {
|
||||||
Config &config= Config::getInstance();
|
//Config &config= Config::getInstance();
|
||||||
string fileFormat = config.getString("ScreenShotFileType","jpg");
|
//string fileFormat = config.getString("ScreenShotFileType","jpg");
|
||||||
//string fileFormat = "png";
|
|
||||||
|
|
||||||
for(int i=0; i < 5000; ++i) {
|
for(int i=0; i < 5000; ++i) {
|
||||||
path = screenShotsPath;
|
path = screenShotsPath;
|
||||||
@@ -2233,6 +2244,28 @@ bool App::OnInit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_SCREENSHOT_FORMAT])) == true) {
|
||||||
|
const wxWX2MBbuf param = (const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_SCREENSHOT_FORMAT]);
|
||||||
|
|
||||||
|
int foundParamIndIndex = -1;
|
||||||
|
hasCommandArgument(argc, argv,string((const char*)param) + string("="),&foundParamIndIndex);
|
||||||
|
if(foundParamIndIndex < 0) {
|
||||||
|
hasCommandArgument(argc, argv,(const char*)param,&foundParamIndIndex);
|
||||||
|
}
|
||||||
|
//printf("foundParamIndIndex = %d\n",foundParamIndIndex);
|
||||||
|
string value = (const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]);
|
||||||
|
vector<string> paramPartTokens;
|
||||||
|
Tokenize(value,paramPartTokens,"=");
|
||||||
|
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
||||||
|
fileFormat = paramPartTokens[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("\nInvalid value specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||||
|
printParameterHelp(wxConvCurrent->cWX2MB(argv[0]),false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(argc == 2 && argv[1][0] != '-') {
|
if(argc == 2 && argv[1][0] != '-') {
|
||||||
|
|
||||||
//#if defined(__MINGW32__)
|
//#if defined(__MINGW32__)
|
||||||
|
Reference in New Issue
Block a user