import pygame
from loguru import logger

from somegame.osd import OSD


class FpsOSD(OSD):
    def __init__(self, game):
        super().__init__(game)
        logger.info('Loading font')
        self.font = pygame.font.Font(pygame.font.get_default_font(), 32)

    def draw(self, surface):
        fps = self.game.get_average_fps()
        fps_text = '<unknown>' if fps is None else '{:.1f}'.format(fps)
        tmp_surf = self.font.render('{} FPS'.format(fps_text), True, (255, 255, 255))
        surface.blit(tmp_surf, (0, 0))

[((10, 8, 10, 35), 'loguru.logger.info', 'logger.info', ({(10, 20, 10, 34): '"""Loading font"""'}, {}), "('Loading font')", False, 'from loguru import logger\n'), ((11, 37, 11, 67), 'pygame.font.get_default_font', 'pygame.font.get_default_font', ({}, {}), '()', False, 'import pygame\n')]