forked from FranciscoBiaso/TileMapEditorRealmz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtatus
54 lines (54 loc) · 2.14 KB
/
tatus
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
[1mdiff --git a/Map.cpp b/Map.cpp[m
[1mindex c796a3c..08f5f25 100644[m
[1m--- a/Map.cpp[m
[1m+++ b/Map.cpp[m
[36m@@ -32,18 +32,28 @@[m [mscene::Map::Map(std::string name, int width, int height, int levels) : name(name[m
#include <glm/glm.hpp>[m
#include "Thing.h"[m
#include "ImgObj.h"[m
[32m+[m[32m///////////////////////////////////////[m
[32m+[m[32m/// LEVELS ////////////////////////////[m
[32m+[m[32m/// LEVEL 0 = GROUND FLOOR (0)[m
[32m+[m[32m/// LEVEL 1 = UNDERGROUND (1)[m
[32m+[m[32m/// LEVEL 2 = UNDERGROUND (2)[m
[32m+[m[32m/// LEVEL 3 = UNDERGROUND (3)[m
[32m+[m[32m/// LEVEL 4 = UNDERGROUND (4)[m
[m
data::Thing scene::Map::addThing(data::Thing newThing, int line, int col, int level)[m
{ [m
newThing.setName(std::to_string(_count_things));[m
_count_things++;[m
[31m- [m
[32m+[m [32m// GET THING REF //[m
math::Vec2<int> ref = newThing.getImgObjPtr()->getRef(0);[m
glm::vec2 glmRef(ref.getX(), ref.getY());[m
[31m- Quad & quad = _glScence->getQuad(line * getWidth() + col);[m
[32m+[m [32m// GET QUAD FROM RENDER STRUCTURE //[m
[32m+[m [32mQuad & quad = _glScence->getQuad((line * getWidth() + col) + level * getWidth() * getHeight());[m[41m [m
[32m+[m [32m// SET VALUES //[m
[32m+[m [32mquad.setCoordZ(level *= 0.1);// CONVERT LEVEL TOP Z COORD //[m
quad.setTextCoord(glmRef);[m
quad.setColor(glm::vec4(1, 1, 1, 1));[m
[31m-[m
[32m+[m [32m// add into internal structure[m
return this->structure[level][width * line + col].addItem(newThing); [m
}[m
[m
[36m@@ -106,11 +116,14 @@[m [mint scene::Map::getHeight() const[m
[m
void scene::Map::deletAllThings(std::string thingName)[m
{[m
[31m- for (int y = 0; y < height; y++)[m
[32m+[m [32mfor (int level = 0; level < levels; level++)[m
{[m
[31m- for (int x = 0; x < width; x++)[m
[32m+[m [32mfor (int y = 0; y < height; y++)[m
{[m
[31m- structure[0][width * y + x].removeItem(thingName);[m
[32m+[m [32mfor (int x = 0; x < width; x++)[m
[32m+[m [32m{[m
[32m+[m [32mstructure[level][width * y + x].removeItem(thingName);[m
[32m+[m [32m}[m
}[m
}[m
}[m