4#include <imgui/imgui.h>
5#include <imgui/imgui_impl_glfw.h>
6#include <imgui/imgui_impl_opengl3.h>
9#include <imgui/imgui_impl_win32.h>
13#include <imgui/imgui_impl_osx.h>
43 std::stringstream
out;
44 std::stringstream
err;
50 const char *
banner = R
"( ________ ________ ________ ________ ___ ___
51|\ ____\|\ _____\\ __ \|\ __ \|\ \ / /|
52\ \ \___|\ \ \__/\ \ \|\ \ \ \|\ \ \ \ / / /
53 \ \_____ \ \ __\\ \ \\\ \ \ __ \ \ \/ / /
54 \|____|\ \ \ \_| \ \ \\\ \ \ \ \ \ \ / /
55 ____\_\ \ \__\ \ \_______\ \__\ \__\ \__/ /
56 |\_________\|__| \|_______|\|__|\|__|\|__|/
57 \|_________| SimpleFastOpenAtomicVisualiser
59Copyright (C) 2025 Jerboa
60SimpleFastOpenAtomicVisualiser comes with ABSOLUTELY NO WARRANTY; for details run GPL.
61This is free software, and you are welcome to redistribute it under certain conditions.)";
69 ocout = std::cout.rdbuf(
out.rdbuf());
70 ocerr = std::cerr.rdbuf(
err.rdbuf());
89 std::cout.rdbuf(
ocout);
90 std::cerr.rdbuf(
ocerr);
94 static int Stricmp(
const char*
s1,
const char*
s2) {
int d;
while ((
d = std::toupper(*
s2) - std::toupper(*
s1)) == 0 && *
s1) {
s1++;
s2++; }
return d; }
95 static int Strnicmp(
const char*
s1,
const char*
s2,
int n) {
int d = 0;
while (n > 0 && (
d = std::toupper(*
s2) - std::toupper(*
s1)) == 0 && *
s1) {
s1++;
s2++; n--; }
return d; }
105 for (
int i = 0;
i <
Items.Size;
i++)
160 if (!ImGui::Begin(
title))
166 focussed = ImGui::IsWindowFocused();
168 ImGui::TextWrapped(
"Enter 'help()' for a list of functions.");
169 ImGui::TextWrapped(
"For help with each function: 'help(zoomCamera)'.");
171 if (ImGui::SmallButton(
"Clear")) {
clearLog(); }
179 if (ImGui::BeginPopupContextWindow())
181 if (ImGui::Selectable(
"Clear")) {
clearLog(); }
200 ImGui::TextWrapped(
"%s",
item);
201 if (
has_color) { ImGui::PopStyleColor(); }
206 if (
ScrollToBottom || (
AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) { ImGui::SetScrollHereY(1.0f); }
209 ImGui::PopStyleVar();
227 ImGui::SetItemDefaultFocus();
284 return console->textEditCallback(data);
289 switch (data->EventFlag)
296 const char*
word_end = data->Buf + data->CursorPos;
301 if (c ==
' ' || c ==
'\t' || c ==
',' || c ==
';') {
break; }
323 data->InsertChars(data->CursorPos,
candidates[0]);
324 data->InsertChars(data->CursorPos,
" ");
357 addLog(
"Possible matches:\n");
390 data->DeleteChars(0, data->BufTextLen);
Lua console.
Definition console.h:201
glm::vec< L, float, glm::qualifier::highp > vec
Definition commandLine.h:214
A window for Console (from Imgui example.)
Definition consoleWindow.h:28
void addLog(const char *fmt,...) IM_FMTARGS(2)
Add a const char * to the log.
Definition consoleWindow.h:115
std::stringstream err
Definition consoleWindow.h:44
ImVector< char * > Items
Definition consoleWindow.h:30
bool focussed
Definition consoleWindow.h:37
static int Strnicmp(const char *s1, const char *s2, int n)
Definition consoleWindow.h:95
ImVector< char * > History
Definition consoleWindow.h:32
void execCommand(const char *command_line, Console &console)
Execute a console command.
Definition consoleWindow.h:240
std::stringstream out
Definition consoleWindow.h:43
~ConsoleWindow()
Definition consoleWindow.h:82
ImVector< const char * > Commands
Definition consoleWindow.h:31
ConsoleWindow()
Construct a new ConsoleWindow.
Definition consoleWindow.h:67
void draw(const char *title, Console &console)
Draw the console window.
Definition consoleWindow.h:149
char InputBuf[256]
Definition consoleWindow.h:29
bool AutoScroll
Definition consoleWindow.h:35
std::streambuf * ocerr
Definition consoleWindow.h:41
static int TextEditCallbackStub(ImGuiInputTextCallbackData *data)
Definition consoleWindow.h:281
const unsigned logLineSize
Definition consoleWindow.h:38
int textEditCallback(ImGuiInputTextCallbackData *data)
Definition consoleWindow.h:287
void addLog(std::string s)
Add a string to the log.
Definition consoleWindow.h:130
void clearLog()
Clear the ConsoleWindow's log.
Definition consoleWindow.h:103
static int Stricmp(const char *s1, const char *s2)
Definition consoleWindow.h:94
std::streambuf * ocout
Definition consoleWindow.h:40
static char * Strdup(const char *s)
Definition consoleWindow.h:96
ImGuiTextFilter Filter
Definition consoleWindow.h:34
int HistoryPos
Definition consoleWindow.h:33
bool ScrollToBottom
Definition consoleWindow.h:36
static void Strtrim(char *s)
Definition consoleWindow.h:97
const char * banner
The text banner.
Definition consoleWindow.h:50