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


Java Audio类代码示例

本文整理汇总了Java中com.badlogic.gdx.Audio的典型用法代码示例。如果您正苦于以下问题:Java Audio类的具体用法?Java Audio怎么用?Java Audio使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: load

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T load(Class<T> type, String filepath,
		Object... parameters) {
	T output = null;
	setAssetClass(type);
	try {
		if (gameAsset == null)
			gameAsset = new DefaultGameAsset();
		if (type == Texture.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadTexture(filepath);
			else if (parameters.length == 1) {
				output = (T) gameAsset.loadTexture(filepath,
						(Format) parameters[0], true);
			} else if (parameters.length == 2) {
				output = (T) gameAsset.loadTexture(filepath,
						(Format) parameters[0], (Boolean) parameters[1]);
			} else {
				throw new GdxRuntimeException("Parameters is not valid!");
			}
		} else if (type == BitmapFont.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadBitmapFont(filepath);
			else if (parameters.length == 1) {
				output = (T) gameAsset.loadBitmapFont(filepath,
						(String) parameters[0]);
			} else {
				throw new GdxRuntimeException("Parameters is not valid!");
			}
		} else if (type == TextureRegion.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadTextureRegion(filepath);
			else if (parameters.length == 1) {
				output = (T) gameAsset.loadTextureRegion(filepath,
						(Rectangle) parameters[0]);
			} else if (parameters.length == 2) {
				output = (T) gameAsset.loadTextureRegion(
						(Texture) parameters[0], (Rectangle) parameters[1]);
			} else {
				throw new GdxRuntimeException("Parameters is not valid!");
			}
		} else if (type == Music.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadMusic(filepath);
			else if (parameters.length == 1) {
				output = (T) gameAsset.loadMusic(filepath,
						(Float) parameters[0]);
			} else {
				throw new GdxRuntimeException("Parameters is not valid!");
			}
		} else if (type == Audio.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadSound(filepath);
		} else if (type == ShaderProgram.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadShader(filepath);
			else if (parameters.length == 1) {
				output = (T) gameAsset.loadShader(filepath,
						(String) parameters[0]);
			} else {
				throw new GdxRuntimeException("Parameters is not valid!");
			}
		} else if (type == StillModel.class) {
			if (parameters.length == 0)
				output = (T) gameAsset.loadModel(filepath);
		}
	} catch (Exception ex) {
		throw new GdxRuntimeException("Invalid parameters you passed");
	}

	return output;
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:73,代码来源:AssetLoader.java

示例2: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio () {
   return audio;
}
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:5,代码来源:CardBoardAndroidApplication.java

示例3: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio() {
    return audio;
}
 
开发者ID:SiliconLabs,项目名称:thunderboard-android,代码行数:5,代码来源:GdxDemoActivity.java

示例4: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio() {
    return Gdx.audio;
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:5,代码来源:GdxAppStub.java

示例5: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
public Audio getAudio () {
	return null;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:4,代码来源:JglfwApplication.java

示例6: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio () {
	return Gdx.audio;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:GwtApplication.java

示例7: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio() {
	return audio;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:HeadlessApplication.java

示例8: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio () {
	return audio;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:IOSApplication.java

示例9: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio () {
    return Gdx.audio;
}
 
开发者ID:neuroradiology,项目名称:TinyVoxel,代码行数:5,代码来源:GwtApplication.java

示例10: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
@Override
public Audio getAudio() {
	return Gdx.audio;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:5,代码来源:GwtApplication.java

示例11: getAudio

import com.badlogic.gdx.Audio; //导入依赖的package包/类
public Audio getAudio()
{
  return this.audio;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:5,代码来源:AndroidApplication.java


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