Package org.terasology.math

Examples of org.terasology.math.Vector2i


* @author Immortius
*/
public class NullMouseDevice implements MouseDevice {
    @Override
    public Vector2i getPosition() {
        return new Vector2i();
    }
View Full Code Here


        return new Vector2i();
    }

    @Override
    public Vector2i getDelta() {
        return new Vector2i();
    }
View Full Code Here

*/
public class LwjglMouseDevice implements MouseDevice {

    @Override
    public Vector2i getPosition() {
        return new Vector2i(Mouse.getX(), Display.getHeight() - Mouse.getY());
    }
View Full Code Here

        return new Vector2i(Mouse.getX(), Display.getHeight() - Mouse.getY());
    }

    @Override
    public Vector2i getDelta() {
        return new Vector2i(Mouse.getDX(), -Mouse.getDY());
    }
View Full Code Here

    public String getButtonName() {
        return "mouse:" + getMouseButtonName();
    }

    public Vector2i getMousePosition() {
        return new Vector2i(mousePosition);
    }
View Full Code Here

*/
public class Vector2iTypeAdapter implements JsonDeserializer<Vector2i> {
    @Override
    public Vector2i deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        JsonArray jsonArray = json.getAsJsonArray();
        return new Vector2i(jsonArray.get(0).getAsInt(), jsonArray.get(1).getAsInt());
    }
View Full Code Here

    private void processMouseInput(float delta) {
        if (!engine.hasFocus()) {
            return;
        }

        Vector2i deltaMouse = mouse.getDelta();
        //process mouse movement x axis
        if (deltaMouse.x != 0) {
            MouseAxisEvent event = new MouseXAxisEvent(deltaMouse.x * config.getInput().getMouseSensitivity(), delta);
            setupTarget(event);
            for (EntityRef entity : getInputEntities()) {
View Full Code Here

        int height = getLineHeight() * lines.size();
        int width = 0;
        for (String line : lines) {
            width = Math.max(width, getWidth(line));
        }
        return new Vector2i(width, height);
    }
View Full Code Here

    @Override
    public void generateChunk(CoreChunk chunk, Region chunkRegion) {
        DensityFacet solidityFacet = chunkRegion.getFacet(DensityFacet.class);
        SurfaceHeightFacet surfaceFacet = chunkRegion.getFacet(SurfaceHeightFacet.class);
        BiomeFacet biomeFacet = chunkRegion.getFacet(BiomeFacet.class);
        Vector2i pos2d = new Vector2i();
        for (Vector3i pos : ChunkConstants.CHUNK_REGION) {
            pos2d.set(pos.x, pos.z);
            CoreBiome biome = biomeFacet.get(pos2d);
            chunk.setBiome(pos.x, pos.y, pos.z, biome);

            float density = solidityFacet.get(pos);
            if (density >= 32) {
View Full Code Here

    }

    @Override
    public Rect2i deserialize(PersistedData data, DeserializationContext context) {
        PersistedDataMap map = data.getAsValueMap();
        Vector2i min = context.deserializeAs(map.get(MIN_FIELD), Vector2i.class);
        Vector2i size = context.deserializeAs(map.get(SIZE_FIELD), Vector2i.class);
        return Rect2i.createFromMinAndSize(min, size);
    }
View Full Code Here

TOP

Related Classes of org.terasology.math.Vector2i

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.