- bugfix for ultifd, screenshots now save even when loading from open with
This commit is contained in:
parent
2891aef52e
commit
4eb5879d04
|
@ -186,11 +186,13 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
const string splashParticlePath,
|
const string splashParticlePath,
|
||||||
float defaultAnimation,
|
float defaultAnimation,
|
||||||
int defaultParticleLoopStart,
|
int defaultParticleLoopStart,
|
||||||
float defaultZoom,float defaultXRot, float defaultYRot)
|
float defaultZoom,float defaultXRot, float defaultYRot,
|
||||||
|
string appPath)
|
||||||
: wxFrame(NULL, -1, ToUnicode(winHeader),
|
: wxFrame(NULL, -1, ToUnicode(winHeader),
|
||||||
wxPoint(Renderer::windowX, Renderer::windowY),
|
wxPoint(Renderer::windowX, Renderer::windowY),
|
||||||
wxSize(Renderer::windowW, Renderer::windowH)), model(NULL), glCanvas(NULL), renderer(NULL), initTextureManager(true), timer(NULL)
|
wxSize(Renderer::windowW, Renderer::windowH)), model(NULL), glCanvas(NULL), renderer(NULL), initTextureManager(true), timer(NULL)
|
||||||
{
|
{
|
||||||
|
this->appPath = appPath;
|
||||||
//getGlPlatformExtensions();
|
//getGlPlatformExtensions();
|
||||||
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; // to prevent flicker
|
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; // to prevent flicker
|
||||||
glCanvas = new GlCanvas(this, args);
|
glCanvas = new GlCanvas(this, args);
|
||||||
|
@ -714,14 +716,22 @@ void MainWindow::saveScreenshot() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string path = "screens/";
|
string screenShotsPath = extractDirectoryPathFromFile(appPath) + string("screens/");
|
||||||
|
|
||||||
|
printf("screenShotsPath [%s]\n",screenShotsPath.c_str());
|
||||||
|
|
||||||
|
if(isdir(screenShotsPath.c_str()) == false) {
|
||||||
|
createDirectoryPaths(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","png");
|
//string fileFormat = config.getString("ScreenShotFileType","png");
|
||||||
string fileFormat = "png";
|
string fileFormat = "png";
|
||||||
|
|
||||||
for(int i=0; i < 1000; ++i) {
|
for(int i=0; i < 1000; ++i) {
|
||||||
path = "screens/";
|
path = screenShotsPath;
|
||||||
path += string("screen") + intToStr(i) + string(".") + fileFormat;
|
path += string("screen") + intToStr(i) + string(".") + fileFormat;
|
||||||
FILE *f= fopen(path.c_str(), "rb");
|
FILE *f= fopen(path.c_str(), "rb");
|
||||||
if(f == NULL) {
|
if(f == NULL) {
|
||||||
|
@ -1987,6 +1997,14 @@ bool App::OnInit(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string appPath = "";
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[0]));
|
||||||
|
appPath = tmp_buf;
|
||||||
|
#else
|
||||||
|
appPath = wxFNCONV(argv[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
mainWindow= new MainWindow( unitToLoad,
|
mainWindow= new MainWindow( unitToLoad,
|
||||||
modelPath,
|
modelPath,
|
||||||
particlePath,
|
particlePath,
|
||||||
|
@ -1996,7 +2014,8 @@ bool App::OnInit(){
|
||||||
newParticleLoopValue,
|
newParticleLoopValue,
|
||||||
newZoomValue,
|
newZoomValue,
|
||||||
newXRotValue,
|
newXRotValue,
|
||||||
newYRotValue);
|
newYRotValue,
|
||||||
|
appPath);
|
||||||
mainWindow->Show();
|
mainWindow->Show();
|
||||||
mainWindow->init();
|
mainWindow->init();
|
||||||
mainWindow->Update();
|
mainWindow->Update();
|
||||||
|
|
|
@ -104,6 +104,8 @@ private:
|
||||||
|
|
||||||
bool isControlKeyPressed;
|
bool isControlKeyPressed;
|
||||||
|
|
||||||
|
string appPath;
|
||||||
|
|
||||||
void loadUnit(string path, string skillName);
|
void loadUnit(string path, string skillName);
|
||||||
void loadModel(string path);
|
void loadModel(string path);
|
||||||
void loadParticle(string path);
|
void loadParticle(string path);
|
||||||
|
@ -117,7 +119,8 @@ public:
|
||||||
const string modelPath,const string particlePath,
|
const string modelPath,const string particlePath,
|
||||||
const string projectileParticlePath,const string splashParticlePath,
|
const string projectileParticlePath,const string splashParticlePath,
|
||||||
float defaultAnimation,int defaultParticleLoopStart,
|
float defaultAnimation,int defaultParticleLoopStart,
|
||||||
float defaultZoom,float defaultXRot, float defaultYRot);
|
float defaultZoom,float defaultXRot, float defaultYRot,
|
||||||
|
string appPath);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue