26 , _lastMsgType(
Console::EntryType::INFO)
28 , _outputWindow(nullptr)
30 , _consoleWindow(nullptr)
31 , _inputHistoryIndex(0)
32 , _consoleCallbackIndex(0)
53 CEGUI::WindowManager::getSingletonPtr()->destroyWindow(
_consoleWindow);
63 _consoleWindow = CEGUI::WindowManager::getSingletonPtr()->loadLayoutFromFile(layoutFile.c_str());
74 CEGUI::Logger::getSingleton().logEvent(
75 "Error: Unable to load the ConsoleWindow from .layout");
89 CEGUI::Editbox::EventTextAccepted,
94 CEGUI::Editbox::EventKeyUp,
100 const CEGUI::KeyEventArgs* keyEvent =
101 static_cast<const CEGUI::KeyEventArgs*
>(&e);
105 if (keyEvent->scancode == CEGUI::Key::ArrowUp) {
111 if (keyEvent->scancode == CEGUI::Key::ArrowDown) {
164 visible ?
"Toggling console display: ON"
165 :
"Toggling console display: OFF",
170 if (count > 0 && visible) {
188 for (
U16 i = 0u; i < CEGUI_MAX_CONSOLE_ENTRIES; ++i)
200 if (
_outputWindow->getItemCount() == CEGUI_MAX_CONSOLE_ENTRIES - 1) {
206 CEGUI::String(text.
_text.c_str()),
208 ? CEGUI::Colour(1.0f, 0.0f, 0.0f)
210 ? CEGUI::Colour(1.0f, 1.0f, 0.0f)
211 : CEGUI::Colour(0.4f, 0.4f, 0.3f),
212 CEGUI::HTF_WORDWRAP_LEFT_ALIGNED);
214 crtItem->setTextParsingEnabled(
false);
! A ListboxItem based class that can do horizontal text formatting.
std::unique_ptr< GUIConsoleCommandParser > _cmdParser
pointer to the command parser instance used
void RegisterHandlers()
Register our handler functions.
bool Handle_TextSubmitted(const CEGUI::EventArgs &e)
Handle when we press Enter after typing.
bool isVisible() const
Return true if console is visible, false if is hidden.
CEGUI::Editbox * _editBox
pointer to the editBox to reduce typing and casting
size_t _consoleCallbackIndex
I16 _inputHistoryIndex
Used to cycle through history.
void printText(const Console::OutputEntry &entry)
Add text to the console Window. Uses a text buffer if the console isn't ready for display yet.
void createCEGUIWindow()
The function which will load in the CEGUI Window and register event handlers.
bool Handle_TextInput(const CEGUI::EventArgs &e)
A key is pressed in the console input editbox.
GUIConsole(GUI &parent, PlatformContext &context)
moodycamel::ConcurrentQueue< Console::OutputEntry > _outputBuffer
Console::EntryType _lastMsgType
void setVisible(bool visible)
Hide or show the console.
CEGUI::Listbox * _outputWindow
std::deque< CEGUI::String > _inputHistory
Used to manage the input history.
void update(U64 deltaTimeUS)
CEGUI::Window * _consoleWindow
This will be a pointer to the ConsoleRoot Window.
CEGUI::String _inputBuffer
bool _init
used to check if the console is ready
void OutputText(const Console::OutputEntry &text) const
Graphical User Interface.
CEGUI::GUIContext * getCEGUIContext() noexcept
Provides direct access to the CEGUI context. Used by plugins (e.g. GUIConsole, GUIInput,...
PlatformContext & _context
Configuration & config() noexcept
constexpr bool IS_DEBUG_BUILD
bool isMainThread() noexcept
constexpr U32 CEGUI_MAX_CONSOLE_ENTRIES
Maximum number of lines to display in the console Window.
Handle console commands that start with a forward slash.
constexpr size_t to_size(const T value)
Project const SceneEntry & entry
struct Divide::Configuration::GUI gui
static NO_INLINE void errorfn(const char *format, T &&... args)
static NO_INLINE void printfn(const char *format, T &&... args)
static bool UnbindConsoleOutput(size_t &index)
static size_t BindConsoleOutput(const ConsolePrintCallback &guiConsoleCallback)