当前位置: 首页>>代码示例>>Java>>正文


Java Application.LOG_DEBUG属性代码示例

本文整理汇总了Java中com.badlogic.gdx.Application.LOG_DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Java Application.LOG_DEBUG属性的具体用法?Java Application.LOG_DEBUG怎么用?Java Application.LOG_DEBUG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.badlogic.gdx.Application的用法示例。


在下文中一共展示了Application.LOG_DEBUG属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyDown

@Override
public boolean keyDown(int keyCode) {
    super.keyDown(keyCode);

    /**
     * If debugging is enabled
     */
    if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
        if (keyCode == Input.Keys.NUM_1) {
            changeScreen("game");
        }

        if (keyCode == Input.Keys.NUM_2) {
            changeScreen("placement");
        }

        if (keyCode == Input.Keys.NUM_3) {
            changeScreen("gameover");
        }
    }

    return true;
}
 
开发者ID:nikteg,项目名称:TDA367,代码行数:23,代码来源:MainMenuScreen.java

示例2: getLogLevel

/**
 * Gdx to Log4j log level mapping
 */
private static Level getLogLevel(int logLevel) {
    switch (logLevel) {
        case Application.LOG_NONE:
            return Level.OFF;
        case Application.LOG_ERROR:
            return Level.SEVERE;
        case Application.LOG_INFO:
            return Level.INFO;
        case Application.LOG_DEBUG:
            return Level.FINEST;
        default:
            return Level.ALL;
    }
}
 
开发者ID:MrStahlfelge,项目名称:gdx-gamesvcs,代码行数:17,代码来源:GpgsClient.java

示例3: LevelEntityFactory

public LevelEntityFactory(World world, Batch batch, String folderName) {
	this.world = world;
	this.batch = batch;

	if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
		String[] MAP_NAMES_DEBUG = new String[MAP_NAMES.length + 1];
		MAP_NAMES_DEBUG[0] = new String("debug.tmx");
		System.arraycopy(MAP_NAMES, 0, MAP_NAMES_DEBUG, 1, MAP_NAMES.length);

		loadLevelsFromList(folderName, MAP_NAMES_DEBUG);
	} else {
		loadLevelsFromList(folderName, MAP_NAMES);
	}
}
 
开发者ID:UoLCompSoc,项目名称:mobius,代码行数:14,代码来源:LevelEntityFactory.java

示例4: loadNextLevel

/**
 * <p>
 * Generates an array of entities for the next level, and returns it.
 * Returns false if there are no more levels.
 * </p>
 * 
 * @return true if a level was loaded, false if there are no more levels.
 */
public boolean loadNextLevel() {
	nextLevel();

	if (levelNumber >= levels.size()) {
		return false;
	} else {
		if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
			Gdx.app.debug("NEXT_LEVEL", "Level " + getCurrentLevelGroupName() + "'s manager contains "
					+ world.getManager(GroupManager.class).getEntities(levels.get(levelNumber)).size + " entities.");
		}

		return true;
	}
}
 
开发者ID:UoLCompSoc,项目名称:mobius,代码行数:22,代码来源:LevelEntityFactory.java

示例5: toggle

