-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCredits.cpp
70 lines (59 loc) · 1.69 KB
/
Credits.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "Credits.h"
Credits::Credits(MyWindow* window) : Panel(window)
{
//Init
if (!font.loadFromFile("fonts/masterbreaker.ttf")) {}
back = MyButton("images/settings/back.png", "images/settings/back_s.png");
back.changeTexture(false);
ln1 = sf::Text("Jeu réalisé par FROMONT Sam, LECLERCQ Noe, BARON Alexandre", font, 50);
ln2 = sf::Text("etudiants de la HELHa Campus Mons,", font, 50);
ln3 = sf::Text("dans le cadre du cours de Mr. V. Altares.", font, 50);
ln1.setFillColor(sf::Color(249, 148, 7));
ln2.setFillColor(sf::Color(249, 148, 7));
ln3.setFillColor(sf::Color(249, 148, 7));
back.setPosition(23, 28);
ln1.setPosition(710 - ln1.getLocalBounds().width / 2, 300);
ln2.setPosition(710 - ln2.getLocalBounds().width / 2, 400);
ln3.setPosition(710 - ln3.getLocalBounds().width / 2, 500);
}
void Credits::init()
{
back.setVolume(getWindow()->getConfig()->getVolume());
getWindow()->clear();
getWindow()->draw(getBackground());
getWindow()->draw(back.getSprite());
getWindow()->draw(ln1);
getWindow()->draw(ln2);
getWindow()->draw(ln3);
}
int Credits::keyPressedOnce(sf::Keyboard::Key key)
{
switch (key) {
case(sf::Keyboard::Key::Escape): return Panel::PANEL_MENU; break;
}
return -1;
}
int Credits::keyPressed(int key)
{
return -1;
}
int Credits::mouseMove(int x, int y) {
if (back.isSelected(x, y)) {
back.changeTexture();
}
return -1;
}
int Credits::mouseClicked(int x, int y, sf::Mouse::Button button)
{
if (button == sf::Mouse::Button::Left) {
if (back.isSelected(x, y)) {
back.changeTexture();
return Panel::PANEL_MENU;
}
}
return -1;
}
int Credits::getType() const
{
return Panel::PANEL_ACCOUNT;
}