Added textbox to console window for chatting and server commands
This commit is contained in:
@@ -342,6 +342,14 @@ void ArchipelagoClient::SendGameWon() {
|
||||
}
|
||||
}
|
||||
|
||||
void ArchipelagoClient::SendMessage(const char* message) {
|
||||
if(apClient == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
apClient->Say(std::string(message));
|
||||
}
|
||||
|
||||
void ArchipelagoClient::Poll() {
|
||||
if(apClient == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -58,7 +58,7 @@ class ArchipelagoClient{
|
||||
void QueueExternalCheck(int64_t apLocation);
|
||||
|
||||
void SendGameWon();
|
||||
|
||||
void SendMessage(const char* message);
|
||||
void Poll();
|
||||
|
||||
std::unique_ptr<APClient> apClient;
|
||||
|
||||
@@ -66,6 +66,26 @@ void ArchipelagoConsoleWindow::DrawElement() {
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
static char textEntryBuf[1024];
|
||||
static bool keepFocus = false;
|
||||
|
||||
if(keepFocus) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
keepFocus = false;
|
||||
}
|
||||
if(ImGui::InputText("##AP_MessageField", textEntryBuf, 1023, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
ArchipelagoClient::GetInstance().SendMessage(textEntryBuf);
|
||||
textEntryBuf[0] = '\0';
|
||||
keepFocus = true;
|
||||
}
|
||||
//keepFocus = ImGui::IsItemActive();
|
||||
ImGui::SameLine();
|
||||
if(ImGui::Button("Send")) {
|
||||
ArchipelagoClient::GetInstance().SendMessage(textEntryBuf);
|
||||
textEntryBuf[0] = '\0';
|
||||
keepFocus = true;
|
||||
}
|
||||
};
|
||||
|
||||
ImVec4 getColorVal(const std::string& color) { // TODO change color strings to an enum
|
||||
|
||||
Reference in New Issue
Block a user