Example #1
0
def main(size=None, init=True):
    features.FEATURE_FILE_PATH = os.path.join(save.get_save_dir(), 'features')
    features.parse_options()
    setup_game_version()
    setup_android_version()
    setup_errors()
    size = size or check_force_size()

    maybe_start_remote_debug()

    monitor.start()

    client.window.init_screen(size)
    osutil.init()

    ui.init()
    ui.set_fill_image(None)
    unpack_data()
    ui.set_fill_image(pygame.image.load('data/user/background.jpg'))

    setup_freeciv_config()
    client.window.init()
    gamescreen.init()

    start_autoupdate()

    if init:
        client.freeciv.run()
    else:
        client_main()
Example #2
0
def main():
    features.FEATURE_FILE_PATH = os.path.join(save.get_save_dir(), 'features')
    features.parse_options()
    setup_game_version()
    setup_android_version()
    setup_errors()

    maybe_start_remote_debug()

    monitor.start()
    save.start_zygote()

    client.window.init_screen()
    osutil.init()

    ui.init()
    ui.set_fill_image(graphics.load_image('data/user/background.jpg'))

    setup_freeciv_config()
    client.window.init()
    gamescreen.init()

    start_autoupdate()
    start_marketnotice()

    client.freeciv.run()
Example #3
0
def main():
    features.parse_options()
    setup_game_version()
    setup_android_version()
    setup_errors()

    maybe_start_remote_debug()

    monitor.start()
    save.start_zygote()

    client.window.init_screen()
    osutil.init()
    set_logical_size()

    ui.init()
    ui.set_fill_image(graphics.load_image('data/user/background.jpg'))

    setup_freeciv_config()
    client.window.init()
    gamescreen.init()

    start_autoupdate()
    start_marketnotice()

    ctrl.maybe_init()

    client.freeciv.run()
Example #4
0
def main(size=None, init=True):
    features.FEATURE_FILE_PATH = os.path.join(save.get_save_dir(), 'features')
    features.parse_options()
    setup_game_version()
    setup_android_version()
    setup_errors()    
    size = size or check_force_size()
    
    maybe_start_remote_debug()
    
    monitor.start()
    
    client.window.init_screen(size)
    osutil.init()
    
    ui.init()
    ui.set_fill_image(None)
    unpack_data()
    ui.set_fill_image(pygame.image.load('data/user/background.jpg'))
    
    setup_freeciv_config()
    client.window.init()
    gamescreen.init()
    
    start_autoupdate()
    
    if init:
        client.freeciv.run()
    else:
        client_main()
Example #5
0
def main():
    features.FEATURE_FILE_PATH = os.path.join(save.get_save_dir(), 'features')
    features.parse_options()
    setup_game_version()
    setup_android_version()
    setup_errors()

    maybe_start_remote_debug()

    monitor.start()
    save.start_zygote()

    client.window.init_screen()
    osutil.init()

    ui.init()
    ui.set_fill_image(graphics.load_image('data/user/background.jpg'))

    setup_freeciv_config()
    client.window.init()
    gamescreen.init()

    start_autoupdate()
    start_marketnotice()

    client.freeciv.run()
Example #6
0
def main():
    if sys.argv[1:] and sys.argv[1] == 'server':
        from freeciv.client import _freeciv
        import os
        _freeciv.func.py_server_main_run(sys.argv[2:])
        os._exit(0)

    features.parse_options()
    if features.get('debug.dsn'):
        sys.excepthook = early_except_hook

    maybe_setup_launch_param()

    setup_game_version()
    setup_android_version()
    setup_errors()

    maybe_notify_about_launch()
    maybe_start_remote_debug()

    monitor.start()
    if features.get('app.fork'):
        save.start_zygote()

    init_window()
    client.window.init_screen()
    osutil.init()

    #Disable "set_logical_size" feature because
    # - it needs patching SDL
    # - there is a zoom feature in the game.
    # - it makes the graphics to be more blurred because they are zoomed twice when using game zoom
    #if not osutil.is_desktop:
    #    set_logical_size() # Deleted. See lib/ui/core.py:scale_for_device


    ui.init()
    ui.set_fill_image(graphics.load_image('userdata/background.jpg'))

    client.window.init()
    gamescreen.init()

    start_autoupdate()
    start_marketnotice()

    if ctrl:
        ctrl.maybe_init()
    client.freeciv.run(['--log', monitor.get_log_path_base() + '.log'])
