Exemplo n.º 1
0
    def rec(self, btn, val):
        used = self.already_used(val)
        if used:
            self.dial = AlreadyUsedDlg(self.menu_props, val, *used)
            self.dial.attach(self.on_already_dlg)
        else:
            btn['text'] = val
            dct = self.update_values()
            self.opt_file['settings'] = DctFile.deepupdate(
                self.opt_file['settings'], dct)
            self.opt_file.store()

            keys = self.opt_file['settings']['keys']
            nav1 = NavInfoPerPlayer(keys['left1'], keys['right1'],
                                    keys['forward1'], keys['rear1'],
                                    keys['fire1'])
            nav2 = NavInfoPerPlayer(keys['left2'], keys['right2'],
                                    keys['forward2'], keys['rear2'],
                                    keys['fire2'])
            nav3 = NavInfoPerPlayer(keys['left3'], keys['right3'],
                                    keys['forward3'], keys['rear3'],
                                    keys['fire3'])
            nav4 = NavInfoPerPlayer(keys['left4'], keys['right4'],
                                    keys['forward4'], keys['rear4'],
                                    keys['fire4'])
            nav = NavInfo([nav1, nav2, nav3, nav4])
            self.menu_props.nav = nav

        self.hint_lab.hide()
        events = list(self.keys.values()) + self._keys
        list(map(self.mediator.event.ignore, events))
        self.enable_navigation([0])
Exemplo n.º 2
0
    def rec(self, btn, val):
        self.eng.joystick_mgr.is_recording = False
        used = self.already_used(val)
        if used:
            self.dial = AlreadyUsedJoystickDlg(self.menu_props, val, used)
            self.dial.attach(self.on_already_joystick_dlg)
        else:
            btn['text'] = val.split('_', 1)[1:]
            dct = self.update_values()
            self.opt_file['settings'] = DctFile.deepupdate(
                self.opt_file['settings'], dct)
            self.opt_file.store()

            #keys = self.opt_file['settings']['joystick']
            #nav1 = NavInfoPerPlayer(keys['left1'], keys['right1'], keys['forward1'],
            #                        keys['rear1'], keys['fire1'])
            #nav2 = NavInfoPerPlayer(keys['left2'], keys['right2'], keys['forward2'],
            #                        keys['rear2'], keys['fire2'])
            #nav3 = NavInfoPerPlayer(keys['left3'], keys['right3'], keys['forward3'],
            #                        keys['rear3'], keys['fire3'])
            #nav4 = NavInfoPerPlayer(keys['left4'], keys['right4'], keys['forward4'],
            #                        keys['rear4'], keys['fire4'])
            #nav = NavInfo([nav1, nav2, nav3, nav4])
            #self.menu_props.nav = nav

        self.hint_lab.hide()
        list(map(self.mediator.event.ignore, self._keys))
        self.enable_navigation([0])
