-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCursor.cpp
52 lines (37 loc) · 905 Bytes
/
Cursor.cpp
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
#include "inc.h"
Cursor::Cursor(Vector2d vec, Texture* textr, Type type, int numAmmo) : Object(vec, textr, type){
player = nullptr;
rgun = new Gun(numAmmo);
rgun->Init();
}
Cursor::~Cursor() {
delete rgun;
}
void Cursor::setPlayer(Player* player) {
this->player = player;
}
void Cursor::Update(Object* obj) {
rgun->Update();
}
void Cursor::Draw() {
getSkin().drawTexture(Pos());
rgun->Draw();
}
Gun* Cursor::getGun() {
return rgun;
}
void Cursor::onMouseMove(int x, int y, int xrelative, int yrelative) {
Pos(Vector2d(x,y));
}
void Cursor::onMouseButtonClick(FRMouseButton button, bool isReleased) {
if (button == FRMouseButton::LEFT && isReleased == false) {
if (rgun->getShotsLeft() > 0) {
rgun->shoot(player->Pos(world), Pos());;
} else {
rgun->reload();
}
}
}
void Cursor::collisionDetected(Object * obj)
{
}