Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / samples / net / udp / graph.h
blob53118b1242ac851512d49e66d70cfbe0dc545b51
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef GRAPH_H
18 #define GRAPH_H
20 // comment this define if you don't want 3d output
21 //#define USE_3D
23 #ifdef USE_3D
26 // Includes
29 #include <deque>
30 #include <string>
33 #include <nel/misc/rgba.h>
34 #include <nel/misc/time_nl.h>
36 #include <nel/3d/u_driver.h>
37 #include <nel/3d/u_text_context.h>
40 // External classes
43 class CGraph
45 public:
46 std::string Name;
47 float X, Y, Width, Height;
48 NLMISC::CRGBA BackColor;
49 float MaxValue;
50 float Peak;
52 std::deque<float> Values;
54 NLMISC::TTime Quantum;
56 NLMISC::TTime CurrentQuantumStart;
58 CGraph (std::string name, float x, float y, float width, float height, NLMISC::CRGBA backColor, NLMISC::TTime quantum, float maxValue)
59 : Name(name), X(x), Y(y), Width(width), Height(height), BackColor(backColor), MaxValue(maxValue), Peak(0.0f), Quantum(quantum),
60 CurrentQuantumStart(NLMISC::CTime::getLocalTime())
62 if (_Graphs == NULL)
64 _Graphs = new std::vector<CGraph*>;
67 _Graphs->push_back (this);
70 void addOneValue (float value = 0.0f);
71 void addValue (float value);
73 static void render (NL3D::UDriver &driver, NL3D::UTextContext &tc);
75 static bool Display;
76 static bool DisplayAverageValue;
78 private:
80 static std::vector<CGraph*> *_Graphs;
82 void render (NL3D::UDriver *Driver, NL3D::UTextContext *TextContext);
85 #endif
87 #endif // GRAPH_H
89 /* End of graph.h */