Add Console header

This commit is contained in:
2025-01-18 00:55:19 -05:00
parent 916e44c7e5
commit ebdcae945f

View File

@@ -1,13 +1,46 @@
#pragma once
#include <JUI/Widgets/Window.hpp>
#include <JUI/Widgets/TextInputForm.hpp>
namespace CaveGame::Client
{
class Console : public JUI::Window
{
public:
Event<std::string> OnInput;
explicit Console(Widget* parent) : JUI::Window(parent)
{
this->SetTitle("Console");
input_box = new JUI::TextInputForm(this->GetViewportInstance());
input_box->Size(JUI::UDim2(0, 20, 1, 0));
input_box->Position(JUI::UDim2(0, -20, 0, 1));
input_box->OnReturn += [this] (const std::string& msg) { OnInput.Invoke(msg); };
}
void ObserveKeyInput(Key key, bool pressed) override
{
if (!IsVisible())
return;
Widget::ObserveKeyInput(key, pressed);
}
bool IsOpen() const { return console_open;}
void SetOpen(bool open) {
console_open = open;
if (open)
//input_box.Gra
Visible(open);
}
protected:
JUI::TextInputForm* input_box;
JUI::Rect* message_history;
bool console_open = false;
private:
};
}