Exemplo n.º 3
0
Arquivo: menu.py Projeto: oriolrg/yorg
 def on_push_page(self, page_code, args=[]):
     if page_code == 'singleplayer':
         self.eng.log('single player')
         page = SingleplayerPage(args[0])
         page.gui.attach(self.on_track_selected)
         page.gui.attach(self.on_continue)
     if page_code == 'login':
         self.eng.log('login')
         page = LogInPage(args[0])
         page.gui.attach(self.on_login_page)
     if page_code == 'register':
         self.eng.log('register')
         page = RegisterPage(args[0])
     if page_code == 'reset':
         self.eng.log('reset')
         page = ResetPage(args[0])
     if page_code == 'single_race':
         self.eng.log('single race')
         page = TrackPage(args[0])
         page.gui.attach(self.on_track_selected)
     if page_code == 'localmp':
         self.eng.log('local multiplayer')
         page = NumPlayersPage(args[0])
         page.gui.attach(self.on_nplayers)
     if page_code == 'multiplayer':
         self.eng.log('multiplayer')
         page = MultiplayerPage(args[0])
     if page_code == 'online':
         self.eng.log('online')
         page = OnlinePage(args[0])
     if page_code == 'onlineplay':
         self.eng.log('onlineplay')
         page = OnlinePlayPage(args[0])
         page.gui.attach(self.on_create_room)
     if page_code == 'client':
         self.eng.log('client')
         page = ClientPage(args[0])
         page.gui.attach(self.on_create_room_client)
     if page_code == 'trackpageserver':
         self.eng.log('track page server')
         page = TrackPageServer(args[0], args[1])
         page.gui.attach(self.on_track_selected)
     if page_code == 'trackpagelocalmp':
         self.eng.log('track page local multiplayer')
         page = TrackPageLocalMP(args[0])
         page.gui.attach(self.on_track_selected_lmp)
     if page_code == 'new_season':
         self.eng.log('new season')
         page = CarPageSeason(args[0], self.mediator.track)
         page.gui.attach(self.on_car_selected_season)
     if page_code == 'car_page':
         self.eng.log('car page')
         page = CarPage(args[0], self.mediator.track)
         page.gui.attach(self.on_car_selected)
     if page_code == 'carpageserver':
         self.eng.log('car page server')
         #page = CarPageServer(args[0], self.mediator.track, self.yorg_client)
         page = CarPageClient(args[0], self.mediator.track, self.uid_srv)
         page.gui.attach(self.on_car_selected)
     if page_code == 'carpagelocalmp':
         self.eng.log('car page local multiplayer')
         page = CarPageLocalMP(args[0], self.mediator.track, self.mediator.nplayers)
         page.gui.attach(self.on_car_selected)
     if page_code == 'carpageclient':
         self.eng.log('car page client')
         page = CarPageClient(args[0], self.mediator.track, self.uid_srv)
         page.gui.attach(self.on_car_selected)
     if page_code == 'driver_page':
         self.eng.log('driver page')
         page = DriverPageSinglePlayer(args[0], args[1], args[2])
         page.gui.attach(self.on_driver_selected)
     if page_code == 'driver_page_mp':
         self.eng.log('driver page multiplayer')
         page = DriverPageMP(args[0], args[1], args[2], self.mediator.nplayers)
         page.gui.attach(self.on_driver_selected_mp)
     if page_code == 'driverpageserver':
         self.eng.log('driver page server')
         page = DriverPageServer(args[0], args[1], args[2])
         page.gui.attach(self.on_driver_selected_server)
     if page_code == 'driverpageclient':
         self.eng.log('driver page client')
         page = DriverPageClient(args[0], args[1], args[2], self.uid_srv)
         page.gui.attach(self.on_driver_selected)
         page.gui.attach(self.on_car_start_client)
     if page_code == 'options':
         self.eng.log('options')
         page = OptionPage(self.mediator.gui.menu_props, args[0])
     if page_code == 'inputsel':
         self.eng.log('inputsel')
         page = InputSelPage(self.mediator.gui._menu_props, self.mediator.menu_props.opt_file, args[0], args[1])
         #self.mediator.gui.menu_props, args[0], args[1])
     if page_code == 'input1keyboard':
         self.eng.log('input1keyboard')
         page = InputPageKeyboard(
             self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, args[0])
     if page_code == 'input1joystick':
         self.eng.log('input1joystick')
         page = InputPageJoystick(
             self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, args[0])
     if page_code == 'input2keyboard':
         self.eng.log('input2keyboard')
         self.mediator.menu_props.opt_file['settings'] = DctFile.deepupdate(self.mediator.menu_props.opt_file['settings'], args[1])
         self.mediator.menu_props.opt_file.store()
         page = InputPage2Keyboard(self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, self.mediator.menu_props.opt_file['settings']['keys'])
     if page_code == 'input2joystick':
         self.eng.log('input2joystick')
         self.mediator.menu_props.opt_file['settings'] = DctFile.deepupdate(self.mediator.menu_props.opt_file['settings'], args[1])
         self.mediator.menu_props.opt_file.store()
         page = InputPage2Joystick(self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, self.mediator.menu_props.opt_file['settings']['joystick'])
     if page_code == 'input3keyboard':
         self.eng.log('input3keyboard')
         self.mediator.menu_props.opt_file['settings'] = DctFile.deepupdate(self.mediator.menu_props.opt_file['settings'], args[1])
         self.mediator.menu_props.opt_file.store()
         page = InputPage3Keyboard(self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, self.mediator.menu_props.opt_file['settings']['keys'])
     if page_code == 'input3joystick':
         self.eng.log('input3joystick')
         self.mediator.menu_props.opt_file['settings'] = DctFile.deepupdate(self.mediator.menu_props.opt_file['settings'], args[1])
         self.mediator.menu_props.opt_file.store()
         page = InputPage3Joystick(self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, self.mediator.menu_props.opt_file['settings']['joystick'])
     if page_code == 'input4keyboard':
         self.eng.log('input4keyboard')
         self.mediator.menu_props.opt_file['settings'] = DctFile.deepupdate(self.mediator.menu_props.opt_file['settings'], args[1])
         self.mediator.menu_props.opt_file.store()
         page = InputPage4Keyboard(self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, self.mediator.menu_props.opt_file['settings']['keys'])
     if page_code == 'input4joystick':
         self.eng.log('input4joystick')
         self.mediator.menu_props.opt_file['settings'] = DctFile.deepupdate(self.mediator.menu_props.opt_file['settings'], args[1])
         self.mediator.menu_props.opt_file.store()
         page = InputPage4Joystick(self.mediator.gui.menu_props, self.mediator.menu_props.opt_file, self.mediator.menu_props.opt_file['settings']['joystick'])
     if page_code == 'credits':
         self.eng.log('credits')
         page = CreditPage(self.mediator.gui.menu_props)
     if page_code == 'supporters':
         self.eng.log('supporters')
         page = SupportersPage(self.mediator.gui.menu_props)
     self.push_page(page)
