#include <cGauges.h>
Public Member Functions | |
virtual | ~NeedleGauge () |
Protected Member Functions | |
virtual void | RenderGraph (float min, float max, float val, float factor, tValue::Base const &val_s) |
Do- nothing destructor. |
Definition at line 64 of file cGauges.h.
virtual cWidget::NeedleGauge::~NeedleGauge | ( | ) | [inline, virtual] |
void cWidget::NeedleGauge::RenderGraph | ( | float | min, | |
float | max, | |||
float | val, | |||
float | factor, | |||
tValue::Base const & | val_s | |||
) | [protected, virtual] |
Do- nothing destructor.
Renders the needle and current value (if enabled)
Reimplemented from cWidget::BarGauge.
Definition at line 186 of file cGauges.cpp.
References a, BeginLines(), cos(), DisplayText(), rGradient::DrawAt(), vValue::Expr::Core::Base::GetString(), cWidget::WithAngles::m_angle_max, cWidget::WithAngles::m_angle_min, cWidget::WithForeground::m_foreground, cWidget::WithCoordinates::m_position, cWidget::WithReverse::m_reverse, cWidget::WithShowSettings::m_showvalue, cWidget::WithCoordinates::m_size, RenderEnd(), rGradient::SetValue(), sin(), sr_fontCockpit, sr_glOut, Vertex(), tCoord::x, x, and tCoord::y.
00186 { 00187 float x, y; 00188 float t = m_reverse ? (val - max) / (min - max) : (val - min) / (max - min); 00189 float a = m_angle_min * (1 - t) + m_angle_max * t; 00190 x= cos(a); 00191 y= sin(a); 00192 00193 /* Draws an ugly background on the gauge 00194 BeginQuads(); 00195 Color(1.,1.,1.,.8); 00196 Vertex(m_position.x-m_size-.04,m_position.y-.04,0); 00197 Vertex(m_position.x-m_size-.04,m_position.y+m_size+.04,0); 00198 Vertex(m_position.x+m_size+.04,m_position.y+m_size+.04,0); 00199 Vertex(m_position.x+m_size+.04,m_position.y-.04,0); 00200 00201 Color(.1,.1,.1,.8); 00202 Vertex(m_position.x-m_size-.02,m_position.y-.02,0); 00203 Vertex(m_position.x-m_size-.02,m_position.y+m_size+.02,0); 00204 Vertex(m_position.x+m_size+.02,m_position.y+m_size+.02,0); 00205 Vertex(m_position.x+m_size+.02,m_position.y-.02,0); 00206 00207 RenderEnd();*/ 00208 00209 BeginLines(); 00210 m_foreground.SetValue((factor * ((val-min)/(max-min)*2. - 1.)+1.)/2.); 00211 m_foreground.DrawAt(tCoord(0.,0.)); 00212 Vertex(-.1*x*m_size.x+m_position.x,.1*y*m_size.y+m_position.y,0); 00213 Vertex(-x*m_size.x+m_position.x,y*m_size.y+m_position.y,0); 00214 RenderEnd(); 00215 00216 if(m_showvalue) 00217 DisplayText( -x*1.45*m_size.x+m_position.x, y*1.35*m_size.y+m_position.y, 00218 .2*m_size.x, 00219 val_s.GetString().c_str(), 00220 sr_fontCockpit); 00221 if (!sr_glOut) 00222 return; 00223 }