-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleSceneIntro.cpp
More file actions
68 lines (54 loc) · 1.71 KB
/
ModuleSceneIntro.cpp
File metadata and controls
68 lines (54 loc) · 1.71 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "Globals.h"
#include "Application.h"
#include "ModuleRender.h"
#include "ModuleSceneIntro.h"
#include "ModuleInput.h"
#include "ModuleTextures.h"
#include "ModuleAudio.h"
#include "ModulePhysics.h"
ModuleSceneIntro::ModuleSceneIntro(Application* app, bool start_enabled) : Module(app, start_enabled)
{
circle = box = rick = NULL;
}
ModuleSceneIntro::~ModuleSceneIntro()
{}
// Load assets
bool ModuleSceneIntro::Start()
{
LOG("Loading Intro assets");
bool ret = true;
App->renderer->camera.x = App->renderer->camera.y = 0;
circle = App->textures->Load("pinball/wheel.png");
box = App->textures->Load("pinball/crate.png");
rick = App->textures->Load("pinball/rick_head.png");
return ret;
}
// Load assets
bool ModuleSceneIntro::CleanUp()
{
LOG("Unloading Intro scene");
return true;
}
// Update: draw background
update_status ModuleSceneIntro::Update()
{
// TODO 5: Move all creation of bodies on 1,2,3 key press here in the scene
if (App->input->GetKey(SDL_SCANCODE_1) == KEY_DOWN)
{
//circles.add(App->physics->CreateCircle(App->input->GetMouseX(), App->input->GetMouseY(), 25));
App->physics->CreateCircle(App->input->GetMouseX(), App->input->GetMouseY(), 25);
}
if (App->input->GetKey(SDL_SCANCODE_2) == KEY_DOWN)
{
App->physics->CreateRectangle(App->input->GetMouseX(), App->input->GetMouseY(), 1, 0.5);
// TODO 1: When pressing 2, create a box on the mouse position
}
if (App->input->GetKey(SDL_SCANCODE_3) == KEY_DOWN)
{
App->physics->CreateChain(App->input->GetMouseX(), App->input->GetMouseY());
// TODO 3: Create a chain shape using those vertices
// remember to convert them from pixels to meters!
}
// TODO 7: Draw all the circles using "circle" texture
return UPDATE_CONTINUE;
}