-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
32 lines (25 loc) · 809 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <QApplication>
#include <QDesktopWidget>
#include <QSurfaceFormat>
#include "mainwindow.h"
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setSwapInterval(0); //disable vsync
if(QCoreApplication::arguments().contains(QStringLiteral("--multisample")))
format.setSamples(4);
format.setVersion(3, 3);
format.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(format);
MainWindow window;
window.resize(window.sizeHint());
int desktopArea = QApplication::desktop()->width() * QApplication::desktop()->height();
int widgetArea = window.width() * window.height();
if(((float)widgetArea / (float)desktopArea) < 0.75f)
window.show();
else
window.showMaximized();
return a.exec();
}