/
StateStory.cpp
60 lines (50 loc) · 1.38 KB
/
StateStory.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
//----------------------------------------
// Defines
//----------------------------------------
//----------------------------------------
// Includes
//----------------------------------------
#include "StateStory.h"
//----------------------------------------
// Constructor & Destructor
//----------------------------------------
StateStory::StateStory()
{
}
StateStory::~StateStory()
{
}
//----------------------------------------
// Methods
//----------------------------------------
void StateStory::init()
{
m_bmpBackground.loadBackground("images/Story.png");
m_bmpBackground.disableTransparentColour();
m_bmpBackground.setPosition(Vector2di(0, 0));
m_IsEnd = false;
m_Counter = 64;
}
void StateStory::render()
{
m_bmpBackground.render();
EFFECTSYSTEM->renderFade();
}
void StateStory::update()
{
EFFECTSYSTEM->update();
if(m_Counter == 0) EFFECTSYSTEM->fadeIn(8);
if(m_Counter != -1) m_Counter -= 1;
if(EFFECTSYSTEM->getFadeAlpha() == 255 && m_IsEnd) setNextState(STATE_LEVEL);
}
void StateStory::userInput()
{
input->update();
if(input->isQuit() || input->isSelect())
nullifyState();
if(EFFECTSYSTEM->getFadeAlpha() == 0 && (input->isStart() || input->isA() || input->isB() || input->isX() || input->isY()))
{
m_IsEnd = true;
EFFECTSYSTEM->fadeOut(8);
}
}