Exemple #1
0
    void display(){
        specificFunction();
        setThresholdBool();
        
        ofSetColor(255);
        ofDrawBitmapString(name, ofVec2f(loc.x, loc.y+size.y+10));
        displayMeter();
        displayThresholdControl();

//        cout << *value << endl;
    }
void VehicleDisplayUtils::updateInfo(hkDemoEnvironment* environment,
									 VehicleDataAndDisplayInfo& vehicleInfo )
{
	char buffer[256];

	//
	// RPM.
	//
	{
		DisplayMeterInfo info;

		hkReal rpm = 0.9f * vehicleInfo.m_lastRPM + 0.1f * vehicleInfo.m_vehicle->calcRPM();
		vehicleInfo.m_lastRPM = rpm;

		info.m_value = rpm;
		info.m_maxValue = 8000.0f;
		info.m_stepSize = 800.0f;
		info.m_scaleColor = 0x8000c0c0;

		info.m_posX = 70;
		info.m_posY = 100;
		info.m_radius = 40;
		info.m_pointerRadius = 30;

		info.m_pointerColor = 0xffffffff;

		displayMeter( environment, info );

		hkString::sprintf(buffer, "rpm %3.0f", vehicleInfo.m_vehicle->calcRPM() );
		environment->m_textDisplay->outputText(buffer, info.m_posX-30, info.m_posY + info.m_radius);

		//
		// Gear.
		//
		{
			hkString::sprintf(buffer, "gear = %i", vehicleInfo.m_vehicle->m_currentGear );
			environment->m_textDisplay->outputText(buffer, info.m_posX-30, info.m_posY + info.m_radius + 16);
		}
	}

	//
	// MPH.
	//
	{ 
		float mph = vehicleInfo.m_vehicle->calcMPH();

		DisplayMeterInfo info;

		info.m_value = mph;
		info.m_maxValue = 180.0f;
		info.m_stepSize = 20.0f;
		info.m_scaleColor = 0x8000c0c0;

		info.m_posX = 270;
		info.m_posY = 100;
		info.m_radius = 40;
		info.m_pointerRadius = 30;

		info.m_pointerColor = 0xffffffff;

		displayMeter( environment, info );

		hkString::sprintf(buffer, "mph %3.0f", mph );
		environment->m_textDisplay->outputText(buffer, info.m_posX-30, info.m_posY + info.m_radius);
	}
}