-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleSceneIntro.cpp
More file actions
53 lines (41 loc) · 1.08 KB
/
ModuleSceneIntro.cpp
File metadata and controls
53 lines (41 loc) · 1.08 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
#include "Globals.h"
#include "Application.h"
#include "ModuleSceneIntro.h"
// Reference at https://youtu.be/6OlenbCC4WI?t=382
ModuleSceneIntro::ModuleSceneIntro(Application* app, bool start_enabled) : Module(app, start_enabled)
{
graphics = NULL;
fx = 0;
}
ModuleSceneIntro::~ModuleSceneIntro()
{}
// Load assets
bool ModuleSceneIntro::Start()
{
LOG("Loading Intro assets");
bool ret = true;
graphics = App->textures->Load("rtype/intro.png");
App->audio->PlayMusic("rtype/intro.ogg", 0.0f);
fx = App->audio->LoadFx("rtype/starting.wav");
App->renderer->camera.x = App->renderer->camera.y = 0;
return ret;
}
// Load assets
bool ModuleSceneIntro::CleanUp()
{
LOG("Unloading Intro scene");
App->textures->Unload(graphics);
return true;
}
// Update: draw background
update_status ModuleSceneIntro::Update()
{
// Draw everything --------------------------------------
App->renderer->Blit(graphics, 0, 0, NULL);
if(App->input->GetKey(SDL_SCANCODE_SPACE) == KEY_UP)
{
App->audio->PlayFx(fx);
App->fade->FadeToBlack(this, App->scene_space, 3.0f);
}
return UPDATE_CONTINUE;
}