当前位置: 首页>>代码示例>>Java>>正文


Java JsonValue.getFloat方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.JsonValue.getFloat方法的典型用法代码示例。如果您正苦于以下问题:Java JsonValue.getFloat方法的具体用法?Java JsonValue.getFloat怎么用?Java JsonValue.getFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.JsonValue的用法示例。


在下文中一共展示了JsonValue.getFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stickConfigurationFromJson

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
private StickConfiguration stickConfigurationFromJson(JsonValue stickConfigurationJson) {
    boolean invertHorizontalAxis = stickConfigurationJson.getBoolean("invertHorizontalAxis");
    boolean invertVerticalAxis = stickConfigurationJson.getBoolean("invertVerticalAxis");

    float deadZoneRadius = stickConfigurationJson.getFloat("deadZoneRadius");
    float horizontalSensitivity = stickConfigurationJson.getFloat("horizontalSensitivity");
    float verticalSensitivity = stickConfigurationJson.getFloat("verticalSensitivity");

    StickConfiguration stickConfiguration = new StickConfiguration();
    stickConfiguration.setInvertHorizontalAxis(invertHorizontalAxis);
    stickConfiguration.setInvertVerticalAxis(invertVerticalAxis);
    stickConfiguration.setDeadZoneRadius(deadZoneRadius);
    stickConfiguration.setHorizontalSensitivity(horizontalSensitivity);
    stickConfiguration.setVerticalSensitivity(verticalSensitivity);

    return stickConfiguration;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:18,代码来源:InputConfigurationsJson.java

示例2: readTextureDescriptor

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public ObjectMap<Integer, Array<AnimationDescription>> readTextureDescriptor(FileHandle textureDescriptor)
		throws IOException {

	JsonValue descriptor = new JsonReader().parse(textureDescriptor);

	JsonValue frame = descriptor.get("frame");
	frameWidth = frame.getInt("width");
	frameHeight = frame.getInt("height");
	frameDuration = 1 / frame.getFloat("fps");

	JsonValue offset = descriptor.get("middleOffset");
	middleOffset = new Vector2(offset.getInt("x", 0), offset.getInt("y", 0));
	middleOffsets = new ObjectMap<T, Vector2>();

	JsonValue object = descriptor.get("object");
	objectWidth = object.getInt("width");
	objectHeight = object.getInt("height");

	ObjectMap<Integer, Array<AnimationDescription>> returnValue = new ObjectMap<Integer, Array<AnimationDescription>>();
	for (JsonValue animation : descriptor.get("animations")) {
		readAnimation(animation, returnValue);
	}
	return returnValue;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:25,代码来源:AnimationMap.java

示例3: read

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
	if (jsonData.has("time"))
		time = jsonData.getInt("time");
	if (jsonData.get("value").isNumber())
		value = jsonData.getFloat("value");
	else
		value = new Color();
	JsonValue curveValue = jsonData.get("curve");
	JsonValue constraintsValue = curveValue.get("constraints");
	int c1, c2, c3, c4;
	c1 = constraintsValue.getInt("c1");
	c2 = constraintsValue.getInt("c2");
	c3 = constraintsValue.getInt("c3");
	c4 = constraintsValue.getInt("c4");
	curve = new Curve();
	curve.constraints.set(c1, c2, c3, c4);
	if (curveValue.has("type"))
		curve.setType(json.readValue(Type.class, curveValue.get("type")));
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:21,代码来源:Key.java

示例4: load

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public static SerialArray<Tile> load(String map, HashMap<Integer, Player> players) {
    JsonValue value = reader.parse(map);
    float scale = value.getFloat("scale");
    JsonValue regions = value.get("regions");

    SerialArray<Tile> tiles = new SerialArray<>();

    for (JsonValue region : regions) {
        Color color = Color.valueOf(region.getString("color"));

        for (JsonValue tile : region.get("tiles")) {
            int x = tile.getInt("x"), y = tile.getInt("y");
            int width = tile.getInt("w"), height = tile.getInt("h");
            Tile t = new Tile(x * scale, y * scale, (int) (width * scale), (int) (height * scale), color);
            t.setRegion(region.name);
            t.setTroops(tile.getInt("troops"));

            if (tile.get("city") != null) {
                JsonValue city = tile.get("city");
                float cx = city.getInt("x") * scale, cy = city.getInt("y") * scale;
                City c = new City(cx + t.getX(), cy + t.getY(), city.getBoolean("major"));

                t.setCity(c);
            }

            if (players.get(tile.getInt("owner")) != null) {
                t.setOwner(players.get(tile.getInt("owner")));
            }

            t.setIndex(tile.getInt("index"));
            tiles.add(t);
        }
    }

    for (int i = 0; i < tiles.size; i++) {
        tiles.get(i).setContacts(tiles);
    }

    return tiles;
}
 
开发者ID:conquest,项目名称:conquest,代码行数:41,代码来源:Level.java

示例5: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
    vec = new Vector3(
            jsonValue.getFloat("x"),
            jsonValue.getFloat("y"),
            jsonValue.getFloat("z"));
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:8,代码来源:Vector3Json.java

示例6: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
    JsonValue positionJson = jsonValue.get("position");
    JsonValue rotationJson = jsonValue.get("rotation");
    JsonValue scaleJson = jsonValue.get("scale");

    float xPosition = 0;
    float yPosition = 0;
    float zPosition = 0;

    float xRotation = 0;
    float yRotation = 0;
    float zRotation = 0;

    float xScale = 1;
    float yScale = 1;
    float zScale = 1;

    if (positionJson != null) {
        xPosition = positionJson.getFloat("x");
        yPosition = positionJson.getFloat("y");
        zPosition = positionJson.getFloat("z");
    }

    if (rotationJson != null) {
        xRotation = rotationJson.getFloat("x");
        yRotation = rotationJson.getFloat("y");
        zRotation = rotationJson.getFloat("z");
    }

    if (scaleJson != null) {
        xScale = scaleJson.getFloat("x");
        yScale = scaleJson.getFloat("y");
        zScale = scaleJson.getFloat("z");
    }

    position.set(xPosition, yPosition, zPosition);
    rotation.set(xRotation, yRotation, zRotation);
    scale.set(xScale, yScale, zScale);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:41,代码来源:TransformJson.java

示例7: readValue

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public void readValue (Json json, JsonValue currententry) {
	String classname = currententry.get("componentType").asString();
	GameComponent component = null;
	if (classname.equals("Transform")) {
		transform.read(json, currententry);
		return;
	}
	if (classname.equals("SpriteRenderer"))
		component = new SpriteRenderer(currententry.getString("texture"), currententry.getFloat("width"),
			currententry.getFloat("height"));
	else if (classname.equals("Rigidbody"))
		component = new Rigidbody();
	else if (classname.equals("BoxCollider"))
		component = new BoxCollider();
	else if (classname.equals("AudioEmitter"))
		component = new AudioEmitter();
	else if (classname.equals("Light"))
		component = new Light(LightType.ConeLight);
	else if (classname.equals("ScriptComponent"))
		component = new ScriptComponent();
	else if (classname.equals("GameObject"))
		component = new GameObject();
	else if (classname.equals("CircleCollider"))
		component = new CircleCollider();
	else if (classname.equals("FontRenderer"))
		component = new FontRenderer();
	else if (classname.equals("Animator"))
		component = new SpriterAnimator();
	else if (classname.equals("Camera"))
		component = new Camera();

	if (!classname.equals("Transform")) {
		addComponent(component);
		component.read(json, currententry);
	}
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:37,代码来源:GameObject.java

示例8: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
    float radius = jsonValue.getFloat("radius", 1.0f);
    float height = jsonValue.getFloat("height", 1.0f);

    shape = new CapsuleRigidBodyShape(radius, height);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:8,代码来源:CapsuleShapeJson.java

示例9: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
    float width = jsonValue.getFloat("width", 0.0f) * 0.5f;
    float height = jsonValue.getFloat("height", 0.0f) * 0.5f;
    float depth = jsonValue.getFloat("depth", 0.0f) * 0.5f;

    shape = new BoxRigidBodyShape(width, height, depth);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:9,代码来源:BoxShapeJson.java

示例10: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
    float radius = jsonValue.getFloat("radius", 1.0f);
    float height = jsonValue.getFloat("height", 1.0f);

    shape = new ConeRigidBodyShape(radius, height);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:8,代码来源:ConeShapeJson.java

示例11: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
    float width = jsonValue.getFloat("width", 0.0f) * 0.5f;
    float height = jsonValue.getFloat("height", 0.0f) * 0.5f;
    float depth = jsonValue.getFloat("depth", 0.0f) * 0.5f;

    shape = new CylinderRigidBodyShape(width, height, depth);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:9,代码来源:CylinderShapeJson.java

示例12: parse

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue wheelJson) {
    WheelComponent wheelComponent = null;
    VehicleComponent vehicleComponent = nhg.entities.getComponent(parentEntity, VehicleComponent.class);

    if (vehicleComponent != null) {
        Vector3Json attachmentPointJson = new Vector3Json();
        attachmentPointJson.parse(wheelJson.get("attachmentPoint"));

        Vector3Json directionJson = new Vector3Json();
        directionJson.parse(wheelJson.get("direction"));

        Vector3Json axisJson = new Vector3Json();
        axisJson.parse(wheelJson.get("axis"));

        int wheelIndex = wheelJson.getInt("wheelIndex");

        float radius = wheelJson.getFloat("radius", 0.1f);
        float suspensionRestLength = wheelJson.getFloat("suspensionRestLength", radius * 0.3f);
        float wheelFriction = wheelJson.getFloat("friction", 5f);

        boolean frontWheel = wheelJson.getBoolean("frontWheel", false);

        wheelComponent = nhg.entities.createComponent(entity, WheelComponent.class);
        wheelComponent.wheelIndex = wheelIndex;
        wheelComponent.suspensionRestLength = suspensionRestLength;
        wheelComponent.wheelFriction = wheelFriction;
        wheelComponent.frontWheel = frontWheel;
        wheelComponent.attachmentPoint = attachmentPointJson.get();
        wheelComponent.direction = directionJson.get();
        wheelComponent.axis = axisJson.get();
        wheelComponent.vehicleComponent = vehicleComponent;
    }

    output = wheelComponent;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:37,代码来源:WheelComponentJson.java

示例13: load

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
protected void load(JsonValue json) {
    if (json.has("loop_delay")) {
        loopDelay = json.getFloat("loop_delay");
    }
    if (json.has("textures")) {
        loadSprites(json.get("textures").asStringArray());
    }
    if (json.has("ranges")) {
        loadRanges(json.get("ranges"));
    }
    if (json.has("modifiers")) {
        loadModifiers(json.get("modifiers"));
    }
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:15,代码来源:ParticleEffect.java

示例14: load

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
protected void load(JsonValue json) {
    JsonValue xRoot = json.get("x");
    xAmplitude = xRoot.getFloat("amplitude");
    xHShift = xRoot.getFloat("h_shift");
    xVShift = xRoot.getFloat("v_shift");
    xNumCycles = xRoot.getFloat("num_cycles");

    JsonValue yRoot = json.get("y");
    yAmplitude = yRoot.getFloat("amplitude");
    yHShift = yRoot.getFloat("h_shift");
    yVShift = yRoot.getFloat("v_shift");
    yNumCycles = yRoot.getFloat("num_cycles");
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:15,代码来源:SineVelocityParticleModifier.java

示例15: CharacterAnimationDescription

import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public CharacterAnimationDescription(Pair<String, Orientation> key, JsonValue line) {
	super(key, line);
	this.numberOfSteps = line.getInt("numberOfSteps", 0);
	this.framesPerStep = line.getInt("framesPerStep", 0);
	this.tilesTravelledPerStep = line.getFloat("tilesTravelledPerStep", 0);
	this.hitFrame = line.getInt("hitFrame", 0);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:CharacterAnimationMap.java


注:本文中的com.badlogic.gdx.utils.JsonValue.getFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。