Esempio n. 1
0
def translate(surface: pg.surface, pos: tuple):
    temp_surf = surface.copy()
    surface.fill((0, 0, 0))

    rect = temp_surf.get_rect()

    surface.blit(temp_surf, pos)

    return pos
Esempio n. 2
0
 def draw(self, surface: pygame.surface):
     """
     Draw a track png
     :param surface: Pygame surface to which track png should be drawn
     """
     surface.fill((65, 105, 225))
     # surface.blit(self.track, (SCREEN_WIDTH//2 - car.car_state.position.x, SCREEN_HEIGHT//2 - car.car_state.position.y))
     surface.blit(self.track_image, (0, 0))
     if self.surface_waypoints is not None:
         surface.blit(self.surface_waypoints, (0, 0))
Esempio n. 3
0
 def draw(self, surface: pygame.surface):
     """
     Draw a track png
     :param surface: Pygame surface to which track png should be drawn
     """
     surface.fill((65, 105, 225))
     # surface.blit(self.track, (SCREEN_WIDTH//2 - car.car_state.position.x, SCREEN_HEIGHT//2 - car.car_state.position.y))
     surface.blit(self.track_image, (0, 0))
     if self.surface_waypoints is not None:
         surface.blit(self.surface_waypoints, (0, 0))
     if self.game_font is None:
         try:
             self.game_font = pygame.freetype.SysFont(
                 GAME_FONT_NAME, GAME_FONT_SIZE)
         except:
             logger.warning(
                 'cannot get specified globals.py font {}, using pygame default font'
                 .format(GAME_FONT_NAME))
             self.game_font = pygame.freetype.SysFont(
                 pygame.font.get_default_font(), GAME_FONT_SIZE)
     self.game_font.render_to(surface, (0, 0 + GAME_FONT_SIZE), self.name,
                              (255, 255, 255)),