-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurseur.h
49 lines (47 loc) · 1.03 KB
/
Curseur.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
#ifndef Curseur_H
#define Curseur_H
#include<iostream>
#include<SFML/Graphics.hpp>
class Curseur : public sf::Drawable
{
public:
Curseur()
{
this->y = 0;
this->carre = sf::CircleShape(20, 4);
this->carre.setPosition(-30, y);
this->carre.setFillColor(sf::Color(150, 50, 250));
};
Curseur(const Curseur &c){
*this = c;
};
explicit Curseur(Curseur&& autre) : y{ autre.y }, carre{ std::move(autre.carre) } {};
inline const Curseur& operator=(const Curseur&& c){
if (this != &c){
this->carre = c.carre;
this->carre.setPosition(0, y);
this->y = c.y;
}
return *this;
};
inline const Curseur& operator=(const Curseur& c){
this->carre = c.carre;
this->carre.setPosition(-30, y);
this->y = c.y;
return *this;
};
~Curseur(){};
inline const int getY() const{
return y;
};
inline void setY(const int valeur){
this->y = valeur;
}
private:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const{
target.draw(this->carre, states);
};
sf::CircleShape carre;
int y;
};
#endif // !Curseur_H