-
Notifications
You must be signed in to change notification settings - Fork 0
/
SplashState.cpp
47 lines (36 loc) · 1.09 KB
/
SplashState.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
#include <sstream>
#include "SplashState.hpp"
#include "GameState.hpp"
#include "DEFINITIONS.h"
#include <iostream>
namespace ArktisProductions
{
SplashState::SplashState(GameDataRef data) : _data(data)
{
}
void SplashState::Init()
{
this->_data->assets.LoadTexture("Splash_BG", SPLASH_SCENE_BACKGROUND_FILEPATH);
_background.setTexture(this->_data->assets.GetTexture("Splash_BG"));
}
void SplashState::HandleInput()
{
sf::Event event;
while (this->_data->window.pollEvent(event))
{
if (sf::Event::Closed == event.type)
this->_data->window.close();
}
}
void SplashState::Update(float dt)
{
if (this->_clock.getElapsedTime().asSeconds() > 3)
this->_data->machine.AddState(StateRef(new GameState(_data)), true);
}
void SplashState::Draw(float dt)
{
this->_data->window.clear(sf::Color::Red);
this->_data->window.draw( this->_background );
this->_data->window.display();
}
}