def init(self):
        self.add(VBox())
        self.name = _("Display Options")
        modes = []
        for resolution in pygame.display.list_modes():
            if resolution[0] >= 800:
                modes.append(str(resolution[0]) + "x" + str(resolution[1]))
        modes.reverse()
        self.resolution = Spinner(modes, 170)
        self.resolution.set_value(str(CONFIG.general.WIDTH) + 'x'
                                    + str(CONFIG.general.HEIGHT))

        self.widget.add(Label(_('Screen resolution (requires a restart):')))
        self.widget.add(self.resolution)

        self.fullscreen = TextCheckBox(_('Fullscreen:'))

        self.fullscreen.set_value(CONFIG.display.FULLSCREEN)
        self.widget.add(self.fullscreen)
        self.widget.add(Label(_('Zoom sharpness:')), margin=25)
        zoom = Slider('zoom_sharpness')
        self.widget.add(zoom, margin=10, size=(220, 30))
        zoom.set_value(CONFIG.general.ZOOM_SHARPNESS/5)

        self.fps = TextCheckBox(_('Show FPS:'))

        self.fps.set_value(CONFIG.display.SHOW_FPS)
        self.widget.add(self.fps, margin=25)

        self.widget.add(Button(_('Back')), margin=30)
示例#2
0
    def init(self):
        self.add(VBox())
        self.name = _("Display Options")
        modes = []
        for resolution in pygame.display.list_modes():
            if resolution[0] >= 800:
                modes.append(str(resolution[0]) + "x" + str(resolution[1]))
        modes.reverse()
        self.resolution = Spinner(modes, 170)
        self.resolution.set_value(
            str(CONFIG.general.WIDTH) + 'x' + str(CONFIG.general.HEIGHT))

        self.widget.add(Label(_('Screen resolution (requires a restart):')))
        self.widget.add(self.resolution)

        self.fullscreen = TextCheckBox(_('Fullscreen:'))

        self.fullscreen.set_value(CONFIG.display.FULLSCREEN)
        self.widget.add(self.fullscreen)
        self.widget.add(Label(_('Zoom sharpness:')), margin=25)
        zoom = Slider('zoom_sharpness')
        self.widget.add(zoom, margin=10, size=(220, 30))
        zoom.set_value(CONFIG.general.ZOOM_SHARPNESS / 5)

        self.fps = TextCheckBox(_('Show FPS:'))

        self.fps.set_value(CONFIG.display.SHOW_FPS)
        self.widget.add(self.fps, margin=25)

        self.widget.add(Button(_('Back')), margin=30)
class Audio(Screen):
    def init(self):
        # create widgets
        self.add(VBox())
        self.name = _('Audio Options')

        self.sound = TextCheckBox(_('Sound'))
        self.sound_volume = Slider('Sound Volume')
        self.music = TextCheckBox(_('Music'))
        self.music_volume = Slider('Music Volume')

        # set values from config
        self.sound.set_value(CONFIG.audio.SOUND)
        self.sound_volume.set_value(CONFIG.audio.SOUND_VOLUME)
        self.music.set_value(CONFIG.audio.MUSIC)
        self.music_volume.set_value(CONFIG.audio.MUSIC_VOLUME)

        # add widgets
        self.widget.add(self.sound)
        self.widget.add(self.sound_volume, margin=10, size=(220, 30))
        self.widget.add(self.music)
        self.widget.add(self.music_volume, margin=10, size=(220, 30))
        self.widget.add(Button(_('Back')), margin=30)
                
    def callback(self, action):
        if action.text == 'Music Volume':
            CONFIG.audio.MUSIC_VOLUME = action.get_value()
        if action.text == 'Sound Volume':
            CONFIG.audio.SOUND_VOLUME = action.get_value()
        if action.text == 'Music':
            if CONFIG.audio.MUSIC:
                CONFIG.audio.MUSIC = False
            else:
                CONFIG.audio.MUSIC = True
        if action.text == 'Sound':
            if CONFIG.audio.SOUND:
                CONFIG.audio.SOUND = False
            else:
                CONFIG.audio.SOUND = True
        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
    def init(self):
        # create widgets
        self.add(VBox())
        self.name = _('Audio Options')

        self.sound = TextCheckBox(_('Sound'))
        self.sound_volume = Slider('Sound Volume')
        self.music = TextCheckBox(_('Music'))
        self.music_volume = Slider('Music Volume')

        # set values from config
        self.sound.set_value(CONFIG.audio.SOUND)
        self.sound_volume.set_value(CONFIG.audio.SOUND_VOLUME)
        self.music.set_value(CONFIG.audio.MUSIC)
        self.music_volume.set_value(CONFIG.audio.MUSIC_VOLUME)

        # add widgets
        self.widget.add(self.sound)
        self.widget.add(self.sound_volume, margin=10, size=(220, 30))
        self.widget.add(self.music)
        self.widget.add(self.music_volume, margin=10, size=(220, 30))
        self.widget.add(Button(_('Back')), margin=30)