本文整理汇总了Java中com.badlogic.gdx.utils.LongMap类的典型用法代码示例。如果您正苦于以下问题:Java LongMap类的具体用法?Java LongMap怎么用?Java LongMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongMap类属于com.badlogic.gdx.utils包,在下文中一共展示了LongMap类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: write
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public void write (Kryo kryo, Output output, LongMap map) {
int length = map.size;
output.writeVarInt(length, true);
output.writeBoolean(false); // whether type is written (in case future version of LongMap supports type awareness)
Serializer valueSerializer = null;
if (valueGenericType != null) {
if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
valueGenericType = null;
}
for (Iterator iter = map.iterator(); iter.hasNext();) {
LongMap.Entry entry = (LongMap.Entry)iter.next();
output.writeLong(entry.key);
if (valueSerializer != null) {
kryo.writeObjectOrNull(output, entry.value, valueSerializer);
} else
kryo.writeClassAndObject(output, entry.value);
}
}
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:21,代码来源:LongMapSerializer.java
示例2: read
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public LongMap read (Kryo kryo, Input input, Class<LongMap> type) {
int length = input.readVarInt(true);
input.readBoolean(); // currently unused
LongMap map = new LongMap(length);
Class valueClass = null;
Serializer valueSerializer = null;
if (valueGenericType != null) {
valueClass = valueGenericType;
if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueClass);
valueGenericType = null;
}
kryo.reference(map);
for (int i = 0; i < length; i++) {
long key = input.readLong();
Object value;
if (valueSerializer != null) {
value = kryo.readObjectOrNull(input, valueClass, valueSerializer);
} else
value = kryo.readClassAndObject(input);
map.put(key, value);
}
return map;
}
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:28,代码来源:LongMapSerializer.java
示例3: OpenALAudio
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public OpenALAudio (int simultaneousSources, int deviceBufferCount, int deviceBufferSize) {
this.deviceBufferSize = deviceBufferSize;
this.deviceBufferCount = deviceBufferCount;
registerSound("ogg", Ogg.Sound.class);
registerMusic("ogg", Ogg.Music.class);
registerSound("wav", Wav.Sound.class);
registerMusic("wav", Wav.Music.class);
registerSound("mp3", Mp3.Sound.class);
registerMusic("mp3", Mp3.Music.class);
try {
AL.create();
} catch (LWJGLException ex) {
noDevice = true;
ex.printStackTrace();
return;
}
allSources = new IntArray(false, simultaneousSources);
for (int i = 0; i < simultaneousSources; i++) {
int sourceID = alGenSources();
if (alGetError() != AL_NO_ERROR) break;
allSources.add(sourceID);
}
idleSources = new IntArray(allSources);
soundIdToSource = new LongMap<Integer>();
sourceToSoundId = new IntMap<Long>();
FloatBuffer orientation = (FloatBuffer)BufferUtils.createFloatBuffer(6)
.put(new float[] {0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}).flip();
alListener(AL_ORIENTATION, orientation);
FloatBuffer velocity = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
alListener(AL_VELOCITY, velocity);
FloatBuffer position = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
alListener(AL_POSITION, position);
recentSounds = new OpenALSound[simultaneousSources];
}
开发者ID:Xemiru,项目名称:Undertailor,代码行数:40,代码来源:OpenALAudio.java
示例4: OpenALAudio
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public OpenALAudio (int simultaneousSources, int deviceBufferCount, int deviceBufferSize) {
this.deviceBufferSize = deviceBufferSize;
this.deviceBufferCount = deviceBufferCount;
registerSound("ogg", Ogg.Sound.class);
registerMusic("ogg", Ogg.Music.class);
registerSound("wav", Wav.Sound.class);
registerMusic("wav", Wav.Music.class);
registerSound("mp3", Mp3.Sound.class);
registerMusic("mp3", Mp3.Music.class);
alContext = ALContext.create();
allSources = new IntArray(false, simultaneousSources);
for (int i = 0; i < simultaneousSources; i++) {
int sourceID = alGenSources();
if (alGetError() != AL_NO_ERROR) break;
allSources.add(sourceID);
}
idleSources = new IntArray(allSources);
soundIdToSource = new LongMap<Integer>();
sourceToSoundId = new IntMap<Long>();
FloatBuffer orientation = (FloatBuffer)BufferUtils.createFloatBuffer(6)
.put(new float[] {0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}).flip();
alListenerfv(AL_ORIENTATION, orientation);
FloatBuffer velocity = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
alListenerfv(AL_VELOCITY, velocity);
FloatBuffer position = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
alListenerfv(AL_POSITION, position);
recentSounds = new OpenALSound[simultaneousSources];
}
开发者ID:Arcnor,项目名称:gdx-backend-jglfw,代码行数:34,代码来源:OpenALAudio.java
示例5: init
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public static void init() {
try {
Field field = OpenALAudio.class.getDeclaredField("soundIdToSource");
field.setAccessible(true);
soundIdToSource = (LongMap<Integer>) field.get(Gdx.audio);
} catch (Exception e) {
throw new RuntimeException("Error getting soundIdToSource", e);
}
}
开发者ID:GameDevWeek,项目名称:CodeBase,代码行数:10,代码来源:SoundInstance.java
示例6: Scheduler
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public Scheduler(Environment env) {
this.env = env;
this.destroyed = false;
this.tasks = new LongMap<>();
this.activeTasks = new OrderedMap<>();
}
开发者ID:Xemiru,项目名称:Undertailor,代码行数:7,代码来源:Scheduler.java
示例7: Engine
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public Engine(){
entities = new Array<Entity>(false, 16);
entitiesById = new LongMap<Entity>();
}
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:5,代码来源:Engine.java
示例8: OpenALAudio
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public OpenALAudio(int simultaneousSources, int deviceBufferCount, int deviceBufferSize) {
this.deviceBufferSize = deviceBufferSize;
this.deviceBufferCount = deviceBufferCount;
registerSound("ogg", Ogg.Sound.class);
registerMusic("ogg", Ogg.Music.class);
registerSound("wav", Wav.Sound.class);
registerMusic("wav", Wav.Music.class);
registerSound("mp3", Mp3.Sound.class);
registerMusic("mp3", Mp3.Music.class);
try {
AL.create();
} catch (LWJGLException ex) {
noDevice = true;
ex.printStackTrace();
return;
}
allSources = new IntArray(false, simultaneousSources);
for (int i = 0; i < simultaneousSources; i++) {
int sourceID = alGenSources();
if (alGetError() != AL_NO_ERROR) {
break;
}
allSources.add(sourceID);
}
idleSources = new IntArray(allSources);
soundIdToSource = new LongMap<>();
sourceToSoundId = new IntMap<>();
FloatBuffer orientation = (FloatBuffer) BufferUtils.createFloatBuffer(6)
.put(new float[]{0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}).flip();
alListener(AL_ORIENTATION, orientation);
FloatBuffer velocity = (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[]{0.0f, 0.0f, 0.0f}).flip();
alListener(AL_VELOCITY, velocity);
FloatBuffer position = (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[]{0.0f, 0.0f, 0.0f}).flip();
alListener(AL_POSITION, position);
recentSounds = new OpenALSound[simultaneousSources];
}
开发者ID:kovertopz,项目名称:libGDX-LWJGL-Audio,代码行数:42,代码来源:OpenALAudio.java
注:本文中的com.badlogic.gdx.utils.LongMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论