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


Java OrthogonalTiledMapRenderer類代碼示例

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


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

示例1: loadTiledMap

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public void loadTiledMap(String mapName){
	logger.debug("Loading TiledMap: " + mapName);
	
	this.clear();
	
	try{
		map = new TmxMapLoader().load(mapName);
	}
	catch(Exception e){
		logger.error("Map load failed .. " + e.getMessage());
		return;
	}
	mapRenderer = new OrthogonalTiledMapRenderer(map,batch);
	
	createPhysics(map);
       createEntities(map);
       createSpawnZones(map);
       createDropOffPoints(map);
}
 
開發者ID:Deftwun,項目名稱:ZombieCopter,代碼行數:20,代碼來源:Level.java

示例2: onEnter

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public void onEnter() {
	super.onEnter();
	
	float w = Gdx.graphics.getWidth();
	float h = Gdx.graphics.getHeight();

	camera = new OrthographicCamera();
	camera.setToOrtho(false, (w / h) * 640, 640);
	camera.update();
	
	map = new TmxMapLoader().load("Resource/tiles.tmx");
	renderer = new OrthogonalTiledMapRenderer(map, 2f);//1f / 32f);
	
	func = CC.Scheduler().renderAfterSchedulePerFrame((t)->{
		camera.position.set(500, 320, 0);
		camera.update();
		renderer.setView(
				camera.combined,
				0, 0, 1000, 500);
		renderer.render();
		return false;
	}, 0, false);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:24,代碼來源:TiledMapTests.java

示例3: GameScreen

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
/**
 * Game Screen's constructor.
 * The Game Screen's is responsible for drawing the current game.
 *
 * @param game         The current game session.
 * @param currentLevel The game's level that the game screen will draw.
 */
public GameScreen(Armadillo game, int currentLevel) {
    this.game = game;

    model = new GameModel();
    this.currentLevel = currentLevel;
    loadNextMap();

    camera = createCamera();
    controller = new GameInputPoller(model);
    mapRenderer = new OrthogonalTiledMapRenderer(model.getMap(), game.getBatch());

    hud = new HudMenu(game, model);
    hud.getInputMultiplexer().addProcessor(new GameInputHandler(model));
    gameBackground = game.getAssetManager().get("background.png", Texture.class);
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:23,代碼來源:GameScreen.java

示例4: PlayState

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public PlayState(Server server, StateManager states)
{
	this.server = server;
	this.states = states;
	rewardForFisnishedQuestObserver = new RewardForFinishedQuestObserver(this, this);
	questEventsHandler = new EventsHandler(rewardForFisnishedQuestObserver);
	camera.setToOrtho(false);
	camera.viewportWidth = 3000;
	camera.viewportHeight = 1600;

	collisionMap.setScale(1);
	TiledMap map = loadMap();

	if (ServerSettings.isHeadless)
		mapRenderer = new NullOrthogonalTiledMapRenderer();
	else
		mapRenderer = new OrthogonalTiledMapRenderer(map, Assets.getBatch());

	Gdx.input.setInputProcessor(inputHandler);

	addNpcs();
	addGameObject(ObjectsIdentifiers.QUEST_BOARD, 100, 100);
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:24,代碼來源:PlayState.java

示例5: PlayState

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public PlayState(GameStateManager gsm) {
	super(gsm);
	Assets.loadGameStageAssets();
	Engine ashleyEngine = new Engine();
	LevelManager.loadLevel("maps/simple-map.tmx");
	_renderer = new OrthogonalTiledMapRenderer(LevelManager.tiledMap);
	_gameCamera = new OrthographicCamera();
	EntityFactory entityFactory = new EntityFactory(ashleyEngine);
	InputHandler inputhandler = new InputHandler(_gameCamera,entityFactory,gsm,ashleyEngine);
	_uiStage = new UiStage();
	_entityManager = new EntityManager(ashleyEngine, _batch, _gameCamera, inputhandler, _uiStage, gsm, entityFactory);

	InputMultiplexer multi = new InputMultiplexer();

	multi.addProcessor(_uiStage);
	multi.addProcessor(inputhandler);
	Gdx.input.setInputProcessor(multi);
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:19,代碼來源:PlayState.java

示例6: create

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
@Override
public void create () {
    float w = Gdx.graphics.getWidth  ();
    float h = Gdx.graphics.getHeight ();
    
    hud              = new Hud                        ();
    batch            = new SpriteBatch                ();
    hudBatch         = new SpriteBatch                ();
    hudRend          = new ShapeRenderer              ();
    shaper           = new ShapeRenderer              ();
    
    level1           = new LevelWithSpawns            ("dungeon_1.tmx", new Vector2(14,  7));
    level2           = new LevelWithSpawns            ("dungeon_2.tmx", new Vector2(18, 10));
    
    currentLevel     = level2;
    
    player           = new Player                     (new Texture("player_mage.png"), (int)currentLevel.spawn.x, (int)currentLevel.spawn.y);
    tiledMapRenderer = new OrthogonalTiledMapRenderer (level2.getLevel());
    camera           = new OrthographicCamera         ();
    
    camera.position.x  = player.x;
    camera.position.y  = player.y;
    camera.zoom        = 0.1f;
    camera.setToOrtho  (false,w,h);
    camera.update      ();
}
 
開發者ID:j4cobgarby,項目名稱:Dungeon,代碼行數:27,代碼來源:Main.java

示例7: MapLoader

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public MapLoader(OrthographicCamera camera, SendCommand sendCommand)
{
    this.camera = camera;
    this.tiledMap = new TmxMapLoader().load(Constants.TESTMAPPATH);
    this.tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
    this.blockLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Blocks");
    this.floorLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Floor");
    this.bombLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Bombs");
    this.itemLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Items");
    this.sendCommand = sendCommand;
    
    Constants.MAPTEXTUREWIDTH = blockLayer.getTileWidth();
    Constants.MAPTEXTUREHEIGHT = blockLayer.getTileWidth();
    
    findAllItemFields();
}
 
開發者ID:Aeo-Informatik,項目名稱:Space-Bombs,代碼行數:17,代碼來源:MapLoader.java

示例8: setNewMap

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
/**-------------------Getter & Setter-------------------**/
public void setNewMap(String path)
{
    this.tiledMap = new TmxMapLoader().load(path);
    this.tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
    
    this.blockLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Blocks");
    this.floorLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Floor");
    this.bombLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Bombs");
    this.itemLayer = (TiledMapTileLayer) tiledMap.getLayers().get("Items");

    Constants.MAPTEXTUREWIDTH = blockLayer.getTileWidth();
    Constants.MAPTEXTUREHEIGHT = blockLayer.getTileWidth();
    
    findAllItemFields();
}
 
開發者ID:Aeo-Informatik,項目名稱:Space-Bombs,代碼行數:17,代碼來源:MapLoader.java

示例9: CastleLevelEndingSceneHandler

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public CastleLevelEndingSceneHandler(Mario mario, TmxMap tileMap, GameCamera camera,
		 Array<IScrollingBackground> scrollingBbackgrounds, BitmapFont font, SpriteBatch spriteBatch,
		OrthogonalTiledMapRenderer renderer, Stage stage, Batch batch) {
	super(mario, tileMap, camera, scrollingBbackgrounds, font, spriteBatch, renderer, stage, batch);
	for (int i = 0; i < tileMap.getTileLayer().getWidth(); i++) {
		for (int j = 0; j < tileMap.getTileLayer().getHeight(); j++) {
			Cell cell = tileMap.getTileLayer().getCell(i, j);
			if (cell != null) {
				TiledMapTile tile = cell.getTile();
				int id = tile.getId();
				if (id==118) {
					tileToRemove.add(new Vector2(i,j));
				}
			}
		}
	}	
	for (AbstractEnemy enemy : tileMap.getEnemies()) {
		if (enemy.getEnemyType()==EnemyTypeEnum.BOWSER) {
			if (!enemy.isKilled()) {
				bowser = enemy;					
			} 
		}
	}
	updateEnemies = true;		
}
 
開發者ID:provenza24,項目名稱:Mario-Libgdx,代碼行數:26,代碼來源:CastleLevelEndingSceneHandler.java

示例10: AbstractCinematicSceneHandler

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
public AbstractCinematicSceneHandler(Mario mario, TmxMap tileMap, GameCamera camera,
		 Array<IScrollingBackground> backgrounds, BitmapFont font, SpriteBatch spriteBatch,
		OrthogonalTiledMapRenderer renderer, Stage stage, Batch batch) {
	super();
	this.mario = mario;
	this.tileMap = tileMap;
	this.camera = camera;
	this.scrollingBackgrounds = backgrounds;
	this.font = font;
	this.spriteBatch = spriteBatch;
	this.renderer = renderer;
	this.stage = stage;
	this.batch = batch;
	this.updateItems = true;	
	this.updateEnemies = false;
	this.updatePlateforms = false;
	this.updateSfxSprites = true;
}
 
開發者ID:provenza24,項目名稱:Mario-Libgdx,代碼行數:19,代碼來源:AbstractCinematicSceneHandler.java

示例11: GameScreen

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
/**
 * 
 */
public GameScreen(SupaBox game) {
	this.game = game;
	
	//float aspectRatio = (float) Gdx.graphics.getHeight() / (float) Gdx.graphics.getWidth();
	
	camera = new OrthographicCamera();
	viewport = new FitViewport(24, 16, camera);
	viewport.apply();
	
	camera.position.set(viewport.getWorldWidth() / 2, viewport.getWorldHeight() / 2, 0);
	
	debugRenderer = new Box2DDebugRenderer();
	world = new World(new Vector2(0, -9.8f), true);
	
	mapLoader = new TmxMapLoader();
	map = mapLoader.load("crate.tmx");
	mapRenderer = new OrthogonalTiledMapRenderer(map, 1f / SupaBox.PPM);
	
	bodyBuilder = new BodyBuilder();
	bodyBuilder.createBodies(entities, world, map);
}
 
開發者ID:ryanshappell,項目名稱:SupaBax,代碼行數:25,代碼來源:GameScreen.java

示例12: create

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
@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.update();

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

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

	map = new TmxMapLoader().load("data/maps/tiled/super-koalio/level1.tmx");
	renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:19,代碼來源:TiledMapDirectLoaderTest.java

示例13: create

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
@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.update();

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

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

	map = new TideMapLoader().load("data/maps/tide/Map01.tide");
	renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:19,代碼來源:TideMapDirectLoaderTest.java

示例14: create

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
@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.update();

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

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

	map = new AtlasTmxMapLoader().load("data/maps/tiled-atlas-processed/test.tmx");
	renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:19,代碼來源:TiledMapAtlasDirectLoaderTest.java

示例15: create

import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; //導入依賴的package包/類
@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 TideMapLoader(new InternalFileHandleResolver()));
	assetManager.load("data/maps/tide/Map01.tide", TiledMap.class);
	assetManager.finishLoading();
	map = assetManager.get("data/maps/tide/Map01.tide");
	renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:24,代碼來源:TideMapAssetManagerTest.java


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