Example #7
0
def main():
    if sys.argv[1:] and sys.argv[1] == 'server':
        from freeciv.client import _freeciv
        import os
        _freeciv.func.py_server_main_run(sys.argv[2:])
        os._exit(0)

    features.parse_options()
    if features.get('debug.dsn'):
        sys.excepthook = early_except_hook

    maybe_setup_launch_param()

    setup_game_version()
    setup_android_version()
    setup_errors()

    maybe_notify_about_launch()
    maybe_start_remote_debug()

    monitor.start()
    if features.get('app.fork'):
        save.start_zygote()

    init_window()
    client.window.init_screen()
    osutil.init()
    if not osutil.is_desktop:
        set_logical_size()

    ui.init()
    ui.set_fill_image(graphics.load_image('data/user/background.jpg'))

    setup_freeciv_config()
    client.window.init()
    gamescreen.init()

    start_autoupdate()
    start_marketnotice()

    if ctrl:
        ctrl.maybe_init()

    client.freeciv.run()
Example #8
0
def main():
    if sys.argv[1:] and sys.argv[1] == 'server':
        from freeciv.client import _freeciv
        import os
        _freeciv.func.py_server_main_run(sys.argv[2:])
        os._exit(0)

    features.parse_options()
    if features.get('debug.dsn'):
        sys.excepthook = early_except_hook

    maybe_setup_launch_param()

    setup_game_version()
    setup_android_version()
    setup_errors()

    maybe_notify_about_launch()
    maybe_start_remote_debug()

    monitor.start()
    if features.get('app.fork'):
        save.start_zygote()

    init_window()
    client.window.init_screen()
    osutil.init()
    if not osutil.is_desktop:
        set_logical_size()

    ui.init()
    ui.set_fill_image(graphics.load_image('data/user/background.jpg'))

    setup_freeciv_config()
    client.window.init()
    gamescreen.init()

    start_autoupdate()
    start_marketnotice()

    if ctrl:
        ctrl.maybe_init()

    client.freeciv.run()
Example #9
0
def run():
    ui.set_fill_image(None)
    start = time.time()
    data = graphics.read_window_data()
    compressed = write_image(data, graphics.get_window().get_size())
    stats = {
        'size': len(compressed),
        'time': int((time.time() - start) * 1000)
    }

    data = []
    screen_id = id(ui.get_screen())
    data.append({
        'type': 'frame',
        'data': _cached_image(screen_id, compressed),
        'id': screen_id,
        'back': id(ui.history[0]) if ui.history else None,
        'allow_animation': ui.get_allow_animation(),
        'pos': [0, 0]
    })

    data += _messages
    _messages[:] = []

    def proc_layer(id, surf, pos, offset, size):
        if surf and (surf.get_width() == 0 or surf.get_height() == 0):
            surf = None
        image_data = get_texture_data(surf) if surf else None
        data.append({
            'type': 'layer',
            'layerid': id,
            'data': _cached_image(id, image_data),
            'pos': pos,
            'offset': offset,
            'size': size,
        })

    for layer in layers:
        proc_layer(**layer)

    os.write(features.get('stream.fd'), json.dumps(data) + '\n')

    layers[:] = []
    ui.draw_hooks.add(run)
Example #10
0
def run():
    ui.set_fill_image(None)
    start = time.time()
    data = graphics.read_window_data()
    compressed = write_image(data)
    stats = {'size': len(compressed),
             'time': int((time.time() - start) * 1000)}

    data = []
    data.append({
        'type': 'frame',
        'data': compressed.encode('base64'),
        'id': id(ui.get_screen()),
        'back': id(ui.history[0]) if ui.history else None,
        'allow_animation': ui.get_allow_animation()})

    for frame in data:
        os.write(features.get('stream.fd'), json.dumps(frame) + '\n')
    ui.draw_hooks.add(run)
Example #11
0
def run():
    ui.set_fill_image(None)
    start = time.time()
    data = graphics.read_window_data()
    compressed = write_image(data, graphics.get_window().get_size())
    stats = {'size': len(compressed),
             'time': int((time.time() - start) * 1000)}

    data = []
    screen_id = id(ui.get_screen())
    data.append({
        'type': 'frame',
        'data': _cached_image(screen_id, compressed),
        'id': screen_id,
        'back': id(ui.history[0]) if ui.history else None,
        'allow_animation': ui.get_allow_animation(),
        'pos': [0, 0]})

    data += _messages
    _messages[:] = []

    def proc_layer(id, surf, pos, offset, size):
        if surf and (surf.get_width() == 0 or surf.get_height() == 0):
            surf = None
        image_data = get_texture_data(surf) if surf else None
        data.append({
            'type': 'layer',
            'layerid': id,
            'data': _cached_image(id, image_data),
            'pos': pos,
            'offset': offset,
            'size': size,
        })

    for layer in layers:
        proc_layer(**layer)

    os.write(features.get('stream.fd'), json.dumps(data) + '\n')

    layers[:] = []
    ui.draw_hooks.add(run)