List of usage examples for com.badlogic.gdx.graphics Color GREEN
Color GREEN
To view the source code for com.badlogic.gdx.graphics Color GREEN.
Click Source Link
From source file:org.bladecoder.bladeengine.util.Utils3D.java
License:Apache License
private static void createAxes() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();//from w w w .j a v a2 s.c o m MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, Usage.Position | Usage.Color, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, Usage.Position | Usage.Color, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 10, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 10, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 10); axesModel = modelBuilder.end(); axesInstance = new ModelInstance(axesModel); }
From source file:pl.kotcrab.libgdx.util.RectangleDrawer.java
License:Apache License
public RectangleDrawer() { shapeRenderer = new ShapeRenderer(); matrix = new Matrix4(); matrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); shapeRenderer.setProjectionMatrix(matrix); shapeRenderer.setColor(Color.GREEN); }
From source file:qaida.app.Haraf.java
public void display() { batch.begin();//from w ww . java 2 s .c o m batch.draw(img, fX, fY); batch.end(); shape.begin(ShapeRenderer.ShapeType.Filled); if (bShowDarker) { shape.setColor(Color.BLUE); } else { shape.setColor(Color.GREEN); } shape.rect(playButton.getX(), playButton.getY(), playButton.getWidth(), playButton.getHeight()); shape.setColor(Color.WHITE); shape.triangle(playButton.getX() + 2, playButton.getY() + 18, playButton.getX() + 18, playButton.getY() + 10, playButton.getX() + 2, playButton.y + 2); shape.end(); }
From source file:releasethekraken.ui.Sidebar.java
public Sidebar(GameRenderer renderer) { super(renderer, 0, 0, 0.2F, 1.0F); this.color = Color.valueOf("3173DE"); this.borderColor = this.color.cpy().sub(0.1F, 0.1F, 0.1F, 0); this.depth = 1; //Set the render depth so that it renders under its contents //Create arrays of children UI objects this.unitButtons = new Array<UiButton>(); this.powerupButtons = new Array<UiButton>(); //Variables to control button position and size. Some will be changed in the for loops float buttonX; float buttonY; float xOffset; float yOffset; final float buttonWidth = 0.09F; final float buttonHeight = 0.12F; final int scrWidth = Gdx.graphics.getWidth(); final int scrHeight = Gdx.graphics.getHeight(); //Array of purchasable units. TODO: Generate this instead Class[] purchaseableUnits = { EntityFish.class, EntityTurtle.class, EntityOrca.class, EntityShark.class }; for (int i = 0; i < 4; i++) //Temporary, until we get actual units to represent {// w w w.j a v a 2 s .c o m //Calculate X and Y offsets for the buttons based on the counter variable i xOffset = (i % 2 == 1 ? 0.098F * scrWidth : 0); yOffset = (i > 1 ? 0.13F * scrHeight : 0); //Set the button's position buttonX = 0.006F * scrWidth + xOffset; buttonY = 0.75F * scrHeight - yOffset; this.unitButtons.add(new PurchaseUnitUiButton(renderer, buttonX, buttonY, buttonWidth, buttonHeight, purchaseableUnits[i])); } for (int i = 0; i < 4; i++) { //Calculate X and Y offsets for the buttons based on the counter variable i xOffset = (i % 2 == 1 ? 0.098F * scrWidth : 0); yOffset = (i > 1 ? 0.13F * scrHeight : 0); //Set the button's position buttonX = 0.006F * scrWidth + xOffset; buttonY = 0.4F * scrHeight - yOffset; this.powerupButtons.add(new PowerUpUiButton(renderer, buttonX, buttonY, buttonWidth, buttonHeight, EntityPowerUp.Ability.values()[i])); } //Create the Release the Kraken button this.krakenButton = new UiButton(renderer, 0.0F, 0.0F, 0.2F, 0.15F, "RELEASE\nTHE KRAKEN", Color.GREEN.cpy().sub(0.5F, 0.5F, 0.5F, 0)) { @Override public void onClick(int mouseButton) { super.onClick(mouseButton); if (this.world.getPoints() >= this.world.getPointsForKraken()) { Vector2 spawnPos = new Vector2(); this.world.getFirstPath().getSmoothPath().valueAt(spawnPos, 0.02F); Gdx.app.log(this.getClass().getName(), "Attempting to RELEASE THE KRAKEN!"); new EntityKraken(this.world, spawnPos.x, spawnPos.y); this.world.addPoints(0 - this.world.getPointsForKraken()); //Subtract points } } }; this.krakenButton.setToolTip(new TextToolTip(renderer, "Click to RELEASE THE KRAKEN!")); //Just for testing tooltips //this.krakenButton.setDisabled(true); //Add the UI objects to the global list for (UiButton button : this.unitButtons) renderer.uiObjects.add(button); for (UiButton button : this.powerupButtons) renderer.uiObjects.add(button); renderer.uiObjects.add(this.krakenButton); renderer.uiObjects.add(new UiText(renderer, 0.1F * scrWidth, 0.9F * scrHeight, 0.2F * scrWidth, 0.1F * scrHeight, "Purchase Units")); renderer.uiObjects.add(new UiText(renderer, 0.1F * scrWidth, 0.55F * scrHeight, 0.2F * scrWidth, 0.1F * scrHeight, "Use Power Ups")); renderer.uiObjects.add(new UiText(renderer, 0.06F * scrWidth, 0.23F * scrHeight, 0.2F * scrWidth, 0.1F * scrHeight, "Points")); renderer.uiObjects .add(new UiPointsBar(renderer, 0.006F * scrWidth, 0.16F * scrHeight, 0.2F - 0.006F * 2, 0.04F)); renderer.uiObjects .add(new CoinsDisplay(renderer, 0.006F * scrWidth, 0.92F * scrHeight, 0.2F - 0.006F * 2, 0.06F)); }
From source file:rosthouse.rosty.systems.debug.ShapeRenderSystem.java
@Override public void processEntity(Entity entity, float deltaTime) { OrthographicCameraComponent cmpCamera = cmCamera.get(entity); shapeRenderer.setProjectionMatrix(cmpCamera.camera.combined); Gdx.gl20.glLineWidth(2);/* w ww . ja va 2 s . c o m*/ shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); for (int i = 0; i < this.entities.size(); i++) { Entity current = entities.get(i); drawEntityInformation(spriteBatch, cmpCamera.camera, current); if (cmPolygon.has(current)) { shapeRenderer.setColor(Color.BLUE); PolygonComponent cpPolygon = cmPolygon.get(current); shapeRenderer.polygon(cpPolygon.polygon.getTransformedVertices()); } if (cmRectangle.has(current)) { shapeRenderer.setColor(Color.RED); RectangleComponent cpRectangle = cmRectangle.get(current); shapeRenderer.rect(cpRectangle.rectangle.x, cpRectangle.rectangle.y, cpRectangle.rectangle.width, cpRectangle.rectangle.height); } if (cmSprite.has(current)) { shapeRenderer.setColor(Color.GREEN); SpriteComponent spSprite = cmSprite.get(current); Rectangle boundingRectangle = spSprite.sprite.getBoundingRectangle(); shapeRenderer.rect(boundingRectangle.x, boundingRectangle.y, boundingRectangle.width, boundingRectangle.height); shapeRenderer.setColor(Color.PURPLE); shapeRenderer.point(spSprite.sprite.getOriginX(), spSprite.sprite.getOriginY(), 0); } if (cmEllipse.has(current)) { shapeRenderer.setColor(Color.WHITE); EllipseComponent cpRectangle = cmEllipse.get(current); shapeRenderer.ellipse(cpRectangle.ellipse.x, cpRectangle.ellipse.y, cpRectangle.ellipse.width, cpRectangle.ellipse.height); } } shapeRenderer.end(); spriteBatch.begin(); renderGuiFpsCounter(spriteBatch, cmpCamera.camera); spriteBatch.end(); }
From source file:sink.core.Sink.java
License:Apache License
void drawSelection() { if (selectedActor.getName() != null) { shapeRenderer.begin(ShapeType.Line); shapeRenderer.setColor(Color.GREEN); shapeRenderer.rect(selectedActor.getX(), selectedActor.getY(), selectedActor.getWidth(), selectedActor.getHeight()); shapeRenderer.end();//from w w w.j a v a 2 s . co m } }
From source file:spine.SkeletonRendererDebug.java
License:Open Source License
public void draw(Skeleton skeleton) { float skeletonX = skeleton.getX(); float skeletonY = skeleton.getY(); Gdx.gl.glEnable(GL20.GL_BLEND);//from w ww .j a va 2 s.c o m int srcFunc = premultipliedAlpha ? GL20.GL_ONE : GL20.GL_SRC_ALPHA; Gdx.gl.glBlendFunc(srcFunc, GL20.GL_ONE_MINUS_SRC_ALPHA); ShapeRenderer shapes = this.shapes; Array<Bone> bones = skeleton.getBones(); if (drawBones) { shapes.setColor(boneLineColor); shapes.begin(ShapeType.Filled); for (int i = 0, n = bones.size; i < n; i++) { Bone bone = bones.get(i); if (bone.parent == null) continue; float x = skeletonX + bone.data.length * bone.a + bone.worldX; float y = skeletonY + bone.data.length * bone.c + bone.worldY; shapes.rectLine(skeletonX + bone.worldX, skeletonY + bone.worldY, x, y, boneWidth * scale); } shapes.end(); shapes.begin(ShapeType.Line); shapes.x(skeletonX, skeletonY, 4 * scale); } else shapes.begin(ShapeType.Line); if (drawRegionAttachments) { shapes.setColor(attachmentLineColor); Array<Slot> slots = skeleton.getSlots(); for (int i = 0, n = slots.size; i < n; i++) { Slot slot = slots.get(i); Attachment attachment = slot.attachment; if (attachment instanceof RegionAttachment) { RegionAttachment regionAttachment = (RegionAttachment) attachment; float[] vertices = regionAttachment.updateWorldVertices(slot, false); shapes.line(vertices[X1], vertices[Y1], vertices[X2], vertices[Y2]); shapes.line(vertices[X2], vertices[Y2], vertices[X3], vertices[Y3]); shapes.line(vertices[X3], vertices[Y3], vertices[X4], vertices[Y4]); shapes.line(vertices[X4], vertices[Y4], vertices[X1], vertices[Y1]); } } } if (drawMeshHull || drawMeshTriangles) { Array<Slot> slots = skeleton.getSlots(); for (int i = 0, n = slots.size; i < n; i++) { Slot slot = slots.get(i); Attachment attachment = slot.attachment; float[] vertices = null; short[] triangles = null; int hullLength = 0; if (attachment instanceof MeshAttachment) { MeshAttachment mesh = (MeshAttachment) attachment; mesh.updateWorldVertices(slot, false); vertices = mesh.getWorldVertices(); triangles = mesh.getTriangles(); hullLength = mesh.getHullLength(); } else if (attachment instanceof SkinnedMeshAttachment) { SkinnedMeshAttachment mesh = (SkinnedMeshAttachment) attachment; mesh.updateWorldVertices(slot, false); vertices = mesh.getWorldVertices(); triangles = mesh.getTriangles(); hullLength = mesh.getHullLength(); } if (vertices == null || triangles == null) continue; if (drawMeshTriangles) { shapes.setColor(triangleLineColor); for (int ii = 0, nn = triangles.length; ii < nn; ii += 3) { int v1 = triangles[ii] * 5, v2 = triangles[ii + 1] * 5, v3 = triangles[ii + 2] * 5; shapes.triangle(vertices[v1], vertices[v1 + 1], // vertices[v2], vertices[v2 + 1], // vertices[v3], vertices[v3 + 1] // ); } } if (drawMeshHull && hullLength > 0) { shapes.setColor(attachmentLineColor); hullLength = hullLength / 2 * 5; float lastX = vertices[hullLength - 5], lastY = vertices[hullLength - 4]; for (int ii = 0, nn = hullLength; ii < nn; ii += 5) { float x = vertices[ii], y = vertices[ii + 1]; shapes.line(x, y, lastX, lastY); lastX = x; lastY = y; } } } } if (drawBoundingBoxes) { SkeletonBounds bounds = this.bounds; bounds.update(skeleton, true); shapes.setColor(aabbColor); shapes.rect(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()); shapes.setColor(boundingBoxColor); Array<FloatArray> polygons = bounds.getPolygons(); for (int i = 0, n = polygons.size; i < n; i++) { FloatArray polygon = polygons.get(i); shapes.polygon(polygon.items, 0, polygon.size); } } shapes.end(); shapes.begin(ShapeType.Filled); if (drawBones) { shapes.setColor(boneOriginColor); for (int i = 0, n = bones.size; i < n; i++) { Bone bone = bones.get(i); shapes.setColor(Color.GREEN); shapes.circle(skeletonX + bone.worldX, skeletonY + bone.worldY, 3 * scale, 8); } } shapes.end(); }
From source file:ta.firegreen.creation.creator.java
License:Apache License
@Override public void render() { if (fileTexture != null) { bindTexture(mesh, fileTexture.getAbsolutePath()); fileTexture = null;//from w ww .j a v a 2s. c o m } if (fileMTA != null) { nouveau = MeshTA.loadMeshTA(fileMTA); fileMTA = null; } Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); cam.position.set(posX, posY, posZ); cam.lookAt(cibleX, cibleY, cibleZ); cam.update(); if (afficheTexture) mesh.render(renduTexture, cam.combined); else mesh.render(rendu, cam.combined); if (saveIMGFile != null) { final Pixmap p = new Pixmap(Gdx.graphics.getWidth() - 200, Gdx.graphics.getHeight() - 200, Pixmap.Format.RGBA8888); ByteBuffer bytes = ByteBuffer.allocateDirect(p.getPixels().capacity()); Gdx.gl20.glReadPixels(100, 100, Gdx.graphics.getWidth() - 200, Gdx.graphics.getHeight() - 200, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, bytes); int j = p.getPixels().capacity() - 1; for (int i = 0; i < p.getPixels().capacity(); i += 4) { p.getPixels().put(j, bytes.get(i + 3)); j--; p.getPixels().put(j, bytes.get(i + 2)); j--; p.getPixels().put(j, bytes.get(i + 1)); j--; p.getPixels().put(j, bytes.get(i)); j--; } if (!saveIMGFile.getName().endsWith(".png")) if (!saveIMGFile.renameTo(new File(saveIMGFile.getName() + ".png"))) { JOptionPane.showMessageDialog(null, "Le fichier n'a pas pu tre sauvegarder", "Erreur", JOptionPane.ERROR_MESSAGE); return; } PixmapIO.writePNG(new FileHandle(saveIMGFile), p); saveIMGFile = null; } shape.setProjectionMatrix(cam.projection); shape.setTransformMatrix(cam.view); shape.begin(ShapeType.Line); shape.setColor(Color.GREEN); shape.line(new Vector3(-10, 0, 0), new Vector3(10, 0, 0)); shape.setColor(Color.RED); shape.line(new Vector3(0, -10, 0), new Vector3(0, 10, 0)); shape.setColor(Color.BLUE); shape.line(new Vector3(0, 0, -10), new Vector3(0, 0, 10)); shape.end(); cam.translate(0.05f, 0.05f, 0.05f); cam.update(); trianglesSelected.render(rendu, cam.combined); cam.translate(-0.1f, -0.1f, -0.1f); cam.update(); trianglesSelected.render(rendu, cam.combined); try { Thread.sleep(35); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:tilo.modules.graphics.java
License:Open Source License
public Color color(String name) { if (name.startsWith("#")) return Color.valueOf(name.replace("#", "")); if ("clear".equalsIgnoreCase(name)) return Color.CLEAR; else if ("white".equalsIgnoreCase(name)) return Color.WHITE; else if ("black".equalsIgnoreCase(name)) return Color.BLACK; else if ("red".equalsIgnoreCase(name)) return Color.RED; else if ("green".equalsIgnoreCase(name)) return Color.GREEN; else if ("blue".equalsIgnoreCase(name)) return Color.BLUE; else if ("lightgray".equalsIgnoreCase(name)) return Color.LIGHT_GRAY; else if ("gray".equalsIgnoreCase(name)) return Color.GRAY; else if ("darkgray".equalsIgnoreCase(name)) return Color.DARK_GRAY; else if ("pink".equalsIgnoreCase(name)) return Color.PINK; else if ("orange".equalsIgnoreCase(name)) return Color.ORANGE; else if ("yellow".equalsIgnoreCase(name)) return Color.YELLOW; else if ("magenta".equalsIgnoreCase(name)) return Color.MAGENTA; else if ("cyan".equalsIgnoreCase(name)) return Color.CYAN; return Color.CLEAR; }