summaryrefslogtreecommitdiffstats
path: root/src/client/clui/clui.hpp
blob: 87445db7f280e311a5c401940d750494ed41c29c (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// CLUI - Command Line User Interface

#ifndef WC_CLUI_H
#define WC_CLUI_H

#include "WindowInterface.hpp"
#include "../../const_vars.hpp"

class WindowChat : public WindowInterface {
	struct message {
		char text[max_msg_len];
		int num_lines; // number of lines
		int type;
		message *prev;
	};
	message *first;
public:
	WindowChat(int num_y, int num_x, int by, int bx, char ch)
		: WindowInterface(num_y, num_x, by, bx, ch), first(0) {}
	~WindowChat();

	void AddMessage(const char *msg, int type);
private:
	void ChatRedraw();
	void PrintMessage(int line, message *m);
};

class WindowPlayers : public WindowInterface {
public:
	WindowPlayers(int num_y, int num_x, int by, int bx, char ch)
		: WindowInterface(num_y, num_x, by, bx, ch) {}
	~WindowPlayers() {}
};

class WindowTips : public WindowInterface {
public:
	WindowTips(int num_y, int num_x, int by, int bx, char ch)
		: WindowInterface(num_y, num_x, by, bx, ch) {}
	~WindowTips() {}
};

class WindowInput : public WindowInterface {
	int i_ny, i_nx;
public:
	WindowInput(int num_y, int num_x, int by, int bx, char ch);
	~WindowInput() {}

	int GetChar();
	bool AddCharToSendMsg(char ch);
	bool RemoveCharFromMsg();
	void SetPosCursor(int y, int x);
};

#endif