def __init__(self): Screen.__init__(self) self.name = "F18 Hud Screen" # set name for this screen self.ahrs_bg = 0 self.show_debug = False # default off self.show_FPS = ( False ) # show screen refresh rate in frames per second for performance tuning self.line_mode = hud_utils.readConfigInt("HUD", "line_mode", 1) self.alt_box_mode = 1 # default on self.caged_mode = 1 # default on self.line_thickness = hud_utils.readConfigInt("HUD", "line_thickness", 2) self.center_circle_mode = hud_utils.readConfigInt( "HUD", "center_circle", 4) self.ahrs_line_deg = hud_utils.readConfigInt("HUD", "vertical_degrees", 5) print("ahrs_line_deg = %d" % self.ahrs_line_deg) self.MainColor = (0, 255, 0) # main color of hud graphics self.pxy_div = 30 # Y axis number of pixels per degree divisor self.readings = [] # Setup moving averages to smooth a bit self.max_samples = 20 # FPM smoothing self.readings1 = [] # Setup moving averages to smooth a bit self.max_samples1 = 20 # Caged FPM smoothing self.hsi_size = 360 self.roll_point_size = 20
def __init__(self): Screen.__init__(self) self.name = "OnSpeed" # set name for this screen self.ahrs_bg = 0 self.MainColor = (0, 255, 0) # main color self.TextColor = (255, 255, 0) # main color self.pxy_div = 60 # Y axis number of pixels per degree divisor
def __init__(self): Screen.__init__(self) self.name = "Kivic Hud Screen" # set name for this screen self.ahrs_bg = 0 self.show_debug = False # default off self.show_FPS = ( False ) # show screen refresh rate in frames per second for performance tuning self.line_mode = hud_utils.readConfigInt("HUD", "line_mode", 0) self.alt_box_mode = 1 # default on self.line_thickness = hud_utils.readConfigInt("HUD", "line_thickness", 2) self.center_circle_mode = hud_utils.readConfigInt("HUD", "center_circle", 2) self.ahrs_line_deg = hud_utils.readConfigInt("HUD", "vertical_degrees", 10) print("ahrs_line_deg = %d" % self.ahrs_line_deg) self.MainColor = (0, 255, 0) # main color of hud graphics self.pxy_div = 60 # Y axis number of pixels per degree divisor
def initDisplay(self, pygamescreen, width, height): Screen.initDisplay(self, pygamescreen, width, height) # call parent init screen. print("Init Screen: %s %dx%d" % (self.name, self.width, self.height)) self.ahrs_bg = pygame.Surface((self.width * 2, self.height * 2)) self.ahrs_bg_width = self.ahrs_bg.get_width() self.ahrs_bg_height = self.ahrs_bg.get_height() self.ahrs_bg_center = (self.ahrs_bg_width / 2, self.ahrs_bg_height / 2) # fonts self.font = pygame.font.SysFont(None, int( self.height / 20)) # font used by horz lines self.bigfontSize = 350 self.bigfont = pygame.font.SysFont( "monospace", self.bigfontSize ) # font used by debug. initialize font; must be called after 'pygame.init()' to avoid 'Font not Initialized' error self.bigFontPosX = self.widthCenter - (self.bigfontSize / 2) - 15 self.bigFontPosY = self.heightCenter - (self.bigfontSize / 2) + 30
def initDisplay(self, pygamescreen, width, height): Screen.initDisplay( self, pygamescreen, width, height ) # call parent init screen. print("Init ", self.name) print(self.width) print(self.height) self.ahrs_bg = pygame.Surface((self.width * 2, self.height * 2)) self.ahrs_bg_width = self.ahrs_bg.get_width() self.ahrs_bg_height = self.ahrs_bg.get_height() self.ahrs_bg_center = (self.ahrs_bg_width / 2, self.ahrs_bg_height / 2) # images self.arrow = pygame.image.load("lib/screens/_images/arrow_g.png").convert() self.arrow.set_colorkey((255, 255, 255)) self.arrow_scaled = pygame.transform.scale(self.arrow, (50, 50)) # fonts self.font = pygame.font.SysFont( None, int(self.height / 20) ) # font used by horz lines self.myfont = pygame.font.SysFont( "monospace", 22, bold=True ) # font used by debug. initialize font; must be called after 'pygame.init()' to avoid 'Font not Initialized' error self.fontIndicator = pygame.font.SysFont( "monospace", 40, bold=True ) # ie IAS and ALT self.fontIndicatorSmaller = pygame.font.SysFont( "monospace", 30, bold=True ) # ie. baro and VSI self.fontsmallest = pygame.font.SysFont("monospace", 16, bold=True) # units # set up the HSI _hsi.hsi_init( self, 350, # HSI size 20, # Gnd Trk Tick size (255, 0, 0), # HSI rose color (255, 255, 255), # HSI label color )
def initDisplay(self, pygamescreen, width, height): Screen.initDisplay(self, pygamescreen, width, height) # call parent init screen. print("Init Screen: %s %dx%d" % (self.name, self.width, self.height)) self.ahrs_bg = pygame.Surface((self.width * 2, self.height * 2)) self.ahrs_bg_width = self.ahrs_bg.get_width() self.ahrs_bg_height = self.ahrs_bg.get_height() self.ahrs_bg_center = (self.ahrs_bg_width / 2, self.ahrs_bg_height / 2) # fonts self.font = pygame.font.SysFont(None, int( self.height / 10)) # font used by horz lines self.myfont = pygame.font.SysFont( "monospace", int(self.height / 10) ) # font used by debug. initialize font; must be called after 'pygame.init()' to avoid 'Font not Initialized' error self.fontIndicator = pygame.font.SysFont("monospace", int(self.height / 10)) # ie IAS and ALT self.fontIndicatorSmaller = pygame.font.SysFont( "monospace", int(self.height / 20)) # ie. baro and VSI
def initDisplay(self, pygamescreen, width, height): Screen.initDisplay(self, pygamescreen, width, height) # call parent init screen. print("Init ", self.name) print(self.width) print(self.height) def roint(num): return int(round(num)) self.ahrs_bg = pygame.Surface((self.width * 2, self.height * 2)) self.ahrs_bg_width = self.ahrs_bg.get_width() self.ahrs_bg_height = self.ahrs_bg.get_height() self.ahrs_bg_center = (self.ahrs_bg_width / 2 + 160, self.ahrs_bg_height / 2) self.mask = pygame.Surface((100, self.height)) self.mask.fill((0, 0, 0)) self.mask1 = pygame.Surface((122, 80)) self.mask1.fill((0, 0, 0)) self.mask2 = pygame.Surface((125, 80)) self.mask2.fill((0, 0, 0)) self.mask3 = pygame.Surface((92, 40)) self.mask3.fill((0, 0, 0)) # images self.arrow = pygame.image.load( "lib/screens/_images/arrow_g.png").convert() self.arrow.set_colorkey((255, 255, 255)) self.arrow_scaled = pygame.transform.scale(self.arrow, (50, 50)) self.roll_point = pygame.image.load( "lib/screens/_images/tick_w.png").convert() self.roll_point.set_colorkey((0, 0, 0)) self.roll_point_scaled = pygame.transform.scale( self.roll_point, (self.roll_point_size, self.roll_point_size)) self.roll_point_scaled_rect = self.roll_point_scaled.get_rect() # fonts self.font = pygame.font.SysFont(None, int( self.height / 20)) # font used by horz lines self.myfont = pygame.font.SysFont( "monospace", 22, bold=True ) # font used by debug. initialize font; must be called after 'pygame.init()' to avoid 'Font not Initialized' error self.fontIndicator = pygame.font.SysFont("monospace", 40, bold=True) # ie IAS and ALT self.fontIndicatorSmaller = pygame.font.SysFont( "monospace", 30, bold=True) # ie. baro and VSI self.fontsmallest = pygame.font.SysFont("monospace", 16, bold=True) # units # set up the HDG _hdg.hdg_init( self, 350, # hdg size 20, # Gnd Trk Tick size (0, 255, 0), # hdg rose color (255, 255, 0), # hdg label color ) # set up the roll indicator self.roll_tick = pygame.Surface((self.hsi_size, self.hsi_size), pygame.SRCALPHA) self.roll_point = pygame.Surface((self.hsi_size, self.hsi_size), pygame.SRCALPHA) self.roll_point.blit( self.roll_point_scaled, ( (self.hsi_size / 2) - self.roll_point_scaled_rect.center[0], (self.hsi_size / 2) + 120 - self.roll_point_scaled_rect[1], ), ) for big_tick in range(6, 13): cos = math.cos(math.radians(360.0 / 36 * big_tick)) sin = math.sin(math.radians(360.0 / 36 * big_tick)) x0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * cos * 6) y0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * sin * 6) x1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * cos) y1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * sin) pygame.draw.line(self.roll_tick, (255, 255, 255), [x0, y0], [x1, y1], 4) for big_tick in range(12, 25): cos = math.cos(math.radians(360.0 / 72 * big_tick)) sin = math.sin(math.radians(360.0 / 72 * big_tick)) x0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * cos * 6) y0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * sin * 6) x1 = roint(self.hsi_size / 2 + self.hsi_size / 2.3 * cos) y1 = roint(self.hsi_size / 2 + self.hsi_size / 2.3 * sin) pygame.draw.line(self.roll_tick, (255, 255, 255), [x0, y0], [x1, y1], 4) for big_tick in range(1, 4): cos = math.cos(math.radians(360.0 / 8 * big_tick)) sin = math.sin(math.radians(360.0 / 8 * big_tick)) x0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * cos * 6) y0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * sin * 6) x1 = roint(self.hsi_size / 2 + self.hsi_size / 2.3 * cos) y1 = roint(self.hsi_size / 2 + self.hsi_size / 2.3 * sin) pygame.draw.line(self.roll_tick, (255, 255, 255), [x0, y0], [x1, y1], 4) for big_tick in range(3, 4): cos = math.cos(math.radians(360.0 / 36 * big_tick)) sin = math.sin(math.radians(360.0 / 36 * big_tick)) x0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * cos * 6) y0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * sin * 6) x1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * cos) y1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * sin) pygame.draw.line(self.roll_tick, (255, 255, 255), [x0, y0], [x1, y1], 4) for big_tick in range(15, 16): cos = math.cos(math.radians(360.0 / 36 * big_tick)) sin = math.sin(math.radians(360.0 / 36 * big_tick)) x0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * cos * 6) y0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * sin * 6) x1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * cos) y1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * sin) pygame.draw.line(self.roll_tick, (255, 255, 255), [x0, y0], [x1, y1], 4) for big_tick in range(1, 2): cos = math.cos(math.radians(360.0 / 4 * big_tick)) sin = math.sin(math.radians(360.0 / 4 * big_tick)) x0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * cos * 4.5) y0 = roint(self.hsi_size / 2 + self.hsi_size / 15 * sin * 4.5) x1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * cos) y1 = roint(self.hsi_size / 2 + self.hsi_size / 2.1 * sin) pygame.draw.line(self.roll_tick, (255, 255, 255), [x0, y0], [x1, y1], 2)