-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLD35.cpp
More file actions
31 lines (25 loc) · 709 Bytes
/
LD35.cpp
File metadata and controls
31 lines (25 loc) · 709 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
#include <Engine/Factory.hpp>
#include <Engine/ResourceManager.hpp>
#include "LD35.hpp"
#include "Level.hpp"
LD35::LD35() {
m_windowTitle = "LD35 - To be named";
m_scene = engine::Factory::create<Level>("assets/scripts/level1.json", this);
m_music.reset(engine::ResourceManager::instance()->MakeSound("assets/sound/music.wav"));
if (m_music) {
m_music->setLoop(true);
//m_music->play();
}
m_keyHandler = OnKeyDown.MakeHandler([this](const sf::Event::KeyEvent& e) {
if (e.code == sf::Keyboard::M && m_music) {
if (m_music->getStatus() == sf::Sound::Playing) {
m_music->pause();
} else {
m_music->play();
}
}
});
}
LD35::~LD35() {
OnKeyDown.RemoveHandler(m_keyHandler);
}