trying to fix map editor for wxwidget 2.8 too

This commit is contained in:
titiger 2016-01-23 19:05:32 +01:00
parent c9400cc3b1
commit 1385f3fea2
2 changed files with 22 additions and 11 deletions

View File

@ -140,15 +140,6 @@ BEGIN_EVENT_TABLE(MainToolBar, wxToolBar)
END_EVENT_TABLE() END_EVENT_TABLE()
void MainWindow::init(string fname) { void MainWindow::init(string fname) {
#if wxCHECK_VERSION(2, 9, 3)
//glCanvas->setCurrentGLContext();
//printf("setcurrent #1\n");
#elif wxCHECK_VERSION(2, 9, 1)
#else
if(glCanvas) glCanvas->SetCurrent();
//printf("setcurrent #2\n");
#endif
//menus //menus
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
@ -458,6 +449,17 @@ void MainWindow::init(string fname) {
//setDirty(false); //setDirty(false);
//setExtension(); //setExtension();
initGlCanvas();
#if wxCHECK_VERSION(2, 9, 3)
//glCanvas->setCurrentGLContext();
//printf("setcurrent #1\n");
#elif wxCHECK_VERSION(2, 9, 1)
#else
if(glCanvas) glCanvas->SetCurrent();
//printf("setcurrent #2\n");
#endif
if(startupSettingsInited == false) { if(startupSettingsInited == false) {
startupSettingsInited = true; startupSettingsInited = true;
setupStartupSettings(); setupStartupSettings();
@ -482,12 +484,20 @@ void MainWindow::onClose(wxCloseEvent &event) {
this->Destroy(); this->Destroy();
} }
void MainWindow::initGlCanvas(){
if(glCanvas == NULL) {
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 };
glCanvas = new GlCanvas(this, this->panel, args);
boxsizer->Add(glCanvas, 1, wxEXPAND);
}
}
void MainWindow::setupStartupSettings() { void MainWindow::setupStartupSettings() {
//gl canvas //gl canvas
if(glCanvas == NULL) { if(glCanvas == NULL) {
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; initGlCanvas();
glCanvas = new GlCanvas(this, this->panel, args);
boxsizer->Add(glCanvas, 1, wxEXPAND); boxsizer->Add(glCanvas, 1, wxEXPAND);

View File

@ -287,6 +287,7 @@ private:
void setDirty(bool val=true); void setDirty(bool val=true);
void setExtension(); void setExtension();
void setupStartupSettings(); void setupStartupSettings();
void initGlCanvas();
}; };
// ===================================================== // =====================================================