當前位置: 首頁>>代碼示例>>Java>>正文


Java OrthogonalTiledMapRenderer.getSpriteBatch方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer.getSpriteBatch方法的典型用法代碼示例。如果您正苦於以下問題:Java OrthogonalTiledMapRenderer.getSpriteBatch方法的具體用法?Java OrthogonalTiledMapRenderer.getSpriteBatch怎麽用?Java OrthogonalTiledMapRenderer.getSpriteBatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer的用法示例。


在下文中一共展示了OrthogonalTiledMapRenderer.getSpriteBatch方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ScrollMap

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入方法依賴的package包/類
/**
 *
 * @param tileMap ширина, высота и размер тайла берется из первого слоя:
 * TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0);
 * cellSize = (int) bg.getTileHeight(); mapW = bg.getWidth(); mapH =
 * bg.getHeight();
 */
public ScrollMap(TiledMap tileMap) {
    mapCamera = new OrthographicCamera();
    mapRenderer = new OrthogonalTiledMapRenderer(tileMap, 1f/* / cellSize */);
    stageViewport = new ScreenViewport(new OrthographicCamera());
    TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0);
    cellSize = (int) bg.getTileHeight();
    mapW = bg.getWidth() * cellSize;
    mapH = bg.getHeight() * cellSize;
    mapHolder = new Actor();
    mapHolder.setSize(mapW, mapH);
    scrollPane = new ScrollPane(mapHolder);
    scrollPane.setOverscroll(false, false);
    root = new Table();
    root.setFillParent(true);
    root.add(scrollPane).fill().expand();
    stage = new Stage(stageViewport);
    stage.addActor(root);
    im = new InputMultiplexer();
    gameBatch = mapRenderer.getSpriteBatch();
    sprites = new Array<Sprite>();
    gestureDetector = new GestureDetector(gestureListener);
}
 
開發者ID:NaikSoftware,項目名稱:SaveUA,代碼行數:30,代碼來源:ScrollMap.java

示例2: SpriteManager

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入方法依賴的package包/類
public SpriteManager(Robin2DX game) {
	this.game = game;

	// Inicia la cámara para jugar
	camera = new OrthographicCamera();
	// La cámara mostrará 30 celdas de ancho por 30 celdas de alto
	camera.setToOrtho(false, 30, 30);
	camera.zoom = 1 / 2f;
	camera.update();
	
	// Carga el mapa y obtiene la capa de colisión (objetos con los que el personaje puede chocar)
	map = new TmxMapLoader().load("levels/tiledmap1.tmx");
	collisionLayer = (TiledMapTileLayer) map.getLayers().get("base");
	
	// Crea el renderizador del tiledmap
	mapRenderer = new OrthogonalTiledMapRenderer(map);
	// Hay que utilizar el spritebatch del mapa para pintar el nivel.
	// En caso contrario no ubica ni escala bien al personaje en el mapa
	batch = mapRenderer.getSpriteBatch();
	
	// Posiciona al jugador en el mapa
	player = new Player(15 * Constants.TILE_WIDTH, 10 * Constants.TILE_HEIGHT);
}
 
開發者ID:sfaci,項目名稱:libgdx,代碼行數:24,代碼來源:SpriteManager.java

示例3: WorldRenderer

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入方法依賴的package包/類
public WorldRenderer(DreamsGame game,World world) {
    this.game= game;
    this.world = world;

    modelsAndViews=new ModelsAndViews(game.getResourcesManager(),world);

    debugRenderer = new Box2DDebugRenderer();
    renderer = new OrthogonalTiledMapRenderer(world.getMap(), world.getParser().getUnitScale());
    world.removeParser();
    spriteBatch = (SpriteBatch) renderer.getSpriteBatch();
    cam = new OrthographicCamera();
}
 
開發者ID:Rubentxu,項目名稱:DreamsLibGdx,代碼行數:13,代碼來源:WorldRenderer.java

示例4: start

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入方法依賴的package包/類
/**
 * Inicia el GameRenderer
 */
public void start() {
	mapRenderer = new OrthogonalTiledMapRenderer(LevelManager.map);
	batch = mapRenderer.getSpriteBatch();
}
 
開發者ID:sfaci,項目名稱:libgdx,代碼行數:8,代碼來源:GameRenderer.java


注:本文中的com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer.getSpriteBatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。