build
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -23,5 +23,11 @@ class ChatClient : public Archimedes::Module {
|
||||
bool onEvent(const Archimedes::Event&);
|
||||
|
||||
private:
|
||||
std::string messages;
|
||||
std::string messages = "";
|
||||
bool open = true;
|
||||
};
|
||||
|
||||
#ifdef CHATCLIENT_DYNAMIC
|
||||
#define MODULE_TYPE ChatClient
|
||||
#include "endModule.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user