-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplashscreen.cpp
More file actions
60 lines (47 loc) · 1.14 KB
/
Splashscreen.cpp
File metadata and controls
60 lines (47 loc) · 1.14 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
#include "Splashscreen.h"
#include <chrono>
#include <iostream>
#include <thread>
#include <mutex>
#include "Menu.h"
Splashscreen::Splashscreen(MyWindow* window) : Panel(window) {
//Init textures
if (!shadow.loadFromFile("images/splashscreen/shadow.png")) {};
if (!logo.loadFromFile("images/splashscreen/logo.png")) {};
if (!button.loadFromFile("images/splashscreen/btn_keys.png")) {};
if (!buttonOff.create(button.getSize().x , button.getSize().y)) {};
//Init sprites
_shadow = sf::Sprite(shadow);
_logo = sf::Sprite(logo);
_button = sf::Sprite(button);
//Set sprites
_logo.setPosition(433, 259);
_button.setPosition(381, 670);
}
void Splashscreen::init()
{
getWindow()->clear();
//Draw sprites
getWindow()->draw(getBackground());
getWindow()->draw(_shadow);
getWindow()->draw(_logo);
getWindow()->draw(_button);
}
void Splashscreen::blink()
{
if(!visible) {
_button.setTexture(button);
visible = true;
}
else {
_button.setTexture(buttonOff);
visible = false;
}
}
int Splashscreen::keyPressedOnce(sf::Keyboard::Key key)
{
return Panel::PANEL_MENU;
}
int Splashscreen::getType() const {
return Panel::PANEL_SPLASHSCREEN;
}