Ejemplo n.º 1
0
Archivo: weeds.py Proyecto: mchi/solent
def game(console_type):
    engine = None
    try:
        engine = Engine(
            mtu=MTU)
        engine.set_default_timeout(0.04)
        #engine.debug_eloop_on()
        #
        orb = engine.init_orb(
            i_nearcast=I_CONTAINMENT_NEARCAST_SCHEMA)
        #orb.add_log_snoop()
        orb.init_cog(CogInterpreter)
        orb.init_cog(CogToTerm)
        orb.init_cog(CogToMenu)
        orb.init_cog(CogToRoguebox)
        #
        bridge = orb.init_autobridge()
        bridge.nearcast.prime_console(
            console_type=console_type,
            console_height=CONSOLE_HEIGHT,
            console_width=CONSOLE_WIDTH)
        bridge.nearcast.init()
        #
        engine.event_loop()
    except SolentQuitException:
        pass
    except:
        traceback.print_exc()
    finally:
        if engine != None:
            engine.close()
Ejemplo n.º 2
0
def main():
    engine = Engine(mtu=MTU)
    engine.set_default_timeout(0.0)
    try:
        orb = engine.init_orb(i_nearcast=I_NEARCAST)
        orb.init_cog(CogSdlWorld)
        #
        bridge = orb.init_autobridge()
        bridge.nc_init(title='Game', width=1000, height=600)
        #
        engine.event_loop()
    except KeyboardInterrupt:
        pass
    except SolentQuitException:
        pass
    finally:
        engine.close()
Ejemplo n.º 3
0
def main():
    engine = Engine(mtu=MTU)
    engine.set_default_timeout(0.08)
    #
    try:
        init_nearcast(engine=engine,
                      lc_addr=LC_ADDR,
                      lc_port=LC_PORT,
                      console_width=CONSOLE_WIDTH,
                      console_height=CONSOLE_HEIGHT)
        engine.event_loop()
    except KeyboardInterrupt:
        pass
    except SolentQuitException:
        pass
    finally:
        engine.close()
        log("after engine close")
Ejemplo n.º 4
0
def main():
    console_type = 'curses'
    init_network_logging(
        mtu=1490,
        addr=get_broadcast(),
        port=4999,
        label=__name__)
    log("Log opened.")

    engine = None
    try:
        engine = Engine(
            mtu=MTU)
        engine.set_default_timeout(0.04)
        #engine.debug_eloop_on()
        #
        orb = engine.init_orb(
            i_nearcast=I_CONTAINMENT_NEARCAST_SCHEMA)
        orb.add_log_snoop()
        orb.init_cog(CogInterpreter)
        orb.init_cog(CogToTerm)
        orb.init_cog(CogToMenu)
        orb.init_cog(CogToRoguebox)
        #
        bridge = orb.init_autobridge()
        bridge.nearcast.prime_console(
            console_type=console_type,
            console_height=CONSOLE_HEIGHT,
            console_width=CONSOLE_WIDTH)
        bridge.nearcast.init()
        #
        engine.event_loop()
    except SolentQuitException:
        pass
    except:
        traceback.print_exc()
    finally:
        if engine != None:
            engine.close()