-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem.cpp
More file actions
70 lines (65 loc) · 1.37 KB
/
Copy pathItem.cpp
File metadata and controls
70 lines (65 loc) · 1.37 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
61
62
63
64
65
66
67
68
69
70
#include "Item.h"
Item::Item(Texture* texture)
{
body.setTexture(texture);
body.setSize(Vector2f(90, 48));
body.setOrigin(body.getSize() / 2.0f);
hitBlock.setSize(Vector2f(50, 50));
hitBlock.setOrigin(hitBlock.getSize() / 2.0f);
hitBlock.setOutlineThickness(2.0f);
hitBlock.setOutlineColor(Color::Black);
hitBlock.setFillColor(Color::Transparent);
}
Item::~Item()
{
}
void Item::Draw(RenderWindow& window)
{
window.draw(body);
//window.draw(hitBlock);
}
void Item::setPosition(Vector2f Pos,int Type)
{
body.setPosition(Pos);
hitBlock.setPosition(body.getPosition());
type = Type;
switch (Type) {
case 0:
uvRect = IntRect(0, 0, 120, 64);
break;
case 1:
uvRect = IntRect(120, 0, 120, 64);
break;
case 2:
uvRect = IntRect(240, 0, 120, 64);
break;
case 3:
uvRect = IntRect(0, 64, 120, 64);
break;
case 4:
uvRect = IntRect(120, 64, 120, 64);
break;
case 5:
uvRect = IntRect(240, 64, 120, 64);
break;
case 6:
uvRect = IntRect(0, 64 * 2, 120, 64);
break;
case 7:
uvRect = IntRect(120, 64 * 2, 120, 64);
break;
case 8:
uvRect = IntRect(240, 64 * 2, 120, 64);
break;
case 9:
uvRect = IntRect(0, 64 * 3, 120, 64);
break;
case 10:
uvRect = IntRect(120, 64 * 3, 120, 64);
break;
case 11:
uvRect = IntRect(240, 64 * 3, 120, 64);
break;
}
body.setTextureRect(uvRect);
}