diff --git a/include/NazaraEditor/Editor/UI/OutputWindow.hpp b/include/NazaraEditor/Editor/UI/OutputWindow.hpp new file mode 100644 index 0000000..f67b5c6 --- /dev/null +++ b/include/NazaraEditor/Editor/UI/OutputWindow.hpp @@ -0,0 +1,20 @@ +#include + +#include +#include + +namespace NzEditor +{ + class OutputWindow + : public Nz::EditorWindow + { + public: + OutputWindow(Nz::EditorBaseApplication* app); + + virtual void OnEditorGUI() override; + + protected: + bool m_bScrollToBottom; + bool m_bScrollToTop; + }; +} \ No newline at end of file diff --git a/src/NazaraEditor/Editor/UI/OutputWindow.cpp b/src/NazaraEditor/Editor/UI/OutputWindow.cpp new file mode 100644 index 0000000..7ec2518 --- /dev/null +++ b/src/NazaraEditor/Editor/UI/OutputWindow.cpp @@ -0,0 +1,34 @@ +#include + +#include + +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(); + } + } +} \ No newline at end of file diff --git a/src/NazaraEditor/Editor/main.cpp b/src/NazaraEditor/Editor/main.cpp index 4a61473..5f05960 100644 --- a/src/NazaraEditor/Editor/main.cpp +++ b/src/NazaraEditor/Editor/main.cpp @@ -13,6 +13,7 @@ #include #include #include +#include NAZARA_REQUEST_DEDICATED_GPU() @@ -34,6 +35,7 @@ int WinMain(int argc, char* argv[]) app.RegisterWindow(); app.RegisterWindow(); app.RegisterWindow(); + app.RegisterWindow(); entt::meta() .type(entt::type_hash::value())