def updateHUD(self, x, y, pDeg, vMag, vDeg, aMag, aDeg, components, fps): """ Update the values that are displayed on the screen, then draw the text to the screen **Preconditions**: None. **Postconditions**: None. **Returns**: None. """ self._xPosition = x self._yPosition = y self._positionDegree = pDeg self._velocityMag = vMag self._velocityDegree = vDeg self._accelerationMag = aMag self._accelerationDegree = aDeg self.thrusters = filter(lambda c: isinstance(c, Thruster), components) self.SASmodules = filter(lambda c: isinstance(c, SAS), components) graph.drawText( (10, 10), "X Position: " + str("{:10.4f}".format(self._xPosition)) + " m", self._font, (255, 0, 0)) graph.drawText( (10, 30), "Y Position: " + str("{:10.4f}".format(self._yPosition)) + " m", self._font, (255, 0, 0)) graph.drawText( (10, 50), "Nose Degree: " + str("{:10.4f}".format(self._positionDegree)) + " degrees", self._font, (255, 0, 0)) graph.drawText((10, 70), "Velocity Magnitude: " + str("{:10.4f}".format(self._velocityMag)) + " m/s", self._font, (255, 0, 0)) graph.drawText( (10, 90), "Velocity Degree: " + str("{:10.4f}".format(self._velocityDegree)) + " degrees", self._font, (255, 0, 0)) graph.drawText( (10, 110), "Acceleration Magnitude: " + str("{:10.4f}".format(self._accelerationMag)) + " m/s^2", self._font, (255, 0, 0)) graph.drawText( (10, 130), "Acceleration Degree: " + str("{:10.4f}".format(self._accelerationDegree)) + " degrees", self._font, (255, 0, 0)) numThruster = 0 for thruster in self.thrusters: numThruster = numThruster + 1 graph.drawText( (10, 130 + numThruster * 20), "Thruster Module " + str(numThruster) + " Fuel Remaining: " + str("{:10.0f}".format(thruster.fuel)) + " Liters", self._font, (255, 0, 0)) numSAS = 0 for sas in self.SASmodules: numSAS = numSAS + 1 graph.drawText((10, 130 + numThruster * 20 + numSAS * 20), "SAS Module " + str(numSAS) + " Fuel Remaining: " + str("{:10.0f}".format(sas.fuel)) + " Liters", self._font, (255, 0, 0)) graph.drawText((10, 150 + numThruster * 20 + numSAS * 20), "FPS: " + "{:0.3f}".format(fps), self._font, (255, 0, 0))