Exemplo n.º 4
0
 def __init__(self):
     default_opt = {
         'settings': {
             'lang': 'en',
             'volume': 1,
             'fullscreen': 0,
             'resolution': '1280 720',
             'antialiasing': 0,
             'cars_number': 7,
             'keys': {
                 'forward': 'arrow_up',
                 'rear': 'arrow_down',
                 'left': 'arrow_left',
                 'right': 'arrow_right',
                 'fire': 'space',
                 'respawn': 'r',
                 'pause': 'p'},
             'joystick': 0,
             'last_version': '0.7.0-x',
             'player_name': '',
             'shaders': 1,
             'xmpp':
                 {'usr': '', 'pwd': ''}},
         'development': {
             'multithreaded_render': 0,
             'ai': 0,
             'fps': 0,
             'car': '',
             'track': '',
             'shaders_dev': 0,
             'gamma': 2.2,
             'show_waypoints': 0,
             'show_exit': 1,
             'menu_joypad': 1,
             'win_orig': '',
             'profiling': 0,
             'pyprof_percall': 0,
             'verbose': '',
             'verbose_log': 0,
             'race_start_time': 3.5,
             'countdown_seconds': 3,
             'xmpp_debug': 0,
             'xmpp_server': '*****@*****.**',
             'server': ''}}
     opt_path = ''
     if platform == 'win32' and not exists('main.py'):
         # it is the deployed version for windows
         opt_path = join(str(Filename.get_user_appdata_directory()), 'Yorg')
     self.options = DctFile(
         join(opt_path, 'options.yml') if opt_path else 'options.yml',
         default_opt)
     opt_dev = self.options['development']
     win_orig = opt_dev['win_orig']
     parser = argparse.ArgumentParser()
     parser.add_argument('--win_orig')
     parser.add_argument('--user')
     parser.add_argument('--pwd')
     parser.add_argument('--car')
     parser.add_argument('--server')
     args = parser.parse_args()
     if args.win_orig: win_orig = args.win_orig
     if args.car: opt_dev['car'] = args.car
     if args.server: opt_dev['server'] = args.server
     gui_cfg = GuiCfg(
         win_title='Yorg', win_orig=win_orig,
         win_size=self.options['settings']['resolution'],
         fullscreen=self.options['settings']['fullscreen'],
         antialiasing=self.options['settings']['antialiasing'],
         fps=opt_dev['fps'], shaders=self.options['settings']['shaders'],
         volume=self.options['settings']['volume'])
     profiling_cfg = ProfilingCfg(
         profiling=opt_dev['profiling'],
         pyprof_percall=opt_dev['pyprof_percall'])
     lang_cfg = LangCfg(lang=self.options['settings']['lang'],
                        lang_domain='yorg',
                        languages=['English', 'Italiano', 'Deutsch',
                                   u'G\u00E0idhlig', 'Spanish', 'Galician'])
     cursor_cfg = CursorCfg(
         cursor_path='assets/images/gui/cursor.txo',
         cursor_scale=((256/352.0) * .08, 1, .08),
         cursor_hotspot=(.1, .06))
     dev_cfg = DevCfg(
         mt_render=opt_dev['multithreaded_render'],
         shaders_dev=opt_dev['shaders_dev'], gamma=opt_dev['gamma'],
         menu_joypad=opt_dev['menu_joypad'], verbose=opt_dev['verbose'],
         verbose_log=opt_dev['verbose_log'],
         xmpp_server=opt_dev['xmpp_server'])
     conf = Cfg(gui_cfg, profiling_cfg, lang_cfg, cursor_cfg, dev_cfg)
     init_lst = [
         [('fsm', YorgFsm, [self])],
         [('logic', YorgLogic, [self])],
         [('audio', YorgAudio, [self])],
         [('event', YorgEvent, [self])]]
     menu_args = MenuArgs(
         'assets/fonts/Hanken-Book.ttf', (.75, .75, .25, 1),
         (.75, .75, .75, 1), (.75, .25, .25, 1), .1, (-4.6, 4.6, -.32, .88),
         (0, 0, 0, .2), 'assets/images/gui/menu_background.txo',
         'assets/sfx/menu_over.wav', 'assets/sfx/menu_clicked.ogg',
         'assets/images/icons/%s.txo')
     cars_names = ['themis', 'kronos', 'diones', 'iapeto', 'phoibe', 'rea',
                   'iperion', 'teia']
     damage_info = DamageInfo('assets/models/cars/%s/cardamage1',
                              'assets/models/cars/%s/cardamage2')
     Game.__init__(self, init_lst, conf)
     wheel_gfx_names = ['wheelfront', 'wheelrear', 'wheel']
     wheel_gfx_names = [
         self.eng.curr_path + 'assets/models/cars/%s/' + wname
         for wname in wheel_gfx_names]
     wheel_gfx_names = WheelGfxNames(*wheel_gfx_names)
     social_sites = [
         ('facebook', 'http://www.facebook.com/Ya2Tech'),
         ('twitter', 'http://twitter.com/ya2tech'),
         ('google_plus', 'https://plus.google.com/118211180567488443153'),
         ('youtube',
          'http://www.youtube.com/user/ya2games?sub_confirmation=1'),
         ('pinterest', 'http://www.pinterest.com/ya2tech'),
         ('tumblr', 'http://ya2tech.tumblr.com'),
         ('feed', 'http://www.ya2.it/pages/feed-following.html')]
     self.gameprops = GameProps(
         menu_args, cars_names, self.drivers(),
         ['toronto', 'rome', 'sheffield', 'orlando', 'nagano', 'dubai'],
         lambda: [_('Toronto'), _('Rome'), _('Sheffield'), _('Orlando'),
                  _('Nagano'), _('Dubai')],
         'assets/images/tracks/%s.txo',
         self.options['settings']['player_name'],
         DriverPaths('assets/images/drivers/driver%s.txo',
                     'assets/images/drivers/driver%s_sel.txo'),
         'assets/images/cars/%s_sel.txo',
         'assets/images/cars/%s.txo',
         self.eng.curr_path + 'assets/models/cars/%s/phys.yml',
         'assets/models/cars/%s/car',
         damage_info, wheel_gfx_names, opt_dev['xmpp_debug'],
         social_sites)
