def set_song(self, song): c1 = [255, 255, 255] self._bpmdisplay.set_song(song) self._next_update = -2 # Magic value song.render() self._title = fontfx.shadow( song.info["title"], FontTheme.font('BannerDisp_title', song.info["title"], 340), c1) self._r_t = self._title.get_rect() self._r_t.center = [179, 240] self._artist = fontfx.shadow( song.info["artist"], FontTheme.font('BannerDisp_artist', song.info["artist"], 250), c1) self._r_a = self._artist.get_rect() self._r_a.center = [179, 320] if song.info["subtitle"]: self._subtitle = fontfx.shadow( song.info["subtitle"], FontTheme.font('BannerDisp_subtitle', song.info["subtitle"], 300), c1) self._r_s = self._subtitle.get_rect() self._r_s.center = [179, 270] else: self._subtitle = None self._clip = song.clip self._banner = song.banner self._r_b = self._banner.get_rect() self._r_b.center = [179, 100] self._cdtitle = song.cdtitle self._r_cd = self._cdtitle.get_rect() self._r_cd.center = [290, 180]
def set_song(self, song): c1 = [255, 255, 255] self._bpmdisplay.set_song(song) self._next_update = -2 # Magic value song.render() self._title = fontfx.shadow(song.info["title"], FontTheme.font("BannerDisp_title", song.info["title"], 340), c1) self._r_t = self._title.get_rect() self._r_t.center = [179, 240] self._artist = fontfx.shadow( song.info["artist"], FontTheme.font("BannerDisp_artist", song.info["artist"], 250), c1 ) self._r_a = self._artist.get_rect() self._r_a.center = [179, 320] if song.info["subtitle"]: self._subtitle = fontfx.shadow( song.info["subtitle"], FontTheme.font("BannerDisp_subtitle", song.info["subtitle"], 300), c1 ) self._r_s = self._subtitle.get_rect() self._r_s.center = [179, 270] else: self._subtitle = None self._clip = song.clip self._banner = song.banner self._r_b = self._banner.get_rect() self._r_b.center = [179, 100] self._cdtitle = song.cdtitle self._r_cd = self._cdtitle.get_rect() self._r_cd.center = [290, 180]
def do(screen, songdata): onoff_opt = { ui.START: switch_onoff, ui.CONFIRM: switch_onoff, menus.CREATE: get_onoff, ui.LEFT: off_onoff, ui.RIGHT: on_onoff } offon_opt = { ui.START: switch_offon, ui.START: switch_offon, menus.CREATE: get_offon, ui.LEFT: off_offon, ui.RIGHT: on_offon } rotate_opt = { ui.START: switch_rotate, ui.CONFIRM: switch_rotate, ui.LEFT: switch_rotate_back, ui.RIGHT: switch_rotate, menus.CREATE: get_rotate } rotate_index_opt = { ui.START: switch_rotate_index, ui.CONFIRM: switch_rotate_index, ui.LEFT: switch_rotate_index_back, ui.RIGHT: switch_rotate_index, menus.CREATE: get_rotate_index } tuple_opt = { ui.START: switch_tuple, ui.CONFIRM: switch_tuple, ui.LEFT: switch_tuple_back, ui.RIGHT: switch_tuple, menus.CREATE: get_tuple } sprites = pygame.sprite.RenderUpdates() try: lines = file(os.path.join(pydance_path, "CREDITS")).read().split("\n") lines = [l.decode("utf-8") for l in lines] Credits([_("pydance %s") % VERSION] + lines).add(sprites) except: Credits([_("pydance %s") % VERSION, "http://icculus.org/pyddr", _("By Joe Wreschnig, Brendan Becker, & Pavel Krivitsky"), _("(Your CREDITS file is missing.)"), ]).add(sprites) m = ([_("Play Game"), {ui.START: wrap_ctr, ui.CONFIRM: wrap_ctr}, (GameSelect, songdata)], [_("Map Keys"), {ui.START: wrap_ctr, ui.CONFIRM: wrap_ctr}, (pad.PadConfig, (screen,))], (_("Game Options"), [_("Autofail"), onoff_opt, (_("autofail"),)], [_("Assist Mode"), tuple_opt, (_("assist"), [(0, _("Off")), (1, _("Click")), (2, _("Full"))])], [_("Announcer"), rotate_opt, ('djtheme', Announcer.themes())], (_("Themes ..."), [_("4 Panel"), rotate_opt, ("4p-theme", ThemeFile.list_themes("SINGLE"))], [_("3 Panel"), rotate_opt, ("3p-theme", ThemeFile.list_themes("3PANEL"))], [_("5 Panel"), rotate_opt, ("5p-theme", ThemeFile.list_themes("5PANEL"))], [_("Large 6 Panel"), rotate_opt, ("6pl-theme", ThemeFile.list_themes("6PANEL"))], [_("Small 6 Panel"), rotate_opt, ("6ps-theme", ThemeFile.list_themes("6VERSUS"))], [_("Large 8 Panel"), rotate_opt, ("8pl-theme", ThemeFile.list_themes("8PANEL"))], [_("Small 8 Panel"), rotate_opt, ("8ps-theme", ThemeFile.list_themes("8VERSUS"))], [_("Large 9 Panel"), rotate_opt, ("9pl-theme", ThemeFile.list_themes("9PANEL"))], [_("Small 9 Panel"), rotate_opt, ("9ps-theme", ThemeFile.list_themes("9VERSUS"))], [_("Parapara"), rotate_opt, ("para-theme", ThemeFile.list_themes("PARAPARA"))], [_("DMX"), rotate_opt, ("dmx-theme", ThemeFile.list_themes("DMX"))], [_("EZ2"), rotate_opt, ("ez2-theme", ThemeFile.list_themes("EZ2SINGLE"))], [_("EZ2 Real"), rotate_opt, ("ez2real-theme", ThemeFile.list_themes("EZ2REAL"))], [_("Back"), None, None] ), [_("Back"), None, None] ), (_("Graphic Options"), [_("Animation"), onoff_opt, ('animation',)], [_("Arrow Effects"), rotate_index_opt, ('explodestyle', (_('none'), _('rotate'), _('scale'), _('rotate & scale')))], [_("Backgrounds"), onoff_opt, ('showbackground',)], [_("Brightness"), tuple_opt, ('bgbrightness', [(32, _('very dark')), (64, _('dark')), (127, _('normal')), (192, _('bright')), (255, _('very bright'))])], [_("Lyrics"), onoff_opt, ("showlyrics",)], [_("Lyrics Color"), rotate_opt, ("lyriccolor", [_("pink/purple"), _("purple/cyan"), _("cyan/aqua"), _("aqua/yellow"), _("yellow/pink")])], [_("Back"), None, None] ), (_("Interface Options"), [_("Save Input"), onoff_opt, ('saveinput',)], [_("Song Previews"), tuple_opt, ('previewmusic', [(0, "Off"), (1, "On"), (2, "Safe")])], [_("Folders"), onoff_opt, ("folders",)], [_("Timer Display"), onoff_opt, ('fpsdisplay',)], [_("Song Info Screen"), tuple_opt, ('songinfoscreen', zip([0, 1, 2], [_("Never"), _("Multi-song Only"), _("Always")]))], [_("Font (after restart)"), rotate_opt, ('fonttheme', FontTheme.themes())], [_("Calibrate Latency"), {ui.START: wrap_ctr, ui.CONFIRM: wrap_ctr}, (calibrate.run, (screen,))], [_("Back"), None, None] ) ) me = menus.Menu(_("Main Menu"), m, screen, sprites) me.display()
def do(screen, songdata): onoff_opt = { ui.START: switch_onoff, ui.CONFIRM: switch_onoff, menus.CREATE: get_onoff, ui.LEFT: off_onoff, ui.RIGHT: on_onoff } offon_opt = { ui.START: switch_offon, ui.START: switch_offon, menus.CREATE: get_offon, ui.LEFT: off_offon, ui.RIGHT: on_offon } rotate_opt = { ui.START: switch_rotate, ui.CONFIRM: switch_rotate, ui.LEFT: switch_rotate_back, ui.RIGHT: switch_rotate, menus.CREATE: get_rotate } rotate_index_opt = { ui.START: switch_rotate_index, ui.CONFIRM: switch_rotate_index, ui.LEFT: switch_rotate_index_back, ui.RIGHT: switch_rotate_index, menus.CREATE: get_rotate_index } tuple_opt = { ui.START: switch_tuple, ui.CONFIRM: switch_tuple, ui.LEFT: switch_tuple_back, ui.RIGHT: switch_tuple, menus.CREATE: get_tuple } sprites = pygame.sprite.RenderUpdates() try: lines = file(os.path.join(pydance_path, "CREDITS")).read().split("\n") lines = [l.decode("utf-8") for l in lines] Credits([_("pydance %s") % VERSION] + lines).add(sprites) except: Credits([ _("pydance %s") % VERSION, "http://icculus.org/pyddr", _("By Joe Wreschnig, Brendan Becker, & Pavel Krivitsky"), _("(Your CREDITS file is missing.)"), ]).add(sprites) m = ([ _("Play Game"), { ui.START: wrap_ctr, ui.CONFIRM: wrap_ctr }, (GameSelect, songdata) ], [ _("Map Keys"), { ui.START: wrap_ctr, ui.CONFIRM: wrap_ctr }, (pad.PadConfig, (screen, )) ], (_("Game Options"), [_("Autofail"), onoff_opt, (_("autofail"), )], [ _("Assist Mode"), tuple_opt, (_("assist"), [(0, _("Off")), (1, _("Click")), (2, _("Full"))]) ], [_("Announcer"), rotate_opt, ('djtheme', Announcer.themes())], (_("Themes ..."), [ _("4 Panel"), rotate_opt, ("4p-theme", ThemeFile.list_themes("SINGLE")) ], [ _("3 Panel"), rotate_opt, ("3p-theme", ThemeFile.list_themes("3PANEL")) ], [ _("5 Panel"), rotate_opt, ("5p-theme", ThemeFile.list_themes("5PANEL")) ], [ _("Large 6 Panel"), rotate_opt, ("6pl-theme", ThemeFile.list_themes("6PANEL")) ], [ _("Small 6 Panel"), rotate_opt, ("6ps-theme", ThemeFile.list_themes("6VERSUS")) ], [ _("Large 8 Panel"), rotate_opt, ("8pl-theme", ThemeFile.list_themes("8PANEL")) ], [ _("Small 8 Panel"), rotate_opt, ("8ps-theme", ThemeFile.list_themes("8VERSUS")) ], [ _("Large 9 Panel"), rotate_opt, ("9pl-theme", ThemeFile.list_themes("9PANEL")) ], [ _("Small 9 Panel"), rotate_opt, ("9ps-theme", ThemeFile.list_themes("9VERSUS")) ], [ _("Parapara"), rotate_opt, ("para-theme", ThemeFile.list_themes("PARAPARA")) ], [_("DMX"), rotate_opt, ("dmx-theme", ThemeFile.list_themes("DMX"))], [ _("EZ2"), rotate_opt, ("ez2-theme", ThemeFile.list_themes("EZ2SINGLE")) ], [ _("EZ2 Real"), rotate_opt, ("ez2real-theme", ThemeFile.list_themes("EZ2REAL")) ], [_("Back"), None, None]), [_("Back"), None, None]), (_("Graphic Options"), [_("Animation"), onoff_opt, ('animation', )], [ _("Arrow Effects"), rotate_index_opt, ('explodestyle', (_('none'), _('rotate'), _('scale'), _('rotate & scale'))) ], [_("Backgrounds"), onoff_opt, ('showbackground', )], [ _("Brightness"), tuple_opt, ('bgbrightness', [(32, _('very dark')), (64, _('dark')), (127, _('normal')), (192, _('bright')), (255, _('very bright'))]) ], [_("Lyrics"), onoff_opt, ("showlyrics", )], [ _("Lyrics Color"), rotate_opt, ("lyriccolor", [ _("pink/purple"), _("purple/cyan"), _("cyan/aqua"), _("aqua/yellow"), _("yellow/pink") ]) ], [_("Back"), None, None]), (_("Interface Options"), [_("Save Input"), onoff_opt, ('saveinput', )], [ _("Song Previews"), tuple_opt, ('previewmusic', [(0, "Off"), (1, "On"), (2, "Safe")]) ], [_("Folders"), onoff_opt, ("folders", )], [_("Timer Display"), onoff_opt, ('fpsdisplay', )], [ _("Song Info Screen"), tuple_opt, ('songinfoscreen', zip([0, 1, 2], [_("Never"), _("Multi-song Only"), _("Always")])) ], [ _("Font (after restart)"), rotate_opt, ('fonttheme', FontTheme.themes()) ], [ _("Calibrate Latency"), { ui.START: wrap_ctr, ui.CONFIRM: wrap_ctr }, (calibrate.run, (screen, )) ], [_("Back"), None, None])) me = menus.Menu(_(""), m, screen, sprites) me.display()
def _render(self): font = FontTheme.font(self._purpose, self._text, self._size[0]) img = fontfx.shadow(self._text, font, [255, 255, 255]) self.image = img self.rect = self.image.get_rect() self.rect.midleft = self._midleft