Move Editor UI into its own 'UI' folder

This commit is contained in:
2022-11-05 13:47:19 +01:00
parent c8ebc0fa17
commit 3b91516d6e
5 changed files with 1 additions and 0 deletions

View 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));
}