List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer setColor
public void setColor(Color color)
From source file:com.hindelid.ld.thirtyfour.TreeBranch.java
License:Apache License
public void render(ShapeRenderer aShapeRenderer) { if (mTheOneActive) { sGlobal.x = mStart.x;// + (mEnd.x - mStart.x) * (sGlobal.y - mStart.y) / (mEnd.y - mStart.y); if (sGlobal.y > mEnd.y) { sNext = true;/*from ww w .j a v a2 s . c o m*/ if (mFirstRenderer) { // To keep up if the fps is lower than number of BranchTress grow per second. split(); } } mFirstRenderer = false; } if (mActive) { // aShapeRenderer.setColor(Color.RED); if (mTheOneActive && sGlobal.y < mEnd.y) { aShapeRenderer.line(mStart.x, mStart.y, sGlobal.x, sGlobal.y /*mStart.x + (sGlobal.x - mStart.x) / (mEnd.x - mStart.x), mStart.y + (sGlobal.y - mStart.y) / (mEnd.y - mStart.y)*/); } else { aShapeRenderer.line(mStart, mEnd); } if (mEnd.y + 10f < sGlobal.y) { Main.mNextRoot = this; } aShapeRenderer.setColor(Color.BROWN); } else { aShapeRenderer.line(mStart, mEnd); } if (null != mLeftBranch) { mLeftBranch.render(aShapeRenderer); } if (null != mRightBranch) { mRightBranch.render(aShapeRenderer); } if (null != mMiddleBranch) { mMiddleBranch.render(aShapeRenderer); } }
From source file:com.jmstudios.pointandhit.ShootAnimation.java
License:Open Source License
public void draw(ShapeRenderer shapeRenderer) { if (shooting) { ShapeType previousType = shapeRenderer.getCurrentType(); shapeRenderer.set(ShapeType.Filled); shapeRenderer.setColor(targetManager.currentTheme.bullet); shapeRenderer.circle(currentX, currentY, currentRadius); shapeRenderer.set(previousType); }//w ww .jav a2 s . com }
From source file:com.jmstudios.pointandhit.Target.java
License:Open Source License
public void draw(ShapeRenderer shapeRenderer) { ShapeType previousType = shapeRenderer.getCurrentType(); shapeRenderer.set(ShapeType.Filled); if (currentRadius > 0) { shapeRenderer.setColor(targetManager.currentTheme.target); shapeRenderer.circle(centerPosition.x, centerPosition.y, getRadius()); }//www . ja va 2 s . c o m if (dying) { shapeRenderer.setColor(targetManager.currentTheme.background); // Background color shapeRenderer.circle(centerPosition.x, centerPosition.y, currentDyingRadius); } shapeRenderer.set(previousType); }
From source file:com.jmstudios.pointandhit.UserPointer.java
License:Open Source License
public void draw(ShapeRenderer shapeRenderer, GameTheme gameTheme) { ShapeType previousType = shapeRenderer.getCurrentType(); shapeRenderer.set(ShapeType.Filled); shapeRenderer.setColor(gameTheme.userPointer); Vector2 centerPosition = getCenterPosition(); shapeRenderer.circle(centerPosition.x, centerPosition.y, radius); shapeRenderer.set(previousType);//w ww .j a va 2 s. c om }
From source file:com.kotcrab.vis.editor.module.scene.entitymanipulator.RectangularSelection.java
License:Apache License
public void render(ShapeRenderer shapeRenderer) { if (rectToDraw != null) { Gdx.gl20.glEnable(GL20.GL_BLEND); Color border = selectionMode == SelectionMode.Inner ? INNER_MODE_BORDER_COLOR : OVERLAP_MODE_BORDER_COLOR; Color fill = selectionMode == SelectionMode.Inner ? INNER_MODE_FILL_COLOR : OVERLAP_MODE_FILL_COLOR; shapeRenderer.setColor(border); shapeRenderer.begin(ShapeType.Line); shapeRenderer.rect(rectToDraw.getX(), rectToDraw.getY(), rectToDraw.getWidth(), rectToDraw.getHeight()); shapeRenderer.end();/* www.j a v a2 s. c om*/ shapeRenderer.setColor(fill); shapeRenderer.begin(ShapeType.Filled); shapeRenderer.rect(rectToDraw.getX(), rectToDraw.getY(), rectToDraw.getWidth(), rectToDraw.getHeight()); shapeRenderer.end(); } }
From source file:com.kotcrab.vis.editor.module.scene.entitymanipulator.tool.RotateTool.java
License:Apache License
@Override public void render(ShapeRenderer shapeRenderer) { super.render(shapeRenderer); if (totalSelectionBounds != null) { innerRadius = camera.getZoom() * 0.6f * 100f / scene.pixelsPerUnit; outerRadius = camera.getZoom() * 0.7f * 100f / scene.pixelsPerUnit; circleCenterX = totalSelectionBounds.x + totalSelectionBounds.width / 2; circleCenterY = totalSelectionBounds.y + totalSelectionBounds.height / 2; shapeRenderer.setColor(Color.WHITE); shapeRenderer.begin(ShapeType.Line); shapeRenderer.circle(circleCenterX, circleCenterY, innerRadius, 36); shapeRenderer.circle(circleCenterX, circleCenterY, outerRadius, 36); float rotation = entityManipulator.getSelectedEntities().peek().getRotation(); float startX = circleCenterX; float startY = circleCenterY - innerRadius; float endX = circleCenterX; float endY = circleCenterY + innerRadius; shapeRenderer.setColor(Color.RED); ShapeRendererUtils.lineRotatedAroundPoint(shapeRenderer, startX, startY, endX, endY, rotation, circleCenterX, circleCenterY); shapeRenderer.setColor(Color.GREEN); ShapeRendererUtils.lineRotatedAroundPoint(shapeRenderer, startX, startY, endX, endY, rotation + 90, circleCenterX, circleCenterY); shapeRenderer.end();//from w ww .j a va 2s .co m } }
From source file:com.kotcrab.vis.editor.module.scene.entitymanipulator.tool.ScaleTool.java
License:Apache License
@Override public void render(ShapeRenderer shapeRenderer) { super.render(shapeRenderer); if (totalSelectionBounds != null) { float centerX = totalSelectionBounds.x + totalSelectionBounds.width / 2; float centerY = totalSelectionBounds.y + totalSelectionBounds.height / 2; float centerRectSize = 0.1f * camera.getZoom() * 100f / scene.pixelsPerUnit; float lineLengthX = 1 * camera.getZoom() * 100f / scene.pixelsPerUnit; float lineLengthY = 1 * camera.getZoom() * 100f / scene.pixelsPerUnit; if (Gdx.input.isButtonPressed(Buttons.LEFT)) { if (mouseLooping.isOnVirtualScreen() == false) { if (mouseInsideRectX) lineLengthX = camera.getInputX() - centerX; if (mouseInsideRectY) lineLengthY = camera.getInputY() - centerY; } else { //if mouse is on virtual screen, method above won't work because line would be flipped //but also on virtual screen line end won't be visible anyways so we are just drawing very long line if (mouseInsideRectX) lineLengthX = 100000; if (mouseInsideRectY) lineLengthY = 100000; }//w ww. ja v a 2 s . c om } shapeRenderer.setColor(Color.GREEN); shapeRenderer.begin(ShapeType.Line); shapeRenderer.line(centerX, centerY, centerX + lineLengthX, centerY); shapeRenderer.end(); shapeRenderer.setColor(mouseInsideRectX ? xRectOver : xRect); shapeRenderer.begin(ShapeType.Filled); rect(shapeRenderer, xScaleRect.set(centerX + lineLengthX - centerRectSize / 2, centerY - centerRectSize / 2, centerRectSize, centerRectSize)); shapeRenderer.end(); shapeRenderer.setColor(Color.RED); shapeRenderer.begin(ShapeType.Line); shapeRenderer.line(centerX, centerY, centerX, centerY + lineLengthY); shapeRenderer.end(); shapeRenderer.setColor(mouseInsideRectY ? yRectOver : yRect); shapeRenderer.begin(ShapeType.Filled); rect(shapeRenderer, yScaleRect.set(centerX - centerRectSize / 2, centerY + lineLengthY - centerRectSize / 2, centerRectSize, centerRectSize)); shapeRenderer.end(); } }
From source file:com.me.mygdxgame.WallActor.java
License:Apache License
public void drawBox(ShapeRenderer sr) { sr.setColor(wallColor); sr.box(bounds.x, bounds.y, 0, bounds.width, bounds.height, 0); }
From source file:com.mygdx.game.BusDrawer.java
@Override public void draw(ShapeRenderer sr, Vehicle vehicle) { sr.setColor(Color.MAGENTA); float x = vehicle.getXOnScreen(); float y = vehicle.getYOnScreen(); int widthRect, heightRect; if (!vehicle.isTurned()) { if (vehicle.getStartMotionDirection() == Constants.leftToRight || vehicle.getStartMotionDirection() == Constants.rightToLeft) { widthRect = vehicle.getWidth(); heightRect = vehicle.getHeight(); } else {// w w w . j av a2 s . c om widthRect = vehicle.getHeight(); heightRect = vehicle.getWidth(); } } else { if (vehicle.getFinishMotionDirection() == Constants.leftToRight || vehicle.getFinishMotionDirection() == Constants.rightToLeft) { widthRect = vehicle.getWidth(); heightRect = vehicle.getHeight(); } else { widthRect = vehicle.getHeight(); heightRect = vehicle.getWidth(); } } sr.rect(x, y, widthRect, heightRect); }
From source file:com.mygdx.game.CarDrawer.java
@Override public void draw(ShapeRenderer sr, Vehicle vehicle) { sr.setColor(Color.RED); float x = vehicle.getXOnScreen(); float y = vehicle.getYOnScreen(); int widthRect, heightRect; if (!vehicle.isTurned()) { if (vehicle.getStartMotionDirection() == Constants.leftToRight || vehicle.getStartMotionDirection() == Constants.rightToLeft) { widthRect = vehicle.getWidth(); heightRect = vehicle.getHeight(); } else {// www .ja v a 2 s. c o m widthRect = vehicle.getHeight(); heightRect = vehicle.getWidth(); } } else { if (vehicle.getFinishMotionDirection() == Constants.leftToRight || vehicle.getFinishMotionDirection() == Constants.rightToLeft) { widthRect = vehicle.getWidth(); heightRect = vehicle.getHeight(); } else { widthRect = vehicle.getHeight(); heightRect = vehicle.getWidth(); } } sr.rect(x, y, widthRect, heightRect); // // sr.setColor(Color.YELLOW); // sr.rect(x, y, 10, 10); }