This commit is contained in:
2025-04-17 17:28:47 -05:00
parent a1e9401aaa
commit a79f40c66c
8 changed files with 135 additions and 4 deletions

View File

@@ -23,7 +23,43 @@ void ChatClient::run() {
static ClientModule* cm; { cm = (ClientModule*) moduleInstances[ClientModule()]; }
(void)cm;
if(open) {
static std::string s, addr;
ImGui::Begin("ChatClient Module", &open);
ImGui::InputText("Server Address: ", &addr);
if(cm->isRunning()) {
if(ImGui::Button("Disconnect") && cm->isRunning()) {
cm->stopClient();
}
} else {
if(ImGui::Button("Connect") && !cm->isRunning()) {
static SteamNetworkingIPAddr serverAddr;
serverAddr.ParseString(addr.c_str());
cm->startClient(serverAddr);
}
}
ImGui::Text("%s", messages.c_str());
ImGui::InputText("Message: ", &s);
ImGui::SameLine();
if(ImGui::Button("send")) {
cm->sendReliable(s.c_str(), (uint32) s.length());
}
ImGui::End();
} else {
app->stopModule(name);
}
}
bool ChatClient::onEvent(const Archimedes::Event& event) {