Move Editor UI into its own 'UI' folder
This commit is contained in:
35
Editor/src/UI/EditorConsole.cpp
Normal file
35
Editor/src/UI/EditorConsole.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <stdio.h>
|
||||
#include "EditorConsole.h"
|
||||
|
||||
|
||||
EditorConsole::EditorConsole()
|
||||
: Items(ImVector<char*>()), AutoScroll(false), ScrollToBottom(false)
|
||||
{
|
||||
AddLog("Hello Editor console!");
|
||||
}
|
||||
|
||||
EditorConsole::~EditorConsole() {
|
||||
|
||||
}
|
||||
|
||||
void EditorConsole::Draw() {
|
||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||
|
||||
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
{
|
||||
const char* item = Items[i];
|
||||
ImGui::TextUnformatted(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EditorConsole::AddLog(const char* fmt, ...) {
|
||||
char buf[1024];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
|
||||
buf[IM_ARRAYSIZE(buf) - 1] = 0;
|
||||
va_end(args);
|
||||
Items.push_back(strdup(buf));
|
||||
}
|
Reference in New Issue
Block a user