-
Notifications
You must be signed in to change notification settings - Fork 0
/
BonusVue.h
79 lines (74 loc) · 1.77 KB
/
BonusVue.h
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
71
72
73
74
75
76
77
78
79
#ifndef BonusVue_H
#define BonusVue_H
#include<iostream>
#include<SFML/Graphics.hpp>
#include <iterator>
#include"Bonus.h"
const int DIAMETRE_BONUS = 25;
class BonusVue : public sf::Drawable
{
public:
BonusVue(){};
BonusVue(int x, int y, int effet) : x(x), y(y), effet(effet){
srand(time(nullptr));
this->cercle = sf::CircleShape(DIAMETRE_BONUS);
this->cercle.setPosition(x, y);
this->cercle.setFillColor(sf::Color(this->r, this->g, this->b));
};
explicit BonusVue(const BonusVue &b){
*this = b;
};
explicit BonusVue(BonusVue&& autre) : x(autre.x), y(autre.y), effet(autre.effet), r(autre.r), g(autre.g), b(autre.b), cercle(std::move(autre.cercle)) {};
const BonusVue& operator=(const BonusVue &bov){
this->x = bov.x;
this->y = bov.y;
this->r = bov.r;
this->g = bov.g;
this->b = bov.b;
this->effet = bov.effet;
this->cercle = bov.cercle;
return *this;
};
const BonusVue& operator=(const Bonus &bo){
Bonus tmp = bo;
this->x = tmp.getX();
this->y = tmp.getY();
this->r = bo.getR();
this->g = bo.getG();
this->b = bo.getB();
this->effet = tmp.getEffet();
this->cercle = sf::CircleShape(DIAMETRE_BONUS);
this->cercle.setPosition(this->x, this->y);
this->cercle.setFillColor(sf::Color(this->r, this->g, this->b));
return *this;
};
~BonusVue(){};
inline double getY(){
return this->y;
};
inline int getX(){
return this->x;
};
inline sf::CircleShape getCercle(){
return cercle;
}
inline const int getR() const{
return r;
}
inline const int getG() const{
return g;
}
inline const int getB() const{
return b;
}
private:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const{
target.draw(this->cercle, states);
};
int x;
int y;
int effet;
sf::CircleShape cercle;
int r, g, b;
};
#endif // !BonusVue_H