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() {
|
void ArchipelagoClient::Poll() {
|
||||||
if(apClient == nullptr) {
|
if(apClient == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class ArchipelagoClient{
|
|||||||
void QueueExternalCheck(int64_t apLocation);
|
void QueueExternalCheck(int64_t apLocation);
|
||||||
|
|
||||||
void SendGameWon();
|
void SendGameWon();
|
||||||
|
void SendMessage(const char* message);
|
||||||
void Poll();
|
void Poll();
|
||||||
|
|
||||||
std::unique_ptr<APClient> apClient;
|
std::unique_ptr<APClient> apClient;
|
||||||
|
|||||||
@@ -66,6 +66,26 @@ void ArchipelagoConsoleWindow::DrawElement() {
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::PopStyleVar(3);
|
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
|
ImVec4 getColorVal(const std::string& color) { // TODO change color strings to an enum
|
||||||
|
|||||||
Reference in New Issue
Block a user