Fix fullscreen option. Resolution switching now supported from command line.

master
Per Inge Mathisen 2011-07-02 00:52:34 +02:00
parent 10a78a4a7e
commit 5893d2998e
1 changed files with 5 additions and 8 deletions

View File

@ -26,7 +26,6 @@
#include <QtCore/QTextCodec> #include <QtCore/QTextCodec>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QDesktopWidget>
#if defined(WZ_OS_WIN) #if defined(WZ_OS_WIN)
# include <shlobj.h> /* For SHGetFolderPath */ # include <shlobj.h> /* For SHGetFolderPath */
@ -1273,28 +1272,26 @@ int main(int argc, char *argv[])
format.setSamples(war_getFSAA()); format.setSamples(war_getFSAA());
} }
WzMainWindow mainwindow(QSize(w, h), format); WzMainWindow mainwindow(QSize(w, h), format);
mainwindow.setMinimumResolution(QSize(800, 600));
if (!mainwindow.context()->isValid()) if (!mainwindow.context()->isValid())
{ {
QMessageBox::critical(NULL, "Oops!", "Warzone2100 failed to create an OpenGL context. This probably means that your graphics drivers are out of date. Try updating them!"); QMessageBox::critical(NULL, "Oops!", "Warzone2100 failed to create an OpenGL context. This probably means that your graphics drivers are out of date. Try updating them!");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
screenWidth = w;
screenHeight = h;
mainwindow.show();
if (war_getFullscreen()) if (war_getFullscreen())
{ {
QDesktopWidget *desktop = qApp->desktop();
w = desktop->screenGeometry().width();
h = desktop->screenGeometry().height();
pie_SetVideoBufferWidth(w); pie_SetVideoBufferWidth(w);
pie_SetVideoBufferHeight(h); pie_SetVideoBufferHeight(h);
WzMainWindow::instance()->showFullScreen(); mainwindow.showFullScreen();
} }
else else
{ {
mainwindow.setMinimumSize(w, h); mainwindow.setMinimumSize(w, h);
mainwindow.setMaximumSize(w, h); mainwindow.setMaximumSize(w, h);
} }
screenWidth = w;
screenHeight = h;
mainwindow.show();
mainwindow.setReadyToPaint(); mainwindow.setReadyToPaint();
char buf[256]; char buf[256];