blob: 8de26bda509182610d85d808b99166cb7d4a0b89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "inputManager.hpp"
#include "chatManager.hpp"
#include "commandHandler.hpp"
#include "log.hpp"
#include <iostream>
CInputManager::CInputManager() {
log(LOG, "InputManager: initialized");
}
CInputManager::~CInputManager() {
log(SYS, "InputManager: bye");
}
void CInputManager::run() {
inputLoop();
}
void CInputManager::inputLoop() {
while (true) {
std::string input;
std::print("> ");
std::getline(std::cin, input);
if (input.empty())
continue;
g_pCommandHandler->isCommand(input) ? g_pCommandHandler->handleCommand(input) : g_pChatManager->newMessage({.msg = input, .username = "Server"});
}
}
|