Java 类com.badlogic.gdx.maps.tiled.renderers.IsometricTiledMapRenderer 实例源码

项目:libgdxcn    文件:TiledMapAssetManagerTest.java   
@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, (w / h) * 10, 10);
    camera.zoom = 2;
    camera.update();

    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);

    font = new BitmapFont();
    batch = new SpriteBatch();

    assetManager = new AssetManager();
    assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    assetManager.load("data/maps/tiled/isometric_grass_and_water.tmx", TiledMap.class);
    assetManager.finishLoading();
    map = assetManager.get("data/maps/tiled/isometric_grass_and_water.tmx");
    renderer = new IsometricTiledMapRenderer(map, 1f / 64f);
}
项目:RageGo    文件:GoGameScreen.java   
/**
 * Loads the map and sets up its display parameters
 */
private void setupMap() {
    manager.load("com/ragego/gui/maps/" + getMapToLoad() + ".tmx", TiledMap.class);
    manager.finishLoading();
    Gdx.app.log(getClass().getCanonicalName(), "Map loaded");
    map = manager.get("com/ragego/gui/maps/" + getMapToLoad() + ".tmx");
    renderer = new IsometricTiledMapRenderer(map);
    worldCamera = new OrthographicCamera();
    gridLayer = (TiledMapTileLayer) map.getLayers().get("grid");
    selection = (TiledMapTileLayer) map.getLayers().get("selection");
    final TiledMapTileSet toolTS = map.getTileSets().getTileSet("toolTS");
    selectionTile = toolTS.getTile(toolTS.getProperties().get("firstgid", Integer.class));
    backgroundColor = new Color(GuiUtils.colorFromHexString(map.getProperties().get("backgroundcolor", String.class)));
}
项目:Hakd    文件:GameScreen.java   
public IsometricTiledMapRenderer getRenderer() {
    return renderer;
}
项目:Hakd    文件:GameScreen.java   
public void setRenderer(IsometricTiledMapRenderer renderer) {
    this.renderer = renderer;
}
项目:Hakd    文件:Room.java   
public Room(Character player, GamePlay gamePlay, RoomMap roomMap) {
    this.player = player;
    this.gamePlay = gamePlay;

    ((Player) player).setRoom(this);
    deviceTileMap = new HashMap<Vector2, DeviceTile>();


    map = new TmxMapLoader().load(Util.ASSETS + "maps/" + roomMap.toString() + ".tmx");

    floorLayer = (TiledMapTileLayer) map.getLayers().get("floor");
    wallLayer = (TiledMapTileLayer) map.getLayers().get("wall");
    deviceLayer = map.getLayers().get("devices");
    objectLayer = (TiledMapTileLayer) map.getLayers().get("objects");

    ROOM_HEIGHT = floorLayer.getHeight();
    TILE_SIZE = (int) floorLayer.getTileWidth();

    buildRoom();
    gamePlay.getGameScreen().setRenderer(new IsometricTiledMapRenderer(map, 1f / TILE_SIZE)); // don't let this round, that is why 1 is a floatmap

    if (player.getNetwork() == null) {
        City playerCity = player.getCity();
        List<InternetProviderNetwork> isps = new ArrayList<InternetProviderNetwork>(5);
        for (Network n : playerCity.getNetworks().values()) {
            if (n instanceof InternetProviderNetwork) {
                isps.add((InternetProviderNetwork) n);
            }
        }

        network = NetworkFactory.createPlayerNetwork((Player) player, playerCity, gamePlay.getInternet());
        InternetProviderNetwork isp = isps.get((int) (Math.random() * isps.size()));
        gamePlay.getInternet().addNetworkToInternet(network, isp);
        playerCity.addNetwork(network);
        network.setDeviceLimit(1);

        Device device = DeviceFactory.createDevice(0, Device.DeviceType.SERVER);
        HakdSprite tile = new HakdSprite(Hakd.assets.get("nTextures.txt", TextureAtlas.class).findRegion("d0"));
        tile.setSize(tile.getWidth() / TILE_SIZE, tile.getHeight() / TILE_SIZE);
        tile.setObject(device);
        device.setTile(tile);
        network.addDevice(device);
    } else {
        network = player.getNetwork();
    }
    int deviceLimit = deviceLayer.getObjects().getCount();
    network.setDeviceLimit(deviceLimit);
    devices = network.getDevices();
}