-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper_functions.h
More file actions
117 lines (79 loc) · 2.3 KB
/
helper_functions.h
File metadata and controls
117 lines (79 loc) · 2.3 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* @file helper_functions.h
* @author Thomas R. Carrel
*
* @brief Exports helper functions.
*
*/
#include<fstream>
using std::istream;
#include<string>
using std::string;
#include "shaders.h"
//Data manipulation.
#ifdef GLM_INCLUDED
extern glm::vec4 to_vec_color( uint32_t );
#endif
extern string numtoa( const uint32_t& );
extern void skip_whitespace( istream& );
//Other
extern SHADER_TYPE_NAME* get_shdr( const string& );
extern string shader_filename_to_struct_name( const string& );
//extern int get_bits( const float& );
extern void check_SOIL_error( unsigned char*, const string& );
extern float get_refractive_index( const string& );
extern float get_refraction_ratio( const string&, const string& );
//Text formatting
#ifndef __TEXT_FORMATTING_HELPER_FUNCTIONS__
# define __TEXT_FORMATTING_HELPER_FUNCTIONS__
// These are defined here so they can be used inline linkage.
/** Return the provided text in bright red.
* @param text The text to be changed.
*/
inline string bright_red( const string& text )
{
return "\033[1;31m" + text + "\033[0m";
}
/** Return the provided text in red.
* @param text The text to be changed.
*/
inline string red( const string& text )
{
return "\033[0;31m" + text + "\033[0m";
}
/** Return the provided text in bright green.
* @param text The text to be changed.
*/
inline string bright_green( const string& text )
{
return "\033[1;32m" + text + "\033[0m";
}
/** Return the provided text in green.
* @param text The text to be changed.
*/
inline string green( const string& text )
{
return "\033[0;32m" + text + "\033[0m";
}
/** Return the provided text in bright cyan.
* @param text The text to be changed.
*/
inline string bright_cyan( const string& text )
{
return "\033[1;36m" + text + "\033[0m";
}
/** Return the provided text in cyan.
* @param text The text to be changed.
*/
inline string cyan( const string& text )
{
return "\033[0;36m" + text + "\033[0m";
}
/** Return the provided text in bold.
* @param text The text to be changed.
*/
inline string bold( const string& text )
{
return "\033[1m" + text + "\033[0m";
}
#endif /*__TEXT_FORMATTING_HELPER_FUNCTIONS__*/