本文整理汇总了Java中com.badlogic.gdx.utils.ObjectMap类的典型用法代码示例。如果您正苦于以下问题:Java ObjectMap类的具体用法?Java ObjectMap怎么用?Java ObjectMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectMap类属于com.badlogic.gdx.utils包,在下文中一共展示了ObjectMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFinishedLoading
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
private void onFinishedLoading() {
BitmapFont main19Font = assetManager.get(MAIN_FONT_19_PATH());
BitmapFont main22Font = assetManager.get(MAIN_FONT_22_PATH());
BitmapFont letter20Font = assetManager.get(LETTER_FONT_20_PATH());
BitmapFont handwritten20Font = assetManager
.get(HANDWRITTEN_FONT_20_PATH());
ObjectMap<String, Object> fontMap = new ObjectMap<String, Object>();
fontMap.put("main-19", main19Font);
fontMap.put("main-22", main22Font);
fontMap.put("letter-20", letter20Font);
fontMap.put("handwritten-20", handwritten20Font);
assetManager.load(SKIN_PATH, Skin.class,
new SkinLoader.SkinParameter(SKIN_TEXTURE_ATLAS_PATH, fontMap));
assetManager.finishLoadingAsset(SKIN_PATH);
// game.setUISkin(assetManager.get(SKIN_PATH));
VisUI.load();
game.setUISkin(VisUI.getSkin());
// Notify loaded screens
game.getScreen("serverBrowser").finishLoading();
game.pushScreen("mainMenu");
}
示例2: add
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
/** Add a Batchable to the queue. */
public void add (T batchable) {
if (batchable.isOpaque()) {
for (ObjectMap.Entry<T, ObjectSet<T>> entry : opaqueBatchables) {
if (batchable.hasEquivalentTextures(entry.key)) {
entry.value.add((T)batchable);
return;
}
}
ObjectSet<T> set = objectSetPool.obtain();
set.add(batchable);
opaqueBatchables.put(batchable, set);
} else {
blendedBatchables.add(batchable);
}
needSort = true;
}
示例3: initManagers
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
public void initManagers() {
assetManager = new AssetManager(new LocalFileHandleResolver(), true);
imagePacks = new ObjectMap<String, Array<String>>();
for (String name : new String[] {"characters", "obstacles", "grounds", "clouds", "bushes", "buildings"}) {
imagePacks.put(DATA_PATH + "/" + name, new Array<String>());
}
stateManager = new StateManager(this);
stateManager.addState("loading", new LoadingState("menu", this));
stateManager.addState("menu", new MenuState(this));
stateManager.addState("game", new GameState(this));
stateManager.addState("credits", new CreditsState(this));
spriteBatch = new SpriteBatch();
pixmapPacker = new PixmapPacker(1024, 1024, Pixmap.Format.RGBA8888, 5, true, new PixmapPacker.GuillotineStrategy());
}
示例4: RenderSystem
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
public RenderSystem(DecalBatch decalBatch, AssetManager assetManager, float worldDegree, Assets.LevelAssets assets) {
super(Aspect.all(RenderComponent.class, PositionComponent.class));
this.levelAssets = assets;
decalMap = new ObjectMap<>();
uiMap = new ObjectMap<>();
this.decalBatch = decalBatch;
this.assetManager = assetManager;
buffers = new ObjectMap<>();
this.spriteBatch = new SpriteBatch();
this.font = assets.uifont;
font.setColor(Color.BLACK);
this.uiCamera = new OrthographicCamera();
Viewport viewportUi = new FitViewport(levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), uiCamera);
viewportUi.update(viewportUi.getScreenWidth(), viewportUi.getScreenHeight(), true);
stateTime = 0;
this.worldDegree = worldDegree;
gradientShader = new ShaderProgram(Shaders.GradientShader.vertexShader, Shaders.GradientShader.fragmentShader);
if (gradientShader.isCompiled() == false)
throw new IllegalArgumentException("couldn't compile shader: " + gradientShader.getLog());
shaderBatch = new SpriteBatch(10, gradientShader);
}
示例5: GameState
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
public GameState(String name, String tmx, StateManager manager) {
this.tmx = tmx;
setManager(manager);
if(name!=null)
this.name = name;
else
this.name = "";
sprites = new ObjectMap<String, Sprite>();
animations = new ObjectMap<String, Animation<String>>();
fonts = new ObjectMap<String, BitmapFont>(); //TODO: test load to avoid repeats
particle_effects = new ObjectMap<String, ParticleEffectPool>();
pvalues = new Array<String>();
time_scale = 1f;
shaders = new ObjectMap<String, ShaderProgram>();
svalues = new Array<String>();
}
示例6: TiledObjectTypes
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的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);
}
}
示例7: addScrollPanel
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
private void addScrollPanel(Table table, Element element) {
Table tableScroll = new Table(skin);
ScrollPane scrollPane = new ScrollPane(tableScroll, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null) {
atrributes = new ObjectMap<String, String>();
}
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
tableScroll.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
addChildrens(element, tableScroll);
actorsMap.put(tableScroll.getName(), tableScroll);
}
示例8: recalculateFormation
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
private void recalculateFormation(ObjectMap<Integer, Tile> formationToRecalculate, int rotationDegrees) {
for (Integer i : formation.keys()) {
Tile formationPosition = formationToRecalculate.get(i);
if (formationPosition == null) {
formationPosition = new Tile();
formationToRecalculate.put(i, formationPosition);
}
formationPosition.set(formation.get(i));
// we only rotate in multiplies of 45
// first we do as many 90 degrees rotations as needed
// and then do the final 45 rotation if required
int rotAmount = rotationDegrees / 90;
for (int j = 0; j < rotAmount; ++j) {
formationPosition.rotate90CW();
}
if (rotationDegrees % 90 == 45) {
rotateTile45CW(formationPosition);
}
}
}
示例9: addList
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
private void addList(Table table, Element element) {
Gdx.app.log("JXmlUi", "addList");
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null)
atrributes = new ObjectMap<String, String>();
List<String> list = new List<String>(skin);
list.getSelection().setMultiple(false);
ScrollPane scrollPane = new ScrollPane(list, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
list.setName(atrributes.get(key));
scrollPane.setName(atrributes.get(key) + "-scroll-panel");
}
}
cellPrepare(cell, atrributes);
actorsMap.put(list.getName(), list);
actorsMap.put(scrollPane.getName(), scrollPane);
addElementsInList(element, list);
}
示例10: getText
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
public String getText(ObjectMap<String, String> parameters) {
if (parameters == null) {
parameters = new ObjectMap<String, String>();
}
if (dialogue.getPCAtDialogue() != null) {
parameters.put(SPECIAL_PCNAME, dialogue.getPCAtDialogue().getName());
parameters.put(SPECIAL_PC_PRONOUN, dialogue.getPCAtDialogue().stats().getGender().getPronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_PC_POSSESIVE_PRONOUN, dialogue.getPCAtDialogue().stats().getGender().getPossesivePronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_PC_OBJECT_PRONOUN, dialogue.getPCAtDialogue().stats().getGender().getObjectPronoun().toLowerCase(Locale.ENGLISH));
}
if (dialogue.getNPCAtDialogue() != null) {
parameters.put(SPECIAL_NPCNAME, dialogue.getNPCAtDialogue().getName());
parameters.put(SPECIAL_NPC_PRONOUN, dialogue.getNPCAtDialogue().stats().getGender().getPronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_NPC_POSSESIVE_PRONOUN, dialogue.getNPCAtDialogue().stats().getGender().getPossesivePronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_NPC_OBJECT_PRONOUN, dialogue.getNPCAtDialogue().stats().getGender().getObjectPronoun().toLowerCase(Locale.ENGLISH));
}
String returnValue = StringUtil.replaceParameters(Strings.getString(text), parameters);
returnValue = StringUtil.replaceCharacterNames(returnValue);
return returnValue;
}
示例11: setOverallVolume
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
private static void setOverallVolume(float volume)
{
overallVolume = Math.max(volume, 0);
overallVolume = Math.min(volume, 1);
if(curSong != null)
curSong.setVolume(overallVolume * musicVolume);
ObjectMap.Entries<String, SoundEffect> s = sounds.entries();
while(s.hasNext)
{
s.next().value.sVolume(overallVolume * effectsVolume);
}
}
示例12: endGame
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
public static void endGame()
{
//Stop the music
if(curSong != null)
{
curSong.stop();
curSong.dispose();
}
//Dispose of all Sound Effects
ObjectMap.Entries<String, SoundEffect> s = sounds.entries();
while(s.hasNext)
{
SoundEffect se = s.next().value;
se.stop();
se.dispose();
}
screams = new Array<String>();
}
示例13: loadAsync
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, ThesaurusLoader.ThesaurusParameter parameter) {
Constructor constructor = new Constructor(ThesaurusData.class);
Yaml yaml = new Yaml(constructor);
ObjectMap<String, ThesaurusData> data = new ObjectMap<String, ThesaurusData>();
for (Object o : yaml.loadAll(resolve(fileName).read())) {
ThesaurusData description = (ThesaurusData) o;
data.put(description.key, description);
}
if (parameter != null && parameter.other.length > 0) {
for (String depName : parameter.other) {
Thesaurus dep = manager.get(depName);
data.putAll(dep.data);
}
}
thesaurus = new Thesaurus(data);
}
示例14: WorldRoom
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
public WorldRoom(Tilemap map) {
this.destroyed = false;
this.prepared = false;
this.events = new EventHelper(this);
this.bodyQueue = new ObjectSet<>();
this.entrypointQueue = new ObjectSet<>();
this.tilemap = map;
this.controller = null;
this.obj = new ObjectSet<>();
this.entrypoints = new ObjectMap<>();
this.opacityMapping = new IntFloatMap();
this.collisionLayers = new ObjectMap<>();
this.renderOrder = new Array<>(true, 16);
this.disabledCollision = new ObjectSet<>();
}
示例15: loadStyles
import com.badlogic.gdx.utils.ObjectMap; //导入依赖的package包/类
/**
* Loads {@link TextStyle} Lua implementations found
* within the given root directory and its subfolders
* into this {@link TextStyleManager}.
*
* @param rootDirectory the root directory to search in
*/
public void loadStyles(File rootDirectory) {
ObjectMap<String, File> files = FileUtil.loadWithIdentifiers(rootDirectory, file -> {
return file.getName().endsWith(".lua");
});
files.keys().forEach(key -> {
File scriptFile = files.get(key);
try {
this.styles.put(key, new LuaTextStyle(scripts, scriptFile, key));
} catch (Exception e) {
String message = "Could not load style at script file " + scriptFile.getAbsolutePath();
if(e instanceof FileNotFoundException) message += " (file not found)";
if(e instanceof LuaScriptException) message += " (implementation error)";
log.error(message, e);
}
});
log.info(this.styles.size + " style(s) loaded.");
}