protected override void OnWindow(int id) { // back GUI.DrawTexture(skinBounds, back); // text double value = GetValue(); if (value == float.NaN) { value = 0; } double scale = NanoGauges.configuration.gaugeScaling; if (value > MAX_VALUE) { value = MAX_VALUE; } if (value < MIN_VALUE) { value = MIN_VALUE; } display.SetValue((int)value); display.Draw((float)(10.0 * scale), (float)(17.0 * scale)); // skin GUI.DrawTexture(skinBounds, skin); }
// draw digital value with n digits (rightbound) private void DrawDigitals() { float scale = (float)NanoGauges.configuration.gaugeScaling; digital1.Draw(31 * scale, 7 * scale); digital2.Draw(31 * scale, 27 * scale); digital3.Draw(31 * scale, 47 * scale); }
protected override void DrawInternalScale() { // analog throttle display float b = GetLowerOffset(); float verticalScaleratio = (float)Configuration.UNSCALED_VERTICAL_GAUGE_HEIGHT / (float)SCALE_HEIGHT; if (FlightInputHandler.state != null) { float throttle = FlightInputHandler.state.mainThrottle; if (throttle < 0) { throttle = 0; } if (throttle > 1) { throttle = 1; } float scaleoffset = b + 300.0f * throttle / (float)SCALE_HEIGHT; // scale this.innerposition.y = scaleoffset; this.innerposition.height = verticalScaleratio; } else { // scale this.innerposition.y = b; this.innerposition.height = verticalScaleratio; } // draw scale GUI.DrawTextureWithTexCoords(gaugeBounds, INNERSCALE, innerposition, true); // digital throttle display float scaling = (float)NanoGauges.configuration.gaugeScaling; throttleDisplay.Draw(0.5f * scaling, GetHeight() - throttleDisplay.GetHeight() - 3.0f * scaling); }