verts[idx++] = (col+1) * gridWidth; verts[idx] = (row) * gridHeight; tmpPoly.setVertices(verts);
verts[idx++] = (col+1) * gridWidth; verts[idx] = (row) * gridHeight; tmpPoly.setVertices(verts);
System.arraycopy(floatArray2.items, 0, overlap.getVertices(), 0, floatArray2.size); else overlap.setVertices(floatArray2.toArray());
System.arraycopy(floatArray2.items, 0, overlap.getVertices(), 0, floatArray2.size); else overlap.setVertices(floatArray2.toArray());
public static void parsePolygon(Polygon p, String s) { String[] vs = s.split(NUMBER_PARAM_SEPARATOR); if (vs.length < 6) return; float verts[] = new float[vs.length]; for (int i = 0; i < vs.length; i++) { verts[i] = Float.parseFloat(vs[i]); } p.setVertices(verts); }
public static void deletePoint(Polygon poly, int index) { float verts[] = poly.getVertices(); if (verts.length < 8) return; int length = verts.length; float destination[] = new float[length - 2]; // index = index * 2; System.arraycopy(verts, 0, destination, 0, index); System.arraycopy(verts, index + 2, destination, index, length - index - 2); poly.setVertices(destination); }
public static void addPoint(Polygon poly, float x, float y, int index) { float verts[] = poly.getVertices(); x -= poly.getX(); y -= poly.getY(); int length = verts.length; float destination[] = new float[length + 2]; System.arraycopy(verts, 0, destination, 0, index); destination[index] = x; destination[index + 1] = y; System.arraycopy(verts, index, destination, index + 2, length - index); poly.setVertices(destination); }
@Override public void write(Json json) { BladeJson bjson = (BladeJson) json; // Reset vertices if bboxFromRenderer to save always with 0.0 value if (bboxFromRenderer && bjson.getMode() == Mode.MODEL) { float[] verts = bbox.getVertices(); bbox.setVertices(new float[8]); super.write(json); bbox.setVertices(verts); } else { super.write(json); } if (bjson.getMode() == Mode.MODEL) { json.writeValue("renderer", renderer, null); } else { json.writeValue("renderer", renderer); json.writeValue("tweens", tweens, ArrayList.class, Tween.class); json.writeValue("playingSound", playingSound); } json.writeValue("scaleX", scaleX); json.writeValue("scaleY", scaleY); json.writeValue("rot", rot); if(tint != null) json.writeValue("tint", tint); json.writeValue("fakeDepth", fakeDepth); json.writeValue("bboxFromRenderer", bboxFromRenderer); }
@Override public void read(Json json, JsonValue jsonData) { BladeJson bjson = (BladeJson) json; if (bjson.getMode() == Mode.MODEL) { id = json.readValue("id", String.class, jsonData); float[] verts = json.readValue("bbox", float[].class, jsonData); if (verts.length > 0) bbox.setVertices(verts); } else { } Vector2 pos = json.readValue("pos", Vector2.class, jsonData); if (pos != null) { float worldScale = EngineAssetManager.getInstance().getScale(); bbox.setPosition(pos.x * worldScale, pos.y * worldScale); bbox.setScale(worldScale, worldScale); visible = json.readValue("visible", boolean.class, visible, jsonData); } } }
private void computeBbox() { if (bbox == null) return; if (bbox.getVertices() == null || bbox.getVertices().length != 8) { bbox.setVertices(new float[8]); } float[] verts = bbox.getVertices(); verts[0] = -getWidth() / 2; verts[1] = 0f; verts[2] = -getWidth() / 2; verts[3] = getHeight(); verts[4] = getWidth() / 2; verts[5] = getHeight(); verts[6] = getWidth() / 2; verts[7] = 0f; bbox.dirty(); }
protected void computeBbox() { if (bbox == null) return; if (bbox.getVertices() == null || bbox.getVertices().length != 8) { bbox.setVertices(new float[8]); } float dx = getAlignDx(getWidth(), orgAlign); float dy = getAlignDy(getHeight(), orgAlign); float[] verts = bbox.getVertices(); verts[0] = dx; verts[1] = dy; verts[2] = dx; verts[3] = getHeight() + dy; verts[4] = getWidth() + dx; verts[5] = getHeight() + dy; verts[6] = getWidth() + dx; verts[7] = dy; bbox.dirty(); }
private void computeBbox() { if (bbox == null) return; if (bbox.getVertices() == null || bbox.getVertices().length != 8) { bbox.setVertices(new float[8]); } float dx = getAlignDx(getWidth(), orgAlign); float dy = getAlignDy(getHeight(), orgAlign); float[] verts = bbox.getVertices(); verts[0] = dx; verts[1] = dy; verts[2] = dx; verts[3] = getHeight() + dy; verts[4] = getWidth() + dx; verts[5] = getHeight() + dy; verts[6] = getWidth() + dx; verts[7] = dy; bbox.dirty(); }
verts[idx++] = (col+1) * gridWidth; verts[idx] = (row) * gridHeight; tmpPoly.setVertices(verts);
Polygon bbox = e.getBBox(); bbox.setVertices(new float[8]);
bbox.setVertices(new float[8]); FloatArray p = bounds.getPolygons().get(0); bbox.setVertices(p.toArray()); bbox.dirty(); Rectangle boundingRectangle = bbox.getBoundingRectangle();
System.arraycopy(floatArray2.items, 0, overlap.getVertices(), 0, floatArray2.size); else overlap.setVertices(floatArray2.toArray());
wz.bbox.setVertices(walkZonePol.getVertices()); wz.bbox.setScale(walkZonePol.getScaleX(), walkZonePol.getScaleY()); wz.bbox.setPosition(walkZonePol.getX(), walkZonePol.getY());