-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchat.hh
43 lines (33 loc) · 899 Bytes
/
chat.hh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef YCRAFT_CHAT_HH
#define YCRAFT_CHAT_HH
#include "_components.hh"
class App;
struct ChatItem {
uint32_t time;
std::string content;
};
namespace Chat {
bool IsCommand(std::string input);
std::vector <std::string> ParseCommand(std::string input);
}
typedef void (*CommandCallback)(std::vector <std::string>&, App&);
struct Command {
std::string name;
CommandCallback function;
std::vector <std::string> help;
};
void InitCommands(App* p_app);
class CommandsSystem {
public:
// variables
std::vector <Command> commands;
// functions
CommandsSystem();
void AddCommand(
std::string name, CommandCallback callback, std::vector <std::string> help
);
void RunCommand(std::string name, std::vector <std::string> arguments);
bool CommandExists(std::string name);
Command GetCommand(std::string name);
};
#endif