def __init__(self, gamelogic): self.gamelogic = gamelogic rs = gamelogic.radar_surface self.fontobj = U.get_fontobj_by_text_width(S.MAIN_FONT, 'X' * (self.TEXT_W + 1), rs.get_size()) # tmp = rint(rs.get_width()/(self.TEXT_W + 2)) tmp = (rs.get_width() - self.fontobj.size('X' * self.TEXT_W)[0]) / 2 self.text_blit_position = (tmp, tmp) self.good_radar_image = None
def _update_statusbar(self, start_over=False): ''' Update the statusbar information ''' if start_over: self.match_start_time = time() assert self.match_start_time self.statusbar_surface.fill(S.GRAY) bits = [] bits.append(" Radar range: %sm" % S.RADAR_RANGE) bits.append("Radar markings: %sm" % S.RADAR_MARKING) bits.append("Elapsed time: %s " % strftime("%H:%M:%S", gmtime(time() - self.match_start_time))) text = ' '.join(bits) fontobj = U.get_fontobj_by_text_width(S.MAIN_FONT, text, (S.STATUSBAR_RECT.w, S.STATUSBAR_RECT.h-2)) text = fontobj.render(text, True, S.WHITE) self.statusbar_surface.blit(text, (0, S.STATUSBAR_RECT.h - fontobj.get_height() - 1))