Exemplo n.º 5
0
 def __init__(self):
     default_opt = {
         'settings': {
             'lang': 'en',
             'volume': 1,
             'fullscreen': 0,
             'resolution': '1280 720',
             'antialiasing': 0,
             'cars_number': 8,
             'keys': {
                 'forward1': 'raw-arrow_up',
                 'rear1': 'raw-arrow_down',
                 'left1': 'raw-arrow_left',
                 'right1': 'raw-arrow_right',
                 'fire1': 'raw-rcontrol',
                 'respawn1': 'raw-rshift',
                 'forward2': 'raw-w',
                 'rear2': 'raw-s',
                 'left2': 'raw-a',
                 'right2': 'raw-d',
                 'fire2': 'raw-x',
                 'respawn2': 'raw-c',
                 'forward3': 'raw-i',
                 'rear3': 'raw-k',
                 'left3': 'raw-j',
                 'right3': 'raw-l',
                 'fire3': 'raw-n',
                 'respawn3': 'raw-m',
                 'forward4': 'raw-t',
                 'rear4': 'raw-g',
                 'left4': 'raw-f',
                 'right4': 'raw-h',
                 'fire4': 'raw-v',
                 'respawn4': 'raw-b',
                 'pause': 'raw-p'
             },
             'joystick': {
                 'forward1': 'btn_a',
                 'rear1': 'btn_b',
                 'fire1': 'btn_c',
                 'respawn1': 'btn_d',
                 'forward2': 'btn_a',
                 'rear2': 'btn_b',
                 'fire2': 'btn_c',
                 'respawn2': 'btn_d',
                 'forward3': 'btn_a',
                 'rear3': 'btn_b',
                 'fire3': 'btn_c',
                 'respawn3': 'btn_d',
                 'forward4': 'btn_a',
                 'rear4': 'btn_b',
                 'fire4': 'btn_c',
                 'respawn4': 'btn_d'
             },
             'last_version': '0.7.0-x',
             'player_names': [],
             'stored_player_names': [],
             'shaders': 1,
             'camera': 'top',
             'login': {
                 'usr': '',
                 'pwd': ''
             }
         },
         'development': {
             'multithreaded_render': 1,
             'ai': 0,
             'ai_debug': 0,
             'fps': 0,
             'cars': '',
             'track': '',
             'start_wp': '',
             'shaders_dev': 0,
             'gamma': 2.2,
             'show_waypoints': 0,
             'show_exit': 1,
             'menu_joypad': 1,
             'win_orig': '',
             'port': 9099,
             'profiling': 0,
             'pyprof_percall': 0,
             'verbose': '',
             'verbose_log': 0,
             'race_start_time': 3.5,
             'countdown_seconds': 3,
             'xmpp_debug': 0,
             'xmpp_server': '*****@*****.**',
             'server': 'ya2tech.it:9099',
             'mp_srv_usr': '',
             'fixed_fps': 0,
             'srgb': 0,
             'opengl_3_2': 0
         }
     }
     opt_path = ''
     if platform in ['win32', 'linux'] and not exists('main.py'):
         # it is the deployed version for windows
         opt_path = str(Filename.get_user_appdata_directory()) + '/Yorg'
     parser = argparse.ArgumentParser()
     parser.add_argument('--win_orig')
     parser.add_argument('--user')
     parser.add_argument('--pwd')
     parser.add_argument('--cars')
     parser.add_argument('--server')
     parser.add_argument('--optfile')
     args = parser.parse_args(EngineLogic.cmd_line())
     optfile = args.optfile if args.optfile else 'options.yml'
     old_def = deepcopy(default_opt)
     self.options = DctFile(
         LibP3d.fixpath(opt_path + '/' + optfile) if opt_path else optfile,
         default_opt)
     if self.options['development']['server'] == '':
         self.options['development']['server'] = old_def['development'][
             'server']
     opt_dev = self.options['development']
     win_orig = opt_dev['win_orig']
     if args.win_orig: win_orig = args.win_orig
     if args.cars: opt_dev['cars'] = args.cars
     if args.server: opt_dev['server'] = args.server
     gui_cfg = GuiCfg(win_title='Yorg',
                      win_orig=win_orig,
                      win_size=self.options['settings']['resolution'],
                      fullscreen=self.options['settings']['fullscreen'],
                      antialiasing=self.options['settings']['antialiasing'],
                      fps=opt_dev['fps'],
                      shaders=self.options['settings']['shaders'],
                      volume=self.options['settings']['volume'],
                      fixed_fps=self.options['development']['fixed_fps'])
     profiling_cfg = ProfilingCfg(profiling=opt_dev['profiling'],
                                  pyprof_percall=opt_dev['pyprof_percall'])
     lang_cfg = LangCfg(lang=self.options['settings']['lang'],
                        lang_domain='yorg',
                        languages=[('English', 'en'), ('Deutsch', 'de'),
                                   (u'Espa\u00F1ol', 'es'),
                                   (u'Fran\u00E7ais', 'fr'),
                                   (u'G\u00E0idhlig', 'gd'),
                                   ('Galego', 'gl'), ('Italiano', 'it')])
     cursor_cfg = CursorCfg(cursor_path='assets/images/gui/cursor.txo',
                            cursor_scale=((256 / 352.0) * .08, 1, .08),
                            cursor_hotspot=(.1, .06))
     dev_cfg = DevCfg(mt_render=opt_dev['multithreaded_render'],
                      shaders_dev=opt_dev['shaders_dev'],
                      gamma=opt_dev['gamma'],
                      menu_joypad=opt_dev['menu_joypad'],
                      verbose=opt_dev['verbose'],
                      verbose_log=opt_dev['verbose_log'],
                      xmpp_server=opt_dev['xmpp_server'],
                      start_wp=opt_dev['start_wp'],
                      port=opt_dev['port'],
                      server=opt_dev['server'],
                      srgb=opt_dev['srgb'],
                      opengl_3_2=opt_dev['opengl_3_2'])
     conf = Cfg(gui_cfg, profiling_cfg, lang_cfg, cursor_cfg, dev_cfg)
     init_lst = [[('fsm', YorgFsm, [self])], [('logic', YorgLogic, [self])],
                 [('audio', YorgAudio, [self])],
                 [('event', YorgEvent, [self])]]
     keys = self.options['settings']['keys']
     nav1 = NavInfoPerPlayer(keys['left1'], keys['right1'],
                             keys['forward1'], keys['rear1'], keys['fire1'])
     nav2 = NavInfoPerPlayer(keys['left2'], keys['right2'],
                             keys['forward2'], keys['rear2'], keys['fire2'])
     nav3 = NavInfoPerPlayer(keys['left3'], keys['right3'],
                             keys['forward3'], keys['rear3'], keys['fire3'])
     nav4 = NavInfoPerPlayer(keys['left4'], keys['right4'],
                             keys['forward4'], keys['rear4'], keys['fire4'])
     nav = NavInfo([nav1, nav2, nav3, nav4])
     menu_props = MenuProps(
         'assets/fonts/Hanken-Book.ttf', (.75, .75, .25, 1),
         (.75, .75, .75, 1), (.75, .25, .25, 1), .1, (-4.6, 4.6, -.32, .88),
         (0, 0, 0, .2), 'assets/images/gui/menu_background.txo',
         'assets/sfx/menu_over.wav', 'assets/sfx/menu_clicked.ogg',
         'assets/images/icons/%s.txo', nav)
     damage_info = DamageInfo('assets/cars/%s/models/cardamage1',
                              'assets/cars/%s/models/cardamage2')
     Game.__init__(self, init_lst, conf, YorgClient)
     cars_names = self.__compute_cars()
     wheel_gfx_names = ['wheelfront', 'wheelrear', 'wheel']
     wheel_gfx_names = [
         self.eng.curr_path + 'assets/cars/%s/models/' + wname
         for wname in wheel_gfx_names
     ]
     wheel_gfx_names = WheelGfxNames(*wheel_gfx_names)
     social_sites = [
         ('facebook', 'https://www.facebook.com/Ya2Tech'),
         ('twitter', 'https://twitter.com/ya2tech'),
         ('google_plus', 'https://plus.google.com/118211180567488443153'),
         ('youtube',
          'https://www.youtube.com/user/ya2games?sub_confirmation=1'),
         ('pinterest', 'https://www.pinterest.com/ya2tech'),
         ('tumblr', 'https://ya2tech.tumblr.com'),
         ('feed', 'https://www.ya2.it/pages/feed-following.html')
     ]
     tracks = self.__compute_tracks()
     tracks_tr = self.__compute_tracks_tr()
     self.gameprops = GameProps(
         menu_props, cars_names, self.drivers(), tracks, tracks_tr,
         'assets/tracks/%s/images/menu.txo',
         self.options['settings']['player_names'],
         self.options['settings']['stored_player_names'],
         DriverPaths('assets/images/drivers/driver%s.txo',
                     'assets/images/drivers/driver%s_sel.txo'),
         'assets/cars/%s/images/car_sel.txo',
         'assets/cars/%s/images/car.txo',
         self.eng.curr_path + 'assets/cars/%s/phys.yml',
         'assets/cars/%s/models/car', damage_info, wheel_gfx_names,
         opt_dev['xmpp_debug'], social_sites)
     self.log_conf(self.options.dct)
     self.eng.lib.set_icon('assets/images/icon/yorg.ico')
