-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial.cpp
More file actions
46 lines (39 loc) · 799 Bytes
/
tutorial.cpp
File metadata and controls
46 lines (39 loc) · 799 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
38
39
40
41
42
43
44
45
46
#include "credits.h"
#include "main.h"
#include "assets.h"
#include "tutorial.h"
Tutorial::Tutorial()
: bFinished(FALSE)
, bBlocked(TRUE)
, fElapsed(0.0f)
{
pInput->AddPointerListener(this);
pInput->AddKeyboardListener(this);
sptBg.Load(SPT_TUTORIAL);
pScene->Add(&sptBg);
}
Tutorial::~Tutorial()
{
sptBg.Unload();
pScene->Remove(&sptBg);
pInput->RemoveKeyboardListener(this);
pInput->RemovePointerListener(this);
pResourceManager->GarbageCollect();
}
void Tutorial::Update(f32 dt)
{
fElapsed += dt;
if (fElapsed > 0.35f)
bBlocked = FALSE;
}
void Tutorial::OnInputKeyboardPress(const EventInputKeyboard *ev)
{
Key k = ev->GetKey();
if (!bBlocked)
bFinished = TRUE;
}
void Tutorial::OnInputPointerRelease(const EventInputPointer *ev)
{
if (!bBlocked)
bFinished = TRUE;
}