minor refactor
This commit is contained in:
@@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
static debug::Logger logger("level-screen");
|
static debug::Logger logger("level-screen");
|
||||||
|
|
||||||
LevelScreen::LevelScreen(Engine* engine, Level* level) : Screen(engine) {
|
LevelScreen::LevelScreen(Engine* engine, Level* level)
|
||||||
postProcessing = std::make_unique<PostProcessing>();
|
: Screen(engine), postProcessing(std::make_unique<PostProcessing>())
|
||||||
|
{
|
||||||
auto& settings = engine->getSettings();
|
auto& settings = engine->getSettings();
|
||||||
auto assets = engine->getAssets();
|
auto assets = engine->getAssets();
|
||||||
auto menu = engine->getGUI()->getMenu();
|
auto menu = engine->getGUI()->getMenu();
|
||||||
@@ -48,7 +48,11 @@ LevelScreen::LevelScreen(Engine* engine, Level* level) : Screen(engine) {
|
|||||||
animator = std::make_unique<TextureAnimator>();
|
animator = std::make_unique<TextureAnimator>();
|
||||||
animator->addAnimations(assets->getAnimations());
|
animator->addAnimations(assets->getAnimations());
|
||||||
|
|
||||||
auto content = level->content;
|
initializeContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LevelScreen::initializeContent() {
|
||||||
|
auto content = controller->getLevel()->content;
|
||||||
for (auto& entry : content->getPacks()) {
|
for (auto& entry : content->getPacks()) {
|
||||||
auto pack = entry.second.get();
|
auto pack = entry.second.get();
|
||||||
const ContentPack& info = pack->getInfo();
|
const ContentPack& info = pack->getInfo();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class LevelScreen : public Screen {
|
|||||||
|
|
||||||
bool hudVisible = true;
|
bool hudVisible = true;
|
||||||
void updateHotkeys();
|
void updateHotkeys();
|
||||||
|
void initializeContent();
|
||||||
public:
|
public:
|
||||||
LevelScreen(Engine* engine, Level* level);
|
LevelScreen(Engine* engine, Level* level);
|
||||||
~LevelScreen();
|
~LevelScreen();
|
||||||
|
|||||||
@@ -88,8 +88,7 @@ void Events::pollEvents() {
|
|||||||
binding.justChange = true;
|
binding.justChange = true;
|
||||||
binding.onactived.notify();
|
binding.onactived.notify();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (binding.state) {
|
if (binding.state) {
|
||||||
binding.state = false;
|
binding.state = false;
|
||||||
binding.justChange = true;
|
binding.justChange = true;
|
||||||
@@ -107,7 +106,7 @@ void Events::bind(const std::string& name, inputtype type, mousecode code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Events::bind(const std::string& name, inputtype type, int code) {
|
void Events::bind(const std::string& name, inputtype type, int code) {
|
||||||
bindings[name] = Binding(type, code);
|
bindings.emplace(name, Binding(type, code));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Events::active(const std::string& name) {
|
bool Events::active(const std::string& name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user