Exemplo n.º 6
0
 def __init__(self):
     default_opt = {
         'settings': {
             'lang': 'en',
             'volume': 1,
             'fullscreen': 0,
             'resolution': '1280 720',
             'aa': 0,
             'keys': {
                 'forward': 'arrow_up',
                 'rear': 'arrow_down',
                 'left': 'arrow_left',
                 'right': 'arrow_right',
                 'button': 'x',
                 'respawn': 'r'
             },
             'joystick': 0,
             'player_name': '',
             'shaders': 1
         },
         'development': {
             'multithreaded_render': 0,
             'ai': 0,
             'fps': 0,
             'car': '',
             'track': '',
             'shaders_dev': 0,
             'gamma': 2.2,
             'show_waypoints': 0,
             'show_exit': 1,
             'menu_joypad': 1,
             'multiplayer': 0,
             'season': 0,
             'win_orig': '',
             'profiling': 0,
             'python_profiling': 0,
             'python_profiling_percall': 0
         }
     }
     opt_path = ''
     if platform == 'win32' and not exists('main.py'):
         opt_path = join(str(Filename.get_user_appdata_directory()), 'Yorg')
     self.options = DctFile(
         join(opt_path, 'options.yml') if opt_path else 'options.yml',
         default_opt)
     conf = Cfg(
         win_title='Yorg',
         win_orig=self.options['development']['win_orig'],
         win_size=self.options['settings']['resolution'],
         fullscreen=self.options['settings']['fullscreen'],
         antialiasing=self.options['settings']['aa'],
         fps=self.options['development']['fps'],
         mt_render=self.options['development']['multithreaded_render'],
         shaders_dev=self.options['development']['shaders_dev'],
         gamma=self.options['development']['gamma'],
         menu_joypad=self.options['development']['menu_joypad'],
         lang=self.options['settings']['lang'],
         lang_domain='yorg',
         cursor_path='assets/images/gui/cursor.png',
         cursor_scale=((256 / 352.0) * .08, 1, .08),
         cursor_hotspot=(.1, .06),
         volume=self.options['settings']['volume'],
         profiling=self.options['development']['profiling'],
         python_profiling=self.options['development']['python_profiling'],
         python_profiling_percall=self.options['development']
         ['python_profiling_percall'])
     init_lst = [[('fsm', YorgFsm, [self])], [('logic', YorgLogic, [self])],
                 [('audio', YorgAudio, [self])],
                 [('event', YorgEvent, [self])]]
     Game.__init__(self, init_lst, conf)
Exemplo n.º 7
0
 def on_input_back(self, new_opt_dct):
     self.mediator.options['settings'] = DctFile.deepupdate(self.mediator.options['settings'], new_opt_dct)
     self.mediator.options.store()