-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.cpp
More file actions
60 lines (41 loc) · 1.05 KB
/
Copy pathMap.cpp
File metadata and controls
60 lines (41 loc) · 1.05 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 "Map.h"
using namespace std;
Map::Map(){
m_collisionRects = nullptr;
}
Map::~Map(){
delete[] m_collisionRects;
m_collisionRects = nullptr;
}
void Map::Load(wstring fN){
LoadCollision(fN);
LoadModel(fN);
}
void Map::Update(){
model.Update();
}
void Map::Draw(){
model.Draw();
m_levelShapes.Draw();
}
void Map::LoadCollision(wstring fN){
wstring completePathAndName = CV_baseDir + CV_collisionDir + fN + CV_collisionFileType;
ifstream file(completePathAndName);
if (file) {
file >> m_mapName >> m_numCollisionRects;
m_collisionRects = new XMFLOAT4[m_numCollisionRects];
for (int i = 0; i < m_numCollisionRects; i++) {
file >> m_collisionRects[i].x >> m_collisionRects[i].y >> m_collisionRects[i].z >> m_collisionRects[i].w;
}
file.close();
}
else {
Error(L"Cannot open collision", completePathAndName.c_str());
}
// WireFrameDebug
m_levelShapes.Create(m_collisionRects, m_numCollisionRects);
}
void Map::LoadModel(wstring fN){
model.AssignResources(DT_QUICKTEST, DV_BASICNORMAL, DP_BASICNORMAL);
model.LoadMesh(fN);
}