public static void toggle() {
	if (level == Application.LOG_DEBUG)
		level = Application.LOG_ERROR;
	else
		level = Application.LOG_DEBUG;

	Gdx.app.setLogLevel(level);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:8,代码来源:EngineLogger.java

示例6: generateGraph

public static MyGraph generateGraph(TiledMapTileLayer mapCollisionLayer,int numCols,int numRows,int tileW,int tileH) {
	final MyNode[][] nodes = new MyNode[numCols][numRows];
	final Array<MyNode> indexedNodes = new Array<MyNode>(numCols * numRows);
	//初始化数据地图
	final String[][] tiles = new String[numCols][numRows];
	for (int y = 0; y < numRows; y++) {
		for (int x = 0; x < numCols; x++) {
			tiles[x][y] = ".";
			if(mapCollisionLayer!=null&&mapCollisionLayer.getCell(x, y)!=null){
				tiles[x][y] = "#";
			}
		}
	}
	//print
	if(Gdx.app.getLogLevel()==Application.LOG_DEBUG){
		Gdx.app.debug(TAG,"----------------------------------");
		StringBuilder temp = new StringBuilder("\n");
		for (int y = 0; y < numRows; y++) {
			for (int x = 0; x < numCols; x++) {
				temp.append(tiles[x][numRows-1-y]) ;
			}
			temp.append("\n");
		}
		Gdx.app.debug(TAG,temp.toString());
		Gdx.app.debug(TAG,"----------------------------------");
	}
	int index = 0;
	for (int y = 0; y < numRows; y++) {
		for (int x = 0; x < numCols; x++, index++) {
			nodes[x][y] = new MyNode(index, x, y,tiles[x][y], 4);
			indexedNodes.add(nodes[x][y]);
		}
	}

	for (int y = 0; y < numRows; y++, index++) {
		for (int x = 0; x < numCols; x++, index++) {
			if (tiles[x][y].equals("#")) {
				continue;
			}

			if (x - 1 >= 0 && tiles[x - 1][y].equals(".")) {
				nodes[x][y].getConnections().add(new DefaultConnection<MyNode>(nodes[x][y], nodes[x - 1][y]));
			}

			if (x + 1 < numCols && tiles[x + 1][y].equals(".")) {
				nodes[x][y].getConnections().add(new DefaultConnection<MyNode>(nodes[x][y], nodes[x + 1][y]));
			}

			if (y - 1 >= 0 && tiles[x][y - 1].equals(".")) {
				nodes[x][y].getConnections().add(new DefaultConnection<MyNode>(nodes[x][y], nodes[x][y - 1]));
			}

			if (y + 1 < numRows && tiles[x][y + 1].equals(".")) {
				nodes[x][y].getConnections().add(new DefaultConnection<MyNode>(nodes[x][y], nodes[x][y + 1]));
			}

		}
	}

	return new MyGraph(indexedNodes);
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:61,代码来源:GraphGenerator.java

示例7: renderMap

private void renderMap(){

//		mapRenderer.getBatch().enableBlending();
//		mapRenderer.getBatch().setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

		mapRenderer.setView(worldController.camera);
//		mapRenderer.render();
		AnimatedTiledMapTile.updateAnimationBaseTime();
		mapRenderer.getBatch().begin();
		//地面
		TiledMapTileLayer groundMapLayer = (TiledMapTileLayer)worldController.mapMgr.getCurrentMap().getLayers().get(MapsManager.GROUND_LAYER);
		if( groundMapLayer != null){
			mapRenderer.renderTileLayer(groundMapLayer);
		}
		TiledMapTileLayer floorMapLayer = (TiledMapTileLayer)worldController.mapMgr.getCurrentMap().getLayers().get(MapsManager.FLOOR_LAYER);
		if( floorMapLayer != null){
			mapRenderer.renderTileLayer(floorMapLayer);
		}
		//blocks
		TiledMapTileLayer blockMapLayer = (TiledMapTileLayer)worldController.mapMgr.getCurrentMap().getLayers().get(MapsManager.BLOCK_LAYER);
		if( blockMapLayer != null && Gdx.app.getLogLevel()== Application.LOG_DEBUG){
			mapRenderer.renderTileLayer(blockMapLayer);
		}
		mapRenderer.getBatch().end();

		mapRenderer.getBatch().begin();
		//aim
		if(worldController.aim !=null){
			worldController.aim.draw(mapRenderer.getBatch());
		}
		//show roles order by Y-axis
		List<Sprite> temp =new ArrayList<Sprite>();
		temp.add(worldController.player);
		temp.addAll(worldController.mapMgr.npcs);
		temp.addAll(worldController.mapMgr.enemies);
		temp.addAll(worldController.mapMgr.traps);
		Collections.sort(temp, new Comparator<Sprite>() {
			@Override
			public int compare(Sprite lhs, Sprite rhs) {
				// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
				return lhs.getY() > rhs.getY() ? -1 : (lhs.getY() < rhs.getY() ) ? 1 : 0;
			}
		});
		for (Sprite sprite : temp) {
			sprite.draw(mapRenderer.getBatch());
		}
		//ceil layer
		TiledMapTileLayer ceilMapLayer = (TiledMapTileLayer)worldController.mapMgr.getCurrentMap().getLayers().get(MapsManager.CEILING_LAYER);
		if( ceilMapLayer != null){
			mapRenderer.renderTileLayer(ceilMapLayer);
		}
		if(worldController.skill!=null)worldController.skill.draw(mapRenderer.getBatch());
		//TODO Sky Layer

		mapRenderer.getBatch().end();
	}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:56,代码来源:WorldRenderer.java

示例8: process

@Override
protected void process(Entity e) {
	// TODO: More portable implementation - keys in PlayerInputListener?

	PlayerState ps = animationStateMapper.get(e);

	// TODO: remove movement intended for debug
	if (Gdx.input.isKeyPressed(Keys.S)) {
		velocityMapper.get(e).velocity.x = 0;
		ps.state = HumanoidAnimationState.STANDING;
	} else if (Gdx.input.isKeyPressed(Keys.A)) {
		velocityMapper.get(e).velocity.x = -PlayerConstants.RUN_VELOCITY;
		if (ps.state != HumanoidAnimationState.JUMPING)
			ps.state = HumanoidAnimationState.RUNNING;
	}

	if (Gdx.input.isKeyPressed(Keys.D)) {
		velocityMapper.get(e).velocity.x = +PlayerConstants.RUN_VELOCITY;
		if (ps.state != HumanoidAnimationState.JUMPING)
			ps.state = HumanoidAnimationState.RUNNING;
	}

	if (Gdx.input.isKeyPressed(Keys.SPACE)) {
		if (hasReleasedSpace && ps.state != HumanoidAnimationState.JUMPING) {
			velocityMapper.get(e).velocity.y = PlayerConstants.JUMP_VELOCITY;
			ps.state = HumanoidAnimationState.JUMPING;
			hasReleasedSpace = false;
		}
	} else {
		hasReleasedSpace = true;
	}

	if (Gdx.input.isKeyPressed(Keys.P)) {
		instance.resetPlayer();
	}

	if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
		if (Gdx.input.isKeyPressed(Keys.NUMPAD_6)) {
			world.getMapper(Position.class).get(e).position.x += 2.0f;
		}
	}
}
 
开发者ID:UoLCompSoc,项目名称:mobius,代码行数:42,代码来源:PlayerInputSystem.java

示例9: process

@Override
protected void process(Entity e) {
	if (timeSinceLastClick > CLICK_WAIT_TIME && hasReleased) {
		Position p = positionMapper.get(e);
		PlatformSprite platformSprite = platformSpriteMapper.get(e);

		boolean isChild = childLinkedMapper.get(e) != null;

		platformSprite.rectangle.x = p.position.x;
		platformSprite.rectangle.y = p.position.y;

		if (isChild) {
			platformSprite.rectangle.y -= platformSprite.spriteHeight;
		}

		if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
			clickFlag = true;

			mouse.set(Gdx.input.getX(), Gdx.input.getY(), 0.0f);
			mouse = camera.unproject(mouse, 0.0f, 0.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

			if (platformSprite.rectangle.contains((float) mouse.x, (float) mouse.y)) {
				// if this entity is a child, move its parent.
				Entity actualEntity = (isChild ? childLinkedMapper.get(e).parentEntity : e);

				DxLayer dxLayer = dxLayerMapper.get(actualEntity);
				MovingLayer movingLayer = (dxLayer != null ? dxLayer : dyLayerMapper.get(actualEntity));
				FadableLayer fadableLayer = fadableLayerMapper.get(actualEntity);

				final int degree = 1; // could be different in future

				if (movingLayer != null) {
					collisionSystem.platformInteracted(movingLayer.layer, degree * movingLayer.tempDirection);
					movingLayer.interact(positionMapper.get(actualEntity), degree);
				} else if (fadableLayer != null) {
					collisionSystem.platformInteracted(fadableLayer.layer, degree);
					fadableLayer.interact(opacityMapper.get(actualEntity), degree);
				}

				if (movingLayer == null && fadableLayer == null) {
					Gdx.app.error("PLATFORM_INPUT",
							"Invalid interactable platform (neither movable or fadable) detected.");
				}
			}
		}

		if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
			if (Gdx.input.isButtonPressed(Buttons.RIGHT)) {
				Gdx.app.debug("PLATFORM_INPUT", "Detected platform rectangle:\nx: " + platformSprite.rectangle.x
						+ "\ny: " + platformSprite.rectangle.y + "\nw: " + platformSprite.rectangle.width + "\nh: "
						+ platformSprite.rectangle.height);
			}
		}
	} else if (!Gdx.input.isButtonPressed(Buttons.LEFT)) {
		hasReleased = true;
	}
}
 
