com.badlogic.gdx.utils.ObjectMap.Entry Java Examples
The following examples show how to use
com.badlogic.gdx.utils.ObjectMap.Entry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonDOM.java From RuinsOfRevenge with MIT License | 6 votes |
@SuppressWarnings("unchecked") public void readJsonObject(JsonObject element, OrderedMap<String, Object> jsonData) { Entries<String, Object> entries = jsonData.entries(); for (Entry<String, Object> entry : entries) { if (entry.value instanceof OrderedMap) { JsonObject obj = new JsonObject(); element.elements.put(entry.key, obj); // unchecked, but safe: readJsonObject(obj, (OrderedMap<String, Object>) entry.value); } else if (entry.value instanceof Array) { JsonArray arr = new JsonArray(); element.elements.put(entry.key, arr); // unchecked, but safe: readJsonArray(arr, (Array<OrderedMap<String, Object>>) entry.value); } else { element.values.put(entry.key, entry.value.toString()); } } }
Example #2
Source File: CCSimpleAudioEngine.java From cocos2d-java with MIT License | 6 votes |
/** Release the shared Engine object <p>Warn: It must be called before the application exit, or a memroy leak will be casued.</p> */ public void end () { sharedMusic().close (); synchronized (sharedList()) { Iterator<Entry<Integer, CCEffectPlayer>> iter = sharedList().entries().iterator(); while (iter.hasNext()) { Entry<Integer, CCEffectPlayer> entry = iter.next(); entry.value.close(); } sharedList().clear (); } }
Example #3
Source File: GLTFDemoUI.java From gdx-gltf with Apache License 2.0 | 5 votes |
public void setCameras(ObjectMap<Node, Camera> cameras) { Array<String> cameraNames = new Array<String>(); cameraNames.add(""); for(Entry<Node, Camera> e : cameras){ cameraNames.add(e.key.id); } cameraSelector.setItems(); cameraSelector.setItems(cameraNames); }
Example #4
Source File: Config.java From RuinsOfRevenge with MIT License | 5 votes |
public JsonDOM toJsonDOM() { JsonDOM dom = new JsonDOM(); JsonDOM.JsonObject root = dom.getRoot(); root.values.put("gamepad", gamepad); root.values.put("gamepadX", "" + gamepadX); root.values.put("gamepadY", "" + gamepadY); root.values.put("enableGamepad", "" + enableGamepad); root.values.put("baseintensity", "" + baseintensity); root.values.put("basesaturation", "" + basesaturation); root.values.put("bloomintensity", "" + bloomintensity); root.values.put("bloomsaturation", "" + bloomsaturation); root.values.put("bloomtreshold", "" + bloomtreshold); root.values.put("blurammount", "" + blurammount); root.values.put("resolutionX", "" + resolutionX); root.values.put("resolutionY", "" + resolutionY); root.values.put("bloom", "" + bloom); JsonDOM.JsonArray keyArray = new JsonDOM.JsonArray(); for (Entry<String, Integer> entry : keys.entries()) { JsonDOM.JsonObject obj = new JsonDOM.JsonObject(); obj.values.put(entry.key, KeysUtil.forVal(entry.value)); System.out.println("Saving " + entry.key + " = " + KeysUtil.forVal(entry.value)); keyArray.elements.add(obj); } root.elements.put("keys", keyArray); return dom; }
Example #5
Source File: Config.java From RuinsOfRevenge with MIT License | 5 votes |
public Config fromJsonDOM(JsonDOM dom) { JsonDOM.JsonObject root = dom.getRoot(); gamepad = root.getValue("gamepad", "..."); gamepadX = root.getIntValue("gamepadX", 0); gamepadY = root.getIntValue("gamepadY", 1); enableGamepad = root.getBoolValue("enableGamepad", false); baseintensity = root.getFloatValue("baseintensity", 1f); basesaturation = root.getFloatValue("basesaturation", 0.85f); bloomintensity = root.getFloatValue("bloomintensity", 2f); bloomsaturation = root.getFloatValue("bloomsaturation", 0.85f); bloomtreshold = root.getFloatValue("bloomtreshold", 0.6f); blurammount = root.getFloatValue("blurammount", 2f); resolutionX = root.getIntValue("resolutionX", 800); resolutionY = root.getIntValue("resolutionY", 600); bloom = root.getBoolValue("bloom", true); if (root.elements.containsKey("keys")) { JsonDOM.JsonElement keysElem = root.elements.get("keys"); if (keysElem != null && keysElem instanceof JsonDOM.JsonArray) { JsonDOM.JsonArray keyArray = (JsonDOM.JsonArray) keysElem; for (JsonDOM.JsonObject obj : keyArray.elements) { for (Entry<String, String> key : obj.values.entries()) { keys.put(key.key, KeysUtil.forName(key.value)); } } } } return this; }
Example #6
Source File: BehaviorTreeParser.java From gdx-ai with Apache License 2.0 | 5 votes |
private void checkRequiredAttributes (StackedTask<E> stackedTask) { // Check the minimum number of children Entries<String, AttrInfo> entries = stackedTask.metadata.attributes.iterator(); while (entries.hasNext()) { Entry<String, AttrInfo> entry = entries.next(); if (entry.value.required && !encounteredAttributes.contains(entry.key)) throw stackedTaskException(stackedTask, "missing required attribute '" + entry.key + "'"); } }
Example #7
Source File: PooledBehaviorTreeLibrary.java From gdx-ai with Apache License 2.0 | 5 votes |
/** * clear all pools. */ public void clear(){ for(Entry<String, Pool<BehaviorTree>> entry : pools.entries()){ entry.value.clear(); } pools.clear(); }
Example #8
Source File: TabbedPane.java From vis-ui with Apache License 2.0 | 5 votes |
private boolean selectFirstEnabledTab () { for (Entry<Tab, TabButtonTable> entry : tabsButtonMap) { if (entry.value.button.isDisabled() == false) { switchTab(entry.key); return true; } } return false; }
Example #9
Source File: StyleData.java From skin-composer with MIT License | 5 votes |
public StyleData(StyleData styleData, String styleName, Main main) { name = styleName; this.main = main; clazz = styleData.clazz; properties = new OrderedMap<>(); for (Entry<String, StyleProperty> entry : styleData.properties.entries()) { properties.put(entry.key, new StyleProperty(entry.value)); } deletable = true; }
Example #10
Source File: TypingLabel.java From typing-label with MIT License | 5 votes |
/** Registers a set of variables and their respective replacement values to this label. */ public void setVariables(java.util.Map<String, String> variableMap) { this.variables.clear(); for(java.util.Map.Entry<String, String> entry : variableMap.entrySet()) { this.variables.put(entry.getKey().toUpperCase(), entry.getValue()); } }
Example #11
Source File: TypingLabel.java From typing-label with MIT License | 5 votes |
/** Registers a set of variables and their respective replacement values to this label. */ public void setVariables(ObjectMap<String, String> variableMap) { this.variables.clear(); for(Entry<String, String> entry : variableMap.entries()) { this.variables.put(entry.key.toUpperCase(), entry.value); } }
Example #12
Source File: GLTFCameraExporter.java From gdx-gltf with Apache License 2.0 | 5 votes |
public void export(ObjectMap<Node, Camera> cameras) { for(Entry<Node, Camera> entry : cameras){ int nodeID = base.nodeMapping.indexOf(entry.key, true); if(nodeID < 0) throw new GdxRuntimeException("node not found"); GLTFNode glNode = base.root.nodes.get(nodeID); if(base.root.cameras == null){ base.root.cameras = new Array<GLTFCamera>(); } glNode.camera = base.root.cameras.size; base.root.cameras.add(export(entry.value)); } }
Example #13
Source File: SceneManager.java From gdx-gltf with Apache License 2.0 | 5 votes |
public void addScene(Scene scene, boolean appendLights){ renderableProviders.add(scene); if(appendLights){ for(Entry<Node, BaseLight> e : scene.lights){ environment.add(e.value); } } }
Example #14
Source File: Scene.java From gdx-gltf with Apache License 2.0 | 5 votes |
public int getDirectionalLightCount() { int count = 0; for(Entry<Node, BaseLight> entry : lights){ if(entry.value instanceof DirectionalLight){ count++; } } return count; }
Example #15
Source File: Scene.java From gdx-gltf with Apache License 2.0 | 5 votes |
public BaseLight getLight(String name) { for(Entry<Node, BaseLight> e : lights){ if(name.equals(e.key.id)){ return e.value; } } return null; }
Example #16
Source File: Scene.java From gdx-gltf with Apache License 2.0 | 5 votes |
public Camera getCamera(String name) { for(Entry<Node, Camera> e : cameras){ if(name.equals(e.key.id)){ return e.value; } } return null; }
Example #17
Source File: Scene.java From gdx-gltf with Apache License 2.0 | 5 votes |
private void syncLights(){ for(Entry<Node, BaseLight> e : lights){ Node node = e.key; BaseLight light = e.value; transform.set(node.globalTransform).mul(modelInstance.transform); if(light instanceof DirectionalLight){ ((DirectionalLight)light).direction.set(0,0,-1).rot(transform); }else if(light instanceof PointLight){ ((PointLight)light).position.setZero().mul(transform); }else if(light instanceof SpotLight){ ((SpotLight)light).position.setZero().mul(transform); ((SpotLight)light).direction.set(0,0,-1).rot(transform); } } }
Example #18
Source File: Scene.java From gdx-gltf with Apache License 2.0 | 5 votes |
private void syncCameras(){ for(Entry<Node, Camera> e : cameras){ Node node = e.key; Camera camera = e.value; transform.set(node.globalTransform).mul(modelInstance.transform); camera.position.setZero().mul(transform); camera.direction.set(0,0,-1).rot(transform); camera.up.set(Vector3.Y).rot(transform); camera.update(); } }
Example #19
Source File: AnimationControllerHack.java From gdx-gltf with Apache License 2.0 | 5 votes |
/** End applying multiple animations to the instance and update it to reflect the changes. */ @Override protected void end () { if (!applying) throw new GdxRuntimeException("You must call begin() first"); for (Entry<Node, Transform> entry : transforms.entries()) { entry.value.toMatrix4(entry.key.localTransform); transformPool.free(entry.value); } transforms.clear(); if(calculateTransforms) target.calculateTransforms(); applying = false; }
Example #20
Source File: GLTFDemoUI.java From gdx-gltf with Apache License 2.0 | 5 votes |
public void setLights(ObjectMap<Node, BaseLight> lights) { Array<String> names = new Array<String>(); names.add(""); for(Entry<Node, BaseLight> entry : lights){ names.add(entry.key.id); } lightSelector.setItems(names); }
Example #21
Source File: GLTFDemoUI.java From gdx-gltf with Apache License 2.0 | 5 votes |
protected void showHideOtherNodes(boolean hide) { for(Entry<String, Node> entry : nodeMap){ for(NodePart part : entry.value.parts){ part.enabled = selectedNode == null || !hide || entry.value == selectedNode; } } }
Example #22
Source File: GLTFLightExporter.java From gdx-gltf with Apache License 2.0 | 4 votes |
public void export(ObjectMap<Node, BaseLight> lights) { if(base.root.extensionsUsed == null){ base.root.extensionsUsed = new Array<String>(); } if(!base.root.extensionsUsed.contains(KHRLightsPunctual.EXT, false)){ base.root.extensionsUsed.add(KHRLightsPunctual.EXT); } if(base.root.extensionsRequired == null){ base.root.extensionsRequired = new Array<String>(); } if(!base.root.extensionsRequired.contains(KHRLightsPunctual.EXT, false)){ base.root.extensionsRequired.add(KHRLightsPunctual.EXT); } for(Entry<Node, BaseLight> entry : lights){ int nodeID = base.nodeMapping.indexOf(entry.key, true); if(nodeID < 0) throw new GdxRuntimeException("node not found"); GLTFNode glNode = base.root.nodes.get(nodeID); if(base.root.extensions == null){ base.root.extensions = new GLTFExtensions(); } GLTFLights extLights = base.root.extensions.get(KHRLightsPunctual.GLTFLights.class, KHRLightsPunctual.EXT); if(extLights == null){ base.root.extensions.set(KHRLightsPunctual.EXT, extLights = new GLTFLights()); } if(extLights.lights == null){ extLights.lights = new Array<GLTFLight>(); } GLTFLight glLight = map(new GLTFLight(), entry.value); glLight.name = glNode.name; extLights.lights.add(glLight); if(glNode.extensions == null){ glNode.extensions = new GLTFExtensions(); } GLTFLightNode nodeLight = glNode.extensions.get(GLTFLightNode.class, KHRLightsPunctual.EXT); if(nodeLight == null){ glNode.extensions.set(KHRLightsPunctual.EXT, nodeLight = new GLTFLightNode()); } nodeLight.light = extLights.lights.size - 1; } }
Example #23
Source File: GLTFExtensions.java From gdx-gltf with Apache License 2.0 | 4 votes |
@Override public void write(Json json) { for (Entry<String, Object> extension : extentions) { json.writeValue(extension.key, extension.value); } }
Example #24
Source File: SceneManager.java From gdx-gltf with Apache License 2.0 | 4 votes |
public void removeScene(Scene scene) { renderableProviders.removeValue(scene, true); for(Entry<Node, BaseLight> e : scene.lights){ environment.remove(e.value); } }