Java Code Examples for com.badlogic.gdx.utils.JsonValue#getFloat()

The following examples show how to use com.badlogic.gdx.utils.JsonValue#getFloat() . 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: MathModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    defaultA = jsonData.getFloat("a", 0);
    defaultB = jsonData.getFloat("b", 0);
    currentExpression = MathExpressionMappings.getMathExpressionForName(jsonData.getString("mathExpression"));
}
 
Example 2
Source File: FlipbookModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    regionName = jsonData.getString("regionName", "fire");

    rows = jsonData.getInt("rows", 1);
    cols = jsonData.getInt("cols", 1);
    duration = jsonData.getFloat("duration", 1);
}
 
Example 3
Source File: EmitterModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    defaultDelay = jsonData.getFloat("delay", 0);
    defaultDuration = jsonData.getFloat("duration", 2);
    defaultRate = jsonData.getFloat("rate", 50);
}
 
Example 4
Source File: DynamicRangeModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    lowMin = jsonData.getFloat("lowMin");
    lowMax = jsonData.getFloat("lowMax");
    highMin = jsonData.getFloat("highMin");
    highMax = jsonData.getFloat("highMax");
}
 
Example 5
Source File: FromToModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read(Json json, JsonValue jsonData) {
    super.read(json, jsonData);

    defaultFrom.x = jsonData.getFloat("fromX", 0);
    defaultFrom.y = jsonData.getFloat("fromY", 0);
    defaultTo.x = jsonData.getFloat("toX", 0);
    defaultTo.y = jsonData.getFloat("toY", 0);
}
 
Example 6
Source File: ColorModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    defaultR = jsonData.getFloat("r");
    defaultG = jsonData.getFloat("g");
    defaultB = jsonData.getFloat("b");
}
 
Example 7
Source File: RandomRangeModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    min = jsonData.getFloat("min", 0);
    max = jsonData.getFloat("max", 0);
    distributed = jsonData.getBoolean("distributed", false);
}
 
Example 8
Source File: FakeMotionBlurModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read(Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    velocityMin = jsonData.getFloat("velocityMin", 0);
    velocityMax = jsonData.getFloat("velocityMax", 0);
    sizeMin = jsonData.getFloat("sizeMin", 0);
    sizeMax = jsonData.getFloat("sizeMax", 0);
}
 
Example 9
Source File: RibbonModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    detail = jsonData.getInt("details", 10);
    memoryDuration = jsonData.getFloat("memory", 10);
    RibbonRenderer renderer = (RibbonRenderer) outputValue.getDrawable();
    renderer.setConfig(detail, memoryDuration);
}
 
Example 10
Source File: BodyEditorLoader.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private RigidBodyModel readRigidBody (JsonValue bodyElem) {
	RigidBodyModel rbModel = new RigidBodyModel();
	rbModel.name = bodyElem.getString("name");
	rbModel.imagePath = bodyElem.getString("imagePath");

	JsonValue origin = bodyElem.get("origin");

	rbModel.origin.x = origin.getFloat("x");
	rbModel.origin.y = origin.getFloat("y");

	// polygons
	JsonValue polygons = bodyElem.get("polygons");

	for (JsonValue vertices = polygons.child(); vertices != null; vertices = vertices.next()) {
		PolygonModel polygon = new PolygonModel();
		rbModel.polygons.add(polygon);

		for (JsonValue vertex = vertices.child(); vertex != null; vertex = vertex.next()) {
			polygon.vertices.add(new Vector2(vertex.getFloat("x"), vertex.getFloat("y")));
		}

		polygon.buffer = new Vector2[polygon.vertices.size()];
	}

	// circles
	JsonValue circles = bodyElem.get("circles");

	for (JsonValue circle = circles.child(); circle != null; circle = circle.next()) {
		CircleModel c = new CircleModel();
		rbModel.circles.add(c);

		c.center.x = circle.getFloat("cx");
		c.center.y = circle.getFloat("cy");
		c.radius = circle.getFloat("r");
	}

	return rbModel;
}
 
