本文整理匯總了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);
}
示例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);
}
示例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();
}
示例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();
}