-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (31 loc) · 745 Bytes
/
Copy pathmain.cpp
File metadata and controls
47 lines (31 loc) · 745 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "game.h"
#include <QDesktopWidget>
#include <QApplication>
#include <QPalette>
void center(QWidget &widget)
{
int x, y;
int screenWidth;
int screenHeight;
QDesktopWidget *desktop = QApplication::desktop();
screenWidth = desktop->width();
screenHeight = desktop->height();
int WIDTH = 1400-10;
int HEIGHT = 800;
x = 0;
y = 0;
widget.setGeometry(x, y, WIDTH, HEIGHT);
widget.setFixedSize(WIDTH, HEIGHT);
QPalette palette;
palette.setBrush(widget.backgroundRole(), QBrush(Qt::black));
widget.setPalette(palette);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Game window;
window.setWindowTitle("LAZERS");
window.show();
center(window);
return app.exec();
}