Skip to content

Commit

Permalink
Tidy up initialization of SystemUI
Browse files Browse the repository at this point in the history
  • Loading branch information
rokups committed Jun 27, 2017
1 parent f1fb3ae commit 04ad84e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
6 changes: 6 additions & 0 deletions Source/Atomic/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

// ATOMIC BEGIN
#include "../Resource/XMLFile.h"
#include "../UI/SystemUI/SystemUI.h"
// ATOMIC END

#ifdef ATOMIC_NAVIGATION
Expand Down Expand Up @@ -344,6 +345,11 @@ bool Engine::Initialize(const VariantMap& parameters)
EventProfiler::SetActive(true);
}
#endif

// ATOMIC BEGIN
context_->RegisterSubsystem(new SystemUI(context_));
// ATOMIC END

frameTimer_.Reset();

ATOMIC_LOGINFO("Initialized engine");
Expand Down
14 changes: 3 additions & 11 deletions Source/Atomic/UI/SystemUI/SystemUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ SystemUI::SystemUI(Atomic::Context* context)
});
SubscribeToEvent(E_SDLRAWINPUT, std::bind(&SystemUI::OnRawEvent, this, _2));
SubscribeToEvent(E_SCREENMODE, std::bind(&SystemUI::UpdateProjectionMatrix, this));

context_->RegisterSubsystem(new Console(context_));
context_->RegisterSubsystem(new DebugHud(context_));
}

SystemUI::~SystemUI()
Expand Down Expand Up @@ -368,16 +371,5 @@ void SystemUI::SetScale(float scale)
UpdateProjectionMatrix();
}

void SystemUI::CreateConsoleAndDebugHud()
{
Console* console = new Console(context_);
DebugHud* debugHud = new DebugHud(context_);

// Create console & debug hud
context_->RegisterSubsystem(console);
context_->RegisterSubsystem(debugHud);

}

}

2 changes: 0 additions & 2 deletions Source/Atomic/UI/SystemUI/SystemUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ ATOMIC_OBJECT(SystemUI, Atomic::Object);
const Atomic::String& font_path, float size = 0,
const std::initializer_list<unsigned short>& ranges = {}, bool merge = false);

void CreateConsoleAndDebugHud();

protected:
float uiScale_ = 1.f;
Atomic::Matrix4 projection_;
Expand Down
4 changes: 0 additions & 4 deletions Source/Atomic/UI/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ void UI::Initialize(const String& languageFile)

initialized_ = true;

SystemUI* systemUI = new SystemUI(context_);
context_->RegisterSubsystem(systemUI);
systemUI->CreateConsoleAndDebugHud();

//TB_DEBUG_SETTING(LAYOUT_BOUNDS) = 1;
}

Expand Down

0 comments on commit 04ad84e

Please sign in to comment.