OpenTTD Source  12.0-beta2
console_func.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef CONSOLE_FUNC_H
11 #define CONSOLE_FUNC_H
12 
13 #include "console_type.h"
14 #include "3rdparty/fmt/format.h"
15 
16 /* console modes */
17 extern IConsoleModes _iconsole_mode;
18 
19 /* console functions */
20 void IConsoleInit();
21 void IConsoleFree();
22 void IConsoleClose();
23 
24 /* console output */
25 void IConsolePrint(TextColour colour_code, const std::string &string);
26 
41 template <typename T, typename A, typename ... Args>
42 static inline void IConsolePrint(TextColour colour_code, const T &format, A first_arg, Args&&... other_args)
43 {
44  /* The separate first_arg argument is added to aid overloading.
45  * Otherwise the calls that do no need formatting will still use this function. */
46  IConsolePrint(colour_code, fmt::format(format, first_arg, other_args...));
47 }
48 
49 /* Parser */
50 void IConsoleCmdExec(const char *cmdstr, const uint recurse_count = 0);
51 
53 
54 #endif /* CONSOLE_FUNC_H */
TextColour
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Definition: gfx_type.h:250
IConsoleModes
IConsoleModes
Modes of the in-game console.
Definition: console_type.h:16
console_type.h
IConsolePrint
void IConsolePrint(TextColour colour_code, const std::string &string)
Handle the printing of text entered into the console or redirected there by any other means.
Definition: console.cpp:94
IsValidConsoleColour
bool IsValidConsoleColour(TextColour c)
Check whether the given TextColour is valid for console usage.
Definition: console_gui.cpp:524
IConsoleCmdExec
void IConsoleCmdExec(const char *cmdstr, const uint recurse_count=0)
Execute a given command passed to us.
Definition: console.cpp:302
IConsoleClose
void IConsoleClose()
Close the in-game console.
Definition: console_gui.cpp:454