Example 11
Source File: FreeTypeFontData.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void read(Json json, JsonValue jsonData) {
    name = jsonData.getString("name");
    file = jsonData.has("file") ? Gdx.files.absolute(jsonData.getString("file")) : null;
    previewTTF = jsonData.getString("previewTTF");
    useCustomSerializer = jsonData.getBoolean("useCustomSerializer", false);
    size = jsonData.getInt("size", 16);
    mono = jsonData.getBoolean("mono");
    hinting = jsonData.getString("hinting", "AutoMedium");
    color = jsonData.getString("color");
    gamma = jsonData.getFloat("gamma", 1.8f);
    renderCount = jsonData.getInt("renderCount", 2);
    borderWidth = jsonData.getFloat("borderWidth", 0);
    borderColor = jsonData.getString("borderColor");
    borderStraight = jsonData.getBoolean("borderStraight", false);
    borderGamma = jsonData.getFloat("borderGamma", 1.8f);
    shadowOffsetX = jsonData.getInt("shadowOffsetX", 0);
    shadowOffsetY = jsonData.getInt("shadowOffsetY", 0);
    shadowColor = jsonData.getString("shadowColor");
    spaceX = jsonData.getInt("spaceX");
    spaceY = jsonData.getInt("spaceY");
    characters = jsonData.getString("characters", "");
    kerning = jsonData.getBoolean("kerning", true);
    flip = jsonData.getBoolean("flip", false);
    genMipMaps = jsonData.getBoolean("genMipMaps", false);
    minFilter = jsonData.getString("minFilter", "Nearest");
    magFilter = jsonData.getString("magFilter", "Nearest");
    incremental = jsonData.getBoolean("incremental");
}
 
Example 12
Source File: MG3dModelLoader.java    From Mundus with Apache License 2.0 5 votes vote down vote up
private Vector2 readVector2(JsonValue vectorArray, float x, float y) {
    if (vectorArray == null)
        return new Vector2(x, y);
    else if (vectorArray.size == 2)
        return new Vector2(vectorArray.getFloat(0), vectorArray.getFloat(1));
    else
        throw new GdxRuntimeException("Expected Vector2 values <> than two.");
}
 
Example 13
Source File: HeadlessG3dModelLoader.java    From gdx-proto with Apache License 2.0 5 votes vote down vote up
private void parseAnimations (ModelData model, JsonValue json) {
	JsonValue animations = json.get("animations");
	if (animations == null) return;

	model.animations.ensureCapacity(animations.size);

	for (JsonValue anim = animations.child; anim != null; anim = anim.next) {
		JsonValue nodes = anim.get("bones");
		if (nodes == null) continue;
		ModelAnimation animation = new ModelAnimation();
		model.animations.add(animation);
		animation.nodeAnimations.ensureCapacity(nodes.size);
		animation.id = anim.getString("id");
		for (JsonValue node = nodes.child; node != null; node = node.next) {
			JsonValue keyframes = node.get("keyframes");

			ModelNodeAnimation nodeAnim = new ModelNodeAnimation();
			animation.nodeAnimations.add(nodeAnim);
			nodeAnim.nodeId = node.getString("boneId");
			nodeAnim.keyframes.ensureCapacity(keyframes.size);

			for (JsonValue keyframe = keyframes.child; keyframe != null; keyframe = keyframe.next) {
				ModelNodeKeyframe kf = new ModelNodeKeyframe();
				nodeAnim.keyframes.add(kf);
				kf.keytime = keyframe.getFloat("keytime") / 1000.f;
				JsonValue translation = keyframe.get("translation");
				if (translation != null && translation.size == 3)
					kf.translation = new Vector3(translation.getFloat(0), translation.getFloat(1), translation.getFloat(2));
				JsonValue rotation = keyframe.get("rotation");
				if (rotation != null && rotation.size == 4)
					kf.rotation = new Quaternion(rotation.getFloat(0), rotation.getFloat(1), rotation.getFloat(2),
							rotation.getFloat(3));
				JsonValue scale = keyframe.get("scale");
				if (scale != null && scale.size == 3)
					kf.scale = new Vector3(scale.getFloat(0), scale.getFloat(1), scale.getFloat(2));
			}
		}
	}
}
 
Example 14
Source File: Vector2Module.java    From talos with Apache License 2.0 4 votes vote down vote up
@Override
public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    defaultX = jsonData.getFloat("x", 0);
    defaultY = jsonData.getFloat("y", 0);
}
 
Example 15
Source File: MG3dModelLoader.java    From Mundus with Apache License 2.0 4 votes vote down vote up
private Color parseColor(JsonValue colorArray) {
    if (colorArray.size >= 3)
        return new Color(colorArray.getFloat(0), colorArray.getFloat(1), colorArray.getFloat(2), 1.0f);
    else
        throw new GdxRuntimeException("Expected Color values <> than three.");
}