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


Java GdxRuntimeException類代碼示例

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


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

示例1: parse

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@Override
public void parse (char[] data, int offset, int length) {
	debug = btParser.debugLevel > BehaviorTreeParser.DEBUG_NONE;
	root = null;
	clear();
	super.parse(data, offset, length);

	// Pop all task from the stack and check their minimum number of children
	popAndCheckMinChildren(0);

	Subtree<E> rootTree = subtrees.get("");
	if (rootTree == null) throw new GdxRuntimeException("Missing root tree");
	root = rootTree.rootTask;
	if (root == null) throw new GdxRuntimeException("The tree must have at least the root task");

	clear();
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:18,代碼來源:BehaviorTreeParser.java

示例2: loadShader

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@Override
public ShaderProgram loadShader(String vsFilePath)
{
	if(!Game.isSupportOpenGL20)
		return null;
	
	String fsProcess = vsFilePath.substring(0, vsFilePath.length()-7);
	fsProcess += "fs.glsl";
	ShaderProgram shader = new ShaderProgram(Gdx.files.internal(vsFilePath),
			Gdx.files.internal(fsProcess));
	
	if(shader.isCompiled())
		return shader;
	else
		throw new GdxRuntimeException("Cannot compile the shader");
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:17,代碼來源:DefaultGameAsset.java

示例3: PlayAnimation

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
public void PlayAnimation(Animation animation, Rectangle newRegionOnTexture)
  {
if (animation == null && this.animation == null)
          throw new GdxRuntimeException("No animation is currently playing.");
      // If this animation is already running, do not restart it.
      if (this.animation == animation)
          return;

      // Start the new animation.
      this.animation = animation;
      this.frameIndex = 0;
      this.animationTimeline = 0.0f;
      
      this.setRegionX((int) newRegionOnTexture.x);
      this.setRegionY((int) newRegionOnTexture.y);
      this.setRegionWidth((int) newRegionOnTexture.getWidth());
      this.setRegionHeight((int) newRegionOnTexture.getHeight());
      onAnimationChanged();
  }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:20,代碼來源:AnimatedSprite.java

示例4: createTempBody

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
public Body createTempBody(float x, float y, FixtureDef fixtureDef) {
// Dynamic Body
BodyDef bodyDef = new BodyDef();
if (box2dDebug)
    bodyDef.type = BodyType.StaticBody;
else
    bodyDef.type = BodyType.DynamicBody;

// transform into box2d
x = x * WORLD_TO_BOX;
y = y * WORLD_TO_BOX;

bodyDef.position.set(x, y);

Body body = world.createBody(bodyDef);

Shape shape = new CircleShape();
((CircleShape) shape).setRadius(1 * WORLD_TO_BOX);

if (fixtureDef == null)
    throw new GdxRuntimeException("fixtureDef cannot be null!");
fixtureDef.shape = shape;
body.createFixture(fixtureDef);
return body;
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:26,代碼來源:PhysicsManager.java

示例5: PlayAnimation

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
public void PlayAnimation(Sprite sprite, Animation animation,
    Rectangle newRegionOnTexture) {
if (animation == null && this.animation == null)
    throw new GdxRuntimeException("No animation is currently playing.");
// If this animation is already running, do not restart it.
if (this.animation == animation)
    return;

// Start the new animation.
this.animation = animation;
this.frameIndex = 0;
this.animationTimeline = 0.0f;

sprite.setRegionX((int) newRegionOnTexture.x);
sprite.setRegionY((int) newRegionOnTexture.y);
sprite.setRegionWidth((int) newRegionOnTexture.getWidth());
sprite.setRegionHeight((int) newRegionOnTexture.getHeight());
onAnimationChanged();
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:20,代碼來源:AnimationPlayer.java

示例6: createTempBody

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
public Body createTempBody(float x, float y, FixtureDef fixtureDef) {
	// Dynamic Body
	BodyDef bodyDef = new BodyDef();
	if (box2dDebug)
		bodyDef.type = BodyType.StaticBody;
	else
		bodyDef.type = BodyType.DynamicBody;

	// transform into box2d
	x = x * WORLD_TO_BOX;
	y = y * WORLD_TO_BOX;

	bodyDef.position.set(x, y);

	Body body = world.createBody(bodyDef);

	Shape shape = new CircleShape();
	((CircleShape) shape).setRadius(1 * WORLD_TO_BOX);

	if (fixtureDef == null)
		throw new GdxRuntimeException("fixtureDef cannot be null!");
	fixtureDef.shape = shape;
	body.createFixture(fixtureDef);
	return body;
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:26,代碼來源:PhysicsTiledScene.java

示例7: preRender

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
/**
 * Call right before starting render stage of Scene 3D
 */
protected void preRender() {
	//Create default member for managers if the managers don't have any member. 
	if(camera.count() == 0)
	{
		camera.add("default", new FreeCamera(70, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), new Vector3(0, 5, 5), 0,135));
		camera.setActiveCamera("default");
	}
	if(light.count() == 0 && Game.isSupportOpenGL20)
	{
		light.addBaseLight("default", new DirectionLight(new Vector3(1, 1, 1), new Vector3(1, 1, -1)));
	}
	if(shader.count() == 0 && Game.isSupportOpenGL20)
	{
		String vs = loadShaderFile("effect/default-vs.glsl");
		String fs = loadShaderFile("effect/default-fs.glsl");
		ShaderProgram s = new ShaderProgram(vs , fs);
		if(!s.isCompiled())
		{
			throw new GdxRuntimeException("Cannot compile default shader");
		}
		shader.add("default", s);
		shader.setActiveShader("default");
	}
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:28,代碼來源:BaseGameScene3D.java

示例8: render

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@Override
public void render() {
	super.render();
	frameNum++;
	if (frameNum != 2)
		return;
	try {
		NetworkingManager.clientPreInit(new ClientNetworkingParameter(address, port));
		CubesClient cubesClient = new CubesClient();
		Adapter.setServer(null);
		Adapter.setClient(cubesClient);
		Adapter.setMenu(new WorldLoadingMenu());
	} catch (Exception e) {
		if (e instanceof GdxRuntimeException && e.getCause() instanceof Exception)
			e = (Exception) e.getCause();
		Adapter.setClient(null);
		Log.error("Failed to connect", e);
		Log.error("Address:" + address + " Port:" + port);
		Adapter.setMenu(new ConnectionFailedMenu(e));
		Adapter.setClient(null);
		Adapter.setServer(null);
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:24,代碼來源:MultiplayerLoadingMenu.java

示例9: getDependencies

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle tmxFile,
		com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter) {
	Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>();
	try {
		root = xml.parse(tmxFile);

		Element properties = root.getChildByName("properties");
		if (properties != null) {
			for (Element property : properties.getChildrenByName("property")) {
				String name = property.getAttribute("name");
				String value = property.getAttribute("value");
				if (name.startsWith("atlas")) {
					FileHandle atlasHandle = Gdx.files.internal(value);
					dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class));
				}
			}
		}
	} catch (IOException e) {
		throw new GdxRuntimeException("Unable to parse .tmx file.");
	}
	return dependencies;
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:25,代碼來源:KyperMapLoader.java

示例10: loadAsync

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle tmxFile,
		com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter) {
	map = null;
	if (parameter != null) {
		convertObjectToTileSpace = parameter.convertObjectToTileSpace;
		flipY = parameter.flipY;
	} else {
		convertObjectToTileSpace = false;
		flipY = true;
	}

	try {
		map = loadMap(root, tmxFile, new AtlasResolver.AssetManagerAtlasResolver(manager));
	} catch (Exception e) {
		throw new GdxRuntimeException("Couldn't load tilemap '" + fileName + "'", e);
	}
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:19,代碼來源:KyperMapLoader.java

示例11: TiledObjectTypes

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
public TiledObjectTypes(String file) {
	xml_reader = new XmlReader();
	try {
		root = xml_reader.parse(Gdx.files.internal(file));
	} catch (IOException e) {
		e.printStackTrace();
	}
	types = new ObjectMap<String, TiledObjectTypes.TiledObjectType>();
	
	if(root == null)
		throw new GdxRuntimeException(String.format("Unable to parse file %s. make sure it is the correct path.", file));
	Array<Element> types = root.getChildrenByName("objecttype");
	for (Element element : types) {
		TiledObjectType tot = new TiledObjectType(element.get("name"));
		Array<Element> properties  = element.getChildrenByName("property");
		for (int i = 0; i < properties.size; i++) {
			Element element2 = properties.get(i);
			TypeProperty property = new TypeProperty(element2.get("name"), element2.get("type"), element2.hasAttribute("default")?element2.get("default"):"");
			tot.addProperty(property);
		}
		this.types.put(tot.name, tot);
	}
	
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:25,代碼來源:TiledObjectTypes.java

示例12: render

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@Override
public void render() {
  super.render();
  frameNum++;
  if (frameNum != 2) return;
  try {
    NetworkingManager.clientPreInit(new ClientNetworkingParameter(address, port));
    CubesClient cubesClient = new CubesClient();
    Adapter.setServer(null);
    Adapter.setClient(cubesClient);
    Adapter.setMenu(new WorldLoadingMenu());
  } catch (Exception e) {
    if (e instanceof GdxRuntimeException && e.getCause() instanceof Exception) e = (Exception) e.getCause();
    Adapter.setClient(null);
    Log.error("Failed to connect", e);
    Log.error("Address:" + address + " Port:" + port);
    Adapter.setMenu(new ConnectionFailedMenu(e));
    Adapter.setClient(null);
    Adapter.setServer(null);
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:22,代碼來源:MultiplayerLoadingMenu.java

示例13: getOwnerCharacterName

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
private String getOwnerCharacterName() {
	if (ownerCharacterName == null && s_ownerCharacterId != null) {
		try {
			GameObject go = GameState.getGameObjectById(s_ownerCharacterId);
			if (go instanceof GameCharacter) {
				ownerCharacterName =  ((GameCharacter) go).getName();
			} else {
				XmlReader xmlReader = new XmlReader();
				Element root = xmlReader.parse(Gdx.files
						.internal(Configuration.getFolderCharacters()
								+ s_ownerCharacterId + ".xml"));
				ownerCharacterName = root.getChildByName(
						XMLUtil.XML_PROPERTIES).get(
						XMLUtil.XML_ATTRIBUTE_NAME);
			}
		} catch (SerializationException e) {
			throw new GdxRuntimeException("Could not determine the owner with type "+s_ownerCharacterId, e);
		}
		if (ownerCharacterName == null) {
			throw new GdxRuntimeException("Could not determine the owner with type "+s_ownerCharacterId);
		}
	}
	return Strings.getString(ownerCharacterName);
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:25,代碼來源:ItemOwner.java

示例14: obtain

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
/** Create or reuse a btIndexedMesh instance based on the specified tag.
 * Use {@link #release()} to release the mesh when it's no longer needed. */
public static btIndexedMesh obtain(final Object tag,
		final FloatBuffer vertices, int sizeInBytesOfEachVertex, int vertexCount, int positionOffsetInBytes,
		final ShortBuffer indices, int indexOffset, int indexCount) {
	if (tag == null)
		throw new GdxRuntimeException("tag cannot be null");
	
	btIndexedMesh result = getInstance(tag);
	if (result == null) {
		result = new btIndexedMesh(vertices, sizeInBytesOfEachVertex, vertexCount, positionOffsetInBytes, indices, indexOffset, indexCount);
		result.tag = tag;
		instances.add(result);
	}
	result.obtain();
	return result;
}
 
開發者ID:xpenatan,項目名稱:gdx-bullet-gwt,代碼行數:18,代碼來源:btIndexedMesh.java

示例15: forbiddenRemoval

import com.badlogic.gdx.utils.GdxRuntimeException; //導入依賴的package包/類
@Test
public void forbiddenRemoval () {
	Array<Integer> array = new Array<Integer>();
	ImmutableArray<Integer> immutable = new ImmutableArray<Integer>(array);

	for (int i = 0; i < 10; ++i) {
		array.add(i);
	}

	boolean thrown = false;

	try {
		immutable.iterator().remove();
	} catch (GdxRuntimeException e) {
		thrown = true;
	}

	assertEquals(true, thrown);
}
 
開發者ID:DevelopersGuild,項目名稱:Planetbase,代碼行數:20,代碼來源:ImmutableArrayTests.java


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