add OutputWindow to display logs
This commit is contained in:
parent
52ed1e7749
commit
52dcc33db4
|
|
@ -0,0 +1,20 @@
|
|||
#include <NazaraEditor/Core.hpp>
|
||||
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
|
||||
namespace NzEditor
|
||||
{
|
||||
class OutputWindow
|
||||
: public Nz::EditorWindow
|
||||
{
|
||||
public:
|
||||
OutputWindow(Nz::EditorBaseApplication* app);
|
||||
|
||||
virtual void OnEditorGUI() override;
|
||||
|
||||
protected:
|
||||
bool m_bScrollToBottom;
|
||||
bool m_bScrollToTop;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#include <NazaraEditor/Editor/UI/OutputWindow.hpp>
|
||||
|
||||
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
|
||||
|
||||
namespace NzEditor
|
||||
{
|
||||
OutputWindow::OutputWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Output", { "Output" })
|
||||
, m_bScrollToBottom(true)
|
||||
, m_bScrollToTop(false)
|
||||
{
|
||||
}
|
||||
|
||||
void OutputWindow::OnEditorGUI()
|
||||
{
|
||||
if (ImGui::BeginChild("scrolling"))
|
||||
{
|
||||
for (auto&& line : Nz::EditorLogger::Instance()->GetLog())
|
||||
ImGui::TextUnformatted(line.c_str());
|
||||
|
||||
if (m_bScrollToBottom)
|
||||
{
|
||||
ImGui::SetScrollHereY(1.0f);
|
||||
m_bScrollToBottom = false;
|
||||
}
|
||||
if (m_bScrollToTop)
|
||||
{
|
||||
ImGui::SetScrollHereY(0.f);
|
||||
m_bScrollToTop = false;
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
#include <NazaraEditor/Editor/UI/InspectorWindow.hpp>
|
||||
#include <NazaraEditor/Editor/UI/LevelWindow.hpp>
|
||||
#include <NazaraEditor/Editor/UI/MainWindow.hpp>
|
||||
#include <NazaraEditor/Editor/UI/OutputWindow.hpp>
|
||||
|
||||
NAZARA_REQUEST_DEDICATED_GPU()
|
||||
|
||||
|
|
@ -34,6 +35,7 @@ int WinMain(int argc, char* argv[])
|
|||
app.RegisterWindow<NzEditor::AssetsWindow>();
|
||||
app.RegisterWindow<NzEditor::LevelWindow>();
|
||||
app.RegisterWindow<NzEditor::InspectorWindow>();
|
||||
app.RegisterWindow<NzEditor::OutputWindow>();
|
||||
|
||||
entt::meta<Nz::NodeComponent>()
|
||||
.type(entt::type_hash<Nz::NodeComponent>::value())
|
||||
|
|
|
|||
Loading…
Reference in New Issue