开发者ID:UoLCompSoc,项目名称:mobius,代码行数:57,代码来源:PlatformInputSystem.java

示例10: render

@Override
public void render() {
	float deltaTime = Gdx.graphics.getDeltaTime();
	world.setDelta(deltaTime);

	camera.update();

	Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

	// TODO: Fix dirty hack with global state in this line.
	PlayerConstants.interacting = Gdx.input.isKeyPressed(Keys.W);

	world.process();

	if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
		timeSinceLastDebug += deltaTime;

		if (timeSinceLastDebug > DEBUG_COOLDOWN) {
			if (Gdx.input.isKeyPressed(Keys.F10)) {
				nextLevel();
				timeSinceLastDebug = 0.0f;
			}

			if (Gdx.input.isKeyPressed(Keys.F8)) {
				timeSinceLastDebug = 0.0f;
				Position p = playerEntity.getComponent(Position.class);
				Gdx.app.debug("PLAYER_POS", "Player is located at (" + p.position.x + ", " + p.position.y
						+ "), int=(" + (int) p.position.x + ", " + (int) p.position.y + ").");
			} else if (Gdx.input.isKeyPressed(Keys.F9)) {
				timeSinceLastDebug = 0.0f;
				debugEntities();
			} else if (Gdx.input.isKeyPressed(Keys.F11)) {
				String inventString = "";

				for (Item i : playerEntity.getComponent(Inventory.class).inventoryList) {
					inventString += i.name + "\n";
				}

				Gdx.app.debug("PLAYER_INVENTORY", "Player inventory contains:\n" + inventString);
				timeSinceLastDebug = 0.0f;
			}
		}
	}
}
 
开发者ID:UoLCompSoc,项目名称:mobius,代码行数:45,代码来源:MobiusListingGame.java

示例11: debugMode

public static boolean debugMode() {
	if (level == Application.LOG_DEBUG)
		return true;

	return false;
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:6,代码来源:EngineLogger.java

示例12: setDebug

public static void setDebug() {
	level = Application.LOG_DEBUG;

	Gdx.app.setLogLevel(level);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:5,代码来源:EngineLogger.java


注:本文中的com.badlogic.gdx.Application.LOG_DEBUG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。