def __init__(self, renderer, highscores=None):
    Menu.bg_offset_at_start = 250
    Menu.bg_offset = Menu.bg_offset_at_start
    Menu.bg_dimness_peak = 136
    Menu.bg_dimness_current = 255
    Menu.bg_diminish_rate = 0.33
    self.choice = None
    self.is_open = True
    self.title = hud.Text('pyNoid', renderer, Constants.TITLE_FONT_SIZE)
    self.title.position = vec2(50, 50)
    self.credits = hud.Text('Kacper Tonia 2017/18', renderer, Constants.TINY_FONT_SIZE)
    self.credits.position = (self.title.position + vec2((self.title.size[0] // 2), self.title.size[1]))
    grey = Colour.greyscale(0.75)
    sub1 = hud.Button.buildClickableText('New Game', renderer, Colour.White, grey, grey, Constants.MENU_FONT_SIZE)
    sub2 = hud.Button.buildClickableText('Exit', renderer, Colour.White, grey, grey, Constants.MENU_FONT_SIZE)
    self.menu = hud.VerticalContainer([sub1, sub2], (Constants.WINDOW_SIZE.y // 2))
    if highscores:
        leaderboard = []
        player_name_length = max([len(x[0]) for x in highscores])
        score_length = max([len(str(x[1])) for x in highscores])
        s_format = ('{:>%d} {}{}' % player_name_length)
        for (idx, item) in enumerate(highscores):
            leaderboard.append(hud.Text(s_format.format(item[0], item[1], (' ' * (score_length - len(str(item[1]))))), renderer, Constants.FONT_SIZE_1, Colour.greyscale(((5 - idx) / 5.0))))
        self.render_content = hud.VerticalContainer(leaderboard, ((Constants.WINDOW_SIZE.y * 3) // 4))
    else:
        self.render_content = []
def __init__(self, renderer, highscores=None):
    Menu.bg_offset_at_start = 250
    Menu.bg_offset = Menu.bg_offset_at_start
    Menu.bg_dimness_peak = 136
    Menu.bg_dimness_current = 255
    Menu.bg_diminish_rate = 0.33
    self.choice = None
    self.is_open = True
    self.title = hud.Text('pyNoid', renderer, Constants.TITLE_FONT_SIZE)
    self.title.position = vec2(50, 50)
    self.credits = hud.Text('Kacper Tonia 2017/18', renderer, Constants.TINY_FONT_SIZE)
    self.credits.position = (self.title.position + vec2((self.title.size[0] // 2), self.title.size[1]))
    grey = Colour.greyscale(0.75)
    sub1 = hud.Button.buildClickableText('New Game', renderer, Colour.White, grey, grey, Constants.MENU_FONT_SIZE)
    sub2 = hud.Button.buildClickableText('Exit', renderer, Colour.White, grey, grey, Constants.MENU_FONT_SIZE)
    self.menu = hud.VerticalContainer([sub1, sub2], (Constants.WINDOW_SIZE.y // 2))
    if highscores:
        leaderboard = []
        player_name_length = max([len(x[0]) for x in highscores])
        score_length = max([len(str(x[1])) for x in highscores])
        s_format = ('{:>%d} {}{}' % player_name_length)
        for (idx, item) in enumerate(highscores):
            leaderboard.append(hud.Text(s_format.format(item[0], item[1], (' ' * (score_length - len(str(item[1]))))), renderer, Constants.FONT_SIZE_1, Colour.greyscale(((5 - idx) / 5.0))))
        self.render_content = hud.VerticalContainer(leaderboard, ((Constants.WINDOW_SIZE.y * 3) // 4))
    else:
        self.render_content = []