-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.h
126 lines (101 loc) · 4.06 KB
/
common.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* --------------------------------------------------------------------
EXTREME TUXRACER
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
Copyright (C) 2010 Extreme Tuxracer Team
This program 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; either version 2
of the License, or (at your option) any later version.
This program 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. See the
GNU General Public License for more details.
---------------------------------------------------------------------*/
#ifndef COMMON_H
#define COMMON_H
#include "bh.h"
using namespace std;
// --------------------------------------------------------------------
// color utils
// --------------------------------------------------------------------
extern const TColor colWhite;
extern const TColor colDYell;
extern const TColor colDDYell;
extern const TColor colYellow;
extern const TColor colLYell;
extern const TColor colOrange;
extern const TColor colLRed;
extern const TColor colRed;
extern const TColor colDRed;
extern const TColor colGrey;
extern const TColor colLGrey;
extern const TColor colDGrey;
extern const TColor colBlack;
extern const TColor colBlue;
extern const TColor colLBlue;
extern const TColor colDBlue;
extern const TColor colBackgr;
extern const TColor colDBackgr;
extern const TColor colDDBackgr;
extern const TColor colMBackgr;
extern const TColor colLBackgr;
extern const TColor colMess;
extern const TColor colSky;
TColor MakeColor (double r, double g, double b, double a);
TColor3 MakeColor3 (double r, double g, double b);
// --------------------------------------------------------------------
// print utils
// --------------------------------------------------------------------
// some simple functions to print out values on the
// terminal. Only used for development.
void PrintInt (const int val);
void PrintInt (string s, const int val);
void PrintStr (const char *val);
void PrintString (string s);
void PrintFloat (const float val);
void PrintDouble (const double val);
void PrintFloat8 (const float val);
void PrintFloat (char *s, const float val);
void PrintBool (const bool val);
void PrintPointer (void *p);
void PrintVector (const TVector3 v);
void PrintVector4 (const TVector4 v);
void PrintColor (const TColor);
void PrintVector2 (const TVector2 v);
void PrintVector (char *s, const TVector3 v);
void PrintMatrix (TMatrix mat);
void PrintMatrixGL (TMatrixGL glmat);
void PrintQuaternion (TQuaternion q);
void PrintIndex3 (TIndex3 idx);
void PrintIndex4 (TIndex4 idx);
// --------------------------------------------------------------------
// file utils
// --------------------------------------------------------------------
bool FileExists (const char *filename);
bool FileExists (const string filename);
bool FileExists (const string dir, const string filename);
bool DirExists (const char *dirname);
// the following functions should work on Windows, too
// though they are not particularly for Window
bool FileExistsWin (const char *filename);
bool DirExistsWin (const char *dirname);
// --------------------------------------------------------------------
// message utils
// --------------------------------------------------------------------
void Message (const char *msg, const char *desc);
void Message (const char *msg);
void MessageN (string a, string b);
void SaveMessages ();
// --------------------------------------------------------------------
// date and time
// --------------------------------------------------------------------
void GetTimeComponents (double time, int *min, int *sec, int *hundr);
void GetTestTime ();
string GetTimeString1 ();
unsigned short read_word (FILE *fp);
unsigned int read_dword (FILE *fp);
int read_long (FILE *fp);
int write_word (FILE *fp, unsigned short w);
int write_dword (FILE *fp, unsigned int dw);
int write_long (FILE *fp, int l);
#endif