-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameInfo.cpp
More file actions
62 lines (49 loc) · 1.04 KB
/
GameInfo.cpp
File metadata and controls
62 lines (49 loc) · 1.04 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
#include <QList>
#include <QPolygonF>
#include "Map.h"
#include "GameUnit.h"
#include "GameInfo.h"
GameInfo::GameInfo()
{
antialiased = false;
ScrollHorizontal = 0;
ScrollVertical = 0;
GameUserView_Position.rx() = 0.0;
GameUserView_Position.ry() = 0.0;
ScrollSpeed = 20.0;
ZoomFactor = 1.0;
FramesPerSecond = 100.0;
DrawUnitsPath = 0;
DrawSelection = 0;
Global_Time = 0;
FrameTime = (int)(1000.0/FramesPerSecond);
if (FrameTime <= 0) FrameTime = 2;
Map = new GameMap(this);
GameUnits = new QList<GameUnit *>;
/***/
GameUnit *unit = new GameUnit(this);
GameUnits->append(unit);
/***/
}
GameInfo::~GameInfo()
{
}
void GameInfo::SelectUnitsInArea(QRectF *Area)
{
for (int i=0; i<GameUnits->length(); i++)
{
if (((*GameUnits)[i])->State.Position->intersects(*Area));
{
SelectedObjects.append(i);
((*GameUnits)[i])->SetSelection(1);
}
}
}
void GameInfo::UnSelectAllUnits()
{
for (int i=0; i<SelectedObjects.length(); i++)
{
((*GameUnits)[SelectedObjects[i]])->SetSelection(0);
}
SelectedObjects.clear();
}