-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsole.h
100 lines (63 loc) · 2.1 KB
/
console.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* Copyright (c) 2012 Cheese and Bacon Games, LLC */
/* This file is licensed under the MIT License. */
/* See the file docs/LICENSE.txt for the full license text. */
#ifndef console_h
#define console_h
#include "information.h"
#include "timer.h"
class Console{
public:
//If true, this is a chat box.
//If false, it is the main console.
bool chat;
Information info_display;
Information info_input;
int y;
bool on;
std::string last_tab_complete_command;
//0 or below means instant.
int move_speed;
int max_command_length;
//The maximum lines to recall in the console log.
int max_log_recall;
//The maximum number of commands to recall.
int max_command_recall;
//The last command strings entered.
std::vector<std::string> recalled_command_strings;
//The currently recalled string.
//Used for scrolling around in the recalled strings.
int current_recalled_command_string;
std::string font;
std::string font_color;
double background_opacity;
std::vector<std::string> commands;
//The time it takes for a chat line to disappear, in milliseconds.
int line_timeout;
//Used to determine if a chat message should be showed even if the chat window is closed.
std::vector<Timer> text_timers;
Console();
void setup(bool get_chat);
void reset_current_recalled_command_string();
void reset_text_timers();
void clear_text();
void toggle_on();
void add_text(std::string text);
void send_chat();
void move();
void recall_up();
void recall_down();
void tab_complete();
void handle_input_states();
//Returns true if the event was consumed,
//false otherwise.
bool handle_input_events();
void animate();
void render();
void setup_commands();
std::vector<std::string> parse_input(std::string str_input);
//Pass an option to check for and an options string from parsed input data.
//Returns whether or not the option is in the options list.
bool input_has_option(std::string option,std::string options);
void do_command();
};
#endif