-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSplashScreen.cpp
More file actions
37 lines (31 loc) · 796 Bytes
/
SplashScreen.cpp
File metadata and controls
37 lines (31 loc) · 796 Bytes
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
#include "stdafx.h"
#include "SplashScreen.h"
#include "Game.h"
//Display the Backround
void SplashScreen::Show(sf::RenderWindow& window)
{
sf::Image image;
image.LoadFromFile("Backgrounds/Splash.png");
sf::Sprite sprite(image);
window.Draw(sprite);
window.Display();
sf::Event event;
while (true)
{
window.GetEvent(event);
if(event.Type == sf::Event::Closed)
{
Game::SetGameState(dlb::Exiting);
break;
}
//Can Press Escape to exit the Game
if (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape)
{
Game::SetGameState(dlb::Exiting);
break;
}
//Move on if any key or mouse button pressed
if ((event.Type == sf::Event::KeyPressed && event.Key.Code != sf::Key::Escape) || event.Type == sf::Event::MouseButtonPressed)
break;
}
}