コード例 #1
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)
コード例 #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)
コード例 #3
0
class Display(Screen):

    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)

    def callback(self, action):
        if action == self.resolution:
            value = action.get_value()
            CONFIG.general.WIDTH = int(value.split('x')[0])
            CONFIG.general.HEIGHT = int(value.split('x')[1])
        if action == self.fullscreen:
            pygame.display.toggle_fullscreen()
            if CONFIG.display.FULLSCREEN:
                CONFIG.display.FULLSCREEN = False
            else:
                CONFIG.display.FULLSCREEN = True
        if action == self.fps:
            if CONFIG.display.SHOW_FPS:
                CONFIG.display.SHOW_FPS = False
            else:
                CONFIG.display.SHOW_FPS = True
        if action.text == 'zoom_sharpness':
            CONFIG.general.ZOOM_SHARPNESS = (action.get_value()+1)*5
        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
コード例 #4
0
class Display(Screen):
    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)

    def callback(self, action):
        if action == self.resolution:
            value = action.get_value()
            CONFIG.general.WIDTH = int(value.split('x')[0])
            CONFIG.general.HEIGHT = int(value.split('x')[1])
        if action == self.fullscreen:
            pygame.display.toggle_fullscreen()
            if CONFIG.display.FULLSCREEN:
                CONFIG.display.FULLSCREEN = False
            else:
                CONFIG.display.FULLSCREEN = True
        if action == self.fps:
            if CONFIG.display.SHOW_FPS:
                CONFIG.display.SHOW_FPS = False
            else:
                CONFIG.display.SHOW_FPS = True
        if action.text == 'zoom_sharpness':
            CONFIG.general.ZOOM_SHARPNESS = (action.get_value() + 1) * 5
        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
コード例 #5
0
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()
コード例 #6
0
    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)
コード例 #7
0
                    pass
                else:
                    raise
            except IOError, e:
                pass

        self.add(VBox())

        self.checkboxes_ai = []
        self.portraits = []
        self.player_spinner = []
        self.player_vbox = [VBox(), VBox(), VBox(), VBox()]

        for i in range(0, 4):
            #I18N: Artificial Intelligence
            self.checkboxes_ai.append(TextCheckBox(_("AI:")))
            self.portraits.append(
                Image(join(self.game_data['character_file'][0],
                           "portrait.png")))

            self.player_spinner.append(Spinner(self.character))
            #I18N: %s is the player number, it can be Player 1, Player2...
            self.player_vbox[i].add(
                Label(_("Player %s").replace("%s", str(i + 1))))
            self.player_vbox[i].add(self.player_spinner[-1])
            self.player_vbox[i].add(self.portraits[-1],
                                    margin_left=65,
                                    margin=5,
                                    size=(50, 50))
            self.player_vbox[i].add(
                self.checkboxes_ai[-1],