コード例 #1
0
ファイル: terraform.py プロジェクト: athros/Reactor-3
def terraform():
	move_camera(CURSOR_POS)
	render_map.render_map(WORLD_INFO['map'], view_size=WINDOW_SIZE)
	maps.render_lights(size=WINDOW_SIZE, show_weather=False)
	items.draw_all_items()
	menus.align_menus()
	menus.draw_menus()
	gfx.start_of_frame()
	gfx.end_of_frame()
コード例 #2
0
ファイル: terraform.py プロジェクト: penny64/Reactor-3
def terraform():
    move_camera(CURSOR_POS)
    render_map.render_map(WORLD_INFO['map'], view_size=WINDOW_SIZE)
    maps.render_lights(size=WINDOW_SIZE, show_weather=False)
    items.draw_all_items()
    menus.align_menus()
    menus.draw_menus()
    gfx.start_of_frame()
    gfx.end_of_frame()
コード例 #3
0
ファイル: reactor-3.py プロジェクト: penny64/Reactor-3
def main():
    _player_moved = False
    _refresh_map = False

    get_input()
    handle_input()

    if not LIFE[SETTINGS['controlling']]['dead']:
        if LIFE[SETTINGS['controlling']]['asleep']:
            gfx.fade_to_black(255)
            gfx.start_of_frame()
            gfx.end_of_frame()

        while LIFE[SETTINGS['controlling']]['asleep']:
            _played_moved = True
            _refresh_map = True

            gfx.title(LIFE[SETTINGS['controlling']]['asleep_reason'])
            logic.tick_all_objects(ignore_tickrate=True, ignore_pause=True)

            if LIFE[SETTINGS['controlling']]['dead']:
                break
    else:
        _player_moved = True

    if _refresh_map:
        gfx.refresh_view('map')

    if not _player_moved:
        if logic.tick_all_objects(ignore_tickrate=True):
            _player_moved = True

    draw_targeting()
    move_camera(SETTINGS['camera_track'])

    #TODO: Deselect so we can get rid of this call
    if SELECTED_TILES[0]:
        gfx.refresh_view('map')

    if not SETTINGS['last_camera_pos'] == SETTINGS['camera_track'][:]:
        if EVENTS or MENUS:
            _visible_chunks = sight.scan_surroundings(
                LIFE[SETTINGS['following']], judge=False, get_chunks=True)
            alife.brain.flag(LIFE[SETTINGS['following']],
                             'visible_chunks',
                             value=_visible_chunks)

            _cam_x = numbers.clip(
                LIFE[SETTINGS['following']]['pos'][0] - MAP_WINDOW_SIZE[0] / 2,
                0, MAP_SIZE[0] - MAP_WINDOW_SIZE[0] / 2)
            _cam_y = numbers.clip(
                LIFE[SETTINGS['following']]['pos'][1] - MAP_WINDOW_SIZE[1] / 2,
                0, MAP_SIZE[1] - MAP_WINDOW_SIZE[1] / 2)

        else:
            _visible_chunks = sight.scan_surroundings(
                LIFE[SETTINGS['controlling']], judge=False, get_chunks=True)
            alife.brain.flag(LIFE[SETTINGS['controlling']],
                             'visible_chunks',
                             value=_visible_chunks)

        SETTINGS['last_camera_pos'] = SETTINGS['camera_track'][:]

    _cam_x = numbers.clip(
        LIFE[SETTINGS['controlling']]['pos'][0] - MAP_WINDOW_SIZE[0] / 2, 0,
        MAP_SIZE[0] - MAP_WINDOW_SIZE[0] / 2)
    _cam_y = numbers.clip(
        LIFE[SETTINGS['controlling']]['pos'][1] - MAP_WINDOW_SIZE[1] / 2, 0,
        MAP_SIZE[1] - MAP_WINDOW_SIZE[1] / 2)

    maps.render_lights()

    if '--worldmap' in sys.argv:
        render_map.render_map(WORLD_INFO['map'],
                              force_camera_pos=(_cam_x, _cam_y, 2))
    else:
        render_map.render_map(WORLD_INFO['map'],
                              los=LIFE[SETTINGS['controlling']]['fov'],
                              force_camera_pos=(_cam_x, _cam_y, 2))

    items.draw_items()
    life.draw_life()

    if LIFE[SETTINGS['controlling']]['dead'] and not EVENTS:
        if not death():
            return False

    if SETTINGS['draw life info'] and SETTINGS['following']:
        life.draw_life_info()

    gfx.draw_message_box()

    menus.align_menus()
    menus.draw_menus()

    gfx.draw_status_line()
    gfx.draw_console()
    gfx.start_of_frame()
    gfx.end_of_frame()

    if '--fps' in sys.argv:
        print tcod.sys_get_fps()

    if (SETTINGS['recording'] and _player_moved and not EVENTS
            and not MENUS) or '--worldmap' in sys.argv:
        gfx.screenshot()

        if '--worldmap' in sys.argv:
            SETTINGS['running'] = False
コード例 #4
0
ファイル: reactor-3.py プロジェクト: hovatterz/Reactor-3
def main():
    _player_moved = False
    _refresh_map = False

    get_input()
    handle_input()

    if not LIFE[SETTINGS["controlling"]]["dead"]:
        if LIFE[SETTINGS["controlling"]]["asleep"]:
            gfx.fade_to_black(255)
            gfx.start_of_frame()
            gfx.end_of_frame()

        while LIFE[SETTINGS["controlling"]]["asleep"]:
            _played_moved = True
            _refresh_map = True

            gfx.title(LIFE[SETTINGS["controlling"]]["asleep_reason"])
            logic.tick_all_objects(ignore_tickrate=True, ignore_pause=True)

            if LIFE[SETTINGS["controlling"]]["dead"]:
                break
    else:
        _player_moved = True

    if _refresh_map:
        gfx.refresh_view("map")

    if not _player_moved:
        logic.tick_all_objects(ignore_tickrate=True)

    draw_targeting()
    move_camera(SETTINGS["camera_track"])

    # TODO: Deselect so we can get rid of this call
    if SELECTED_TILES[0]:
        gfx.refresh_view("map")

    if not SETTINGS["last_camera_pos"] == SETTINGS["camera_track"][:]:
        if EVENTS or MENUS:
            _visible_chunks = sight.scan_surroundings(LIFE[SETTINGS["following"]], judge=False, get_chunks=True)
            alife.brain.flag(LIFE[SETTINGS["following"]], "visible_chunks", value=_visible_chunks)

            _cam_x = numbers.clip(
                LIFE[SETTINGS["following"]]["pos"][0] - MAP_WINDOW_SIZE[0] / 2, 0, MAP_SIZE[0] - MAP_WINDOW_SIZE[0] / 2
            )
            _cam_y = numbers.clip(
                LIFE[SETTINGS["following"]]["pos"][1] - MAP_WINDOW_SIZE[1] / 2, 0, MAP_SIZE[1] - MAP_WINDOW_SIZE[1] / 2
            )

        else:
            _visible_chunks = sight.scan_surroundings(LIFE[SETTINGS["controlling"]], judge=False, get_chunks=True)
            alife.brain.flag(LIFE[SETTINGS["controlling"]], "visible_chunks", value=_visible_chunks)

        SETTINGS["last_camera_pos"] = SETTINGS["camera_track"][:]

    _cam_x = numbers.clip(
        LIFE[SETTINGS["controlling"]]["pos"][0] - MAP_WINDOW_SIZE[0] / 2, 0, MAP_SIZE[0] - MAP_WINDOW_SIZE[0] / 2
    )
    _cam_y = numbers.clip(
        LIFE[SETTINGS["controlling"]]["pos"][1] - MAP_WINDOW_SIZE[1] / 2, 0, MAP_SIZE[1] - MAP_WINDOW_SIZE[1] / 2
    )

    maps.render_lights()

    if "--worldmap" in sys.argv:
        render_map.render_map(WORLD_INFO["map"], force_camera_pos=(_cam_x, _cam_y, 2))
    else:
        render_map.render_map(
            WORLD_INFO["map"], los=LIFE[SETTINGS["controlling"]]["fov"], force_camera_pos=(_cam_x, _cam_y, 2)
        )

    items.draw_items()
    life.draw_life()

    if LIFE[SETTINGS["controlling"]]["dead"] and not EVENTS:
        if not death():
            return False

    if SETTINGS["draw life info"] and SETTINGS["following"]:
        life.draw_life_info()

    gfx.draw_message_box()

    menus.align_menus()
    menus.draw_menus()

    gfx.draw_status_line()
    gfx.draw_console()
    gfx.start_of_frame()
    gfx.end_of_frame()

    if "--fps" in sys.argv:
        print tcod.sys_get_fps()

    if (SETTINGS["recording"] and logic.can_tick()) or "--worldmap" in sys.argv:
        gfx.screenshot()

        if "--worldmap" in sys.argv:
            SETTINGS["running"] = False
コード例 #5
0
ファイル: terraform.py プロジェクト: athros/Reactor-3
def chunk_map():
	move_camera(CURSOR_POS)
	maps.draw_chunk_map()
	gfx.start_of_frame()
	gfx.end_of_frame()
コード例 #6
0
ファイル: terraform.py プロジェクト: penny64/Reactor-3
def chunk_map():
    move_camera(CURSOR_POS)
    maps.draw_chunk_map()
    gfx.start_of_frame()
    gfx.end_of_frame()