Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / client / src / graph.h
blobc9a87863ab64e6cc3bf0de32feb78ea62c0301cb
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
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/>.
19 #ifndef GRAPH_H
20 #define GRAPH_H
22 #include "nel/misc/types_nl.h"
24 #include <nel/misc/rgba.h>
25 #include <nel/misc/time_nl.h>
27 #include <deque>
28 #include <string>
30 #include "time_client.h"
32 namespace NL3D
34 class UDriver;
35 class UTextContext;
39 /**
40 * Graph class for network statistics
41 * \author Vianney Lecroart, Olivier Cado
42 * \author Nevrax France
43 * \date 2002
45 class CGraph
47 public:
48 std::string Name;
49 float X, Y, Width, Height;
50 NLMISC::CRGBA BackColor;
51 float MaxValue;
52 float Peak;
53 bool LineMode;
54 float PrevY;
55 uint Page;
57 std::deque<float> Values;
59 NLMISC::TTime Quantum;
61 NLMISC::TTime CurrentQuantumStart;
63 /// Init driver and text context
64 static void init (NL3D::UDriver *driver)
66 _Driver = driver;
69 /// Render all available graph
70 static void render (uint page);
72 /// release material
73 virtual ~CGraph()
75 if (_Graphs != NULL)
77 for (uint i = 0; i < _Graphs->size(); i++)
79 if ((*_Graphs)[i] == this)
81 _Graphs->erase (_Graphs->begin()+i);
82 break;
89 /// Constructor (CGraph::init() must have been called before)
90 CGraph (std::string name,
91 float x, float y, float width, float height,
92 NLMISC::CRGBA backColor,
93 NLMISC::TTime quantum,
94 float maxValue, uint page,
95 bool lineMode = false)
96 : Name(name), X(x), Y(y), Width(width), Height(height), BackColor(backColor), MaxValue(maxValue),
97 Peak(0.0f), LineMode(lineMode), PrevY(y), Page(page), Quantum(quantum), CurrentQuantumStart(ryzomGetLocalTime ())
99 if (_Graphs == NULL)
101 _Graphs = new std::vector<CGraph*>;
104 _Graphs->push_back (this);
107 /// Add one value
108 void addOneValue (float value = 0.0f);
110 /// Add value
111 void addValue (float value);
113 static bool DisplayAverageValue;
114 static bool Display;
116 private:
118 /// Render a specific graph
119 void renderGraph ();
121 static NL3D::UDriver *_Driver;
123 static std::vector<CGraph*> *_Graphs;
128 * Graph relative to a particular entity
130 class CSlotGraph : public CGraph
132 public:
134 /// Constructor
135 CSlotGraph( std::string name,
136 float x, float y, float width, float height,
137 NLMISC::CRGBA backColor,
138 NLMISC::TTime quantum,
139 float maxValue,
140 bool lineMode,
141 uint8 slot )
142 : CGraph( name, x, y, width, height, backColor, quantum, maxValue, lineMode ), _Slot( slot )
145 /// Add one value only for the stored slot
146 void addOneValue( uint8 slot, float value )
148 if ( slot == _Slot )
150 CGraph::addOneValue( value );
154 private:
156 uint8 _Slot;
159 #endif // GRAPH_H
161 /* End of graph.h */