本文整理汇总了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);
}
}
示例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;
}
示例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];
}
示例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];
}
示例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);
}
}
示例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<>();
}
示例7: Engine
import com.badlogic.gdx.utils.LongMap; //导入依赖的package包/类
public Engine(){
entities = new Array<Entity>(false, 16);
entitiesById = new LongMap<Entity>();
}
示例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];
}