-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (37 loc) · 940 Bytes
/
main.cpp
File metadata and controls
48 lines (37 loc) · 940 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
47
48
#include <QtGui/QApplication>
#include "zombie_invasion.h"
#include <QKeyEvent>
#include <QTime>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QDesktopWidget>
#include <QtGlobal>
#include <QLabel>
#include <QRectF>
#include <ctime>
void center(QWidget &widget)
{
int x, y;
int screenWidth;
int screenHeight;
int WIDTH = 600;
int HEIGHT = 500;
QDesktopWidget *desktop = QApplication::desktop();
screenWidth = desktop->width();
screenHeight = desktop->height();
x = (screenWidth - WIDTH) / 2;
y = (screenHeight - HEIGHT) / 2;
widget.setGeometry(x, y, WIDTH, HEIGHT);
widget.setFixedSize(WIDTH, HEIGHT);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
srand(time(NULL));
zombie_invasion zombieWindow;
zombieWindow.setFixedSize(550,400);
zombieWindow.setWindowTitle("Zombie Invasion");
zombieWindow.show();
center(zombieWindow);
return app.exec();
}