com.badlogic.gdx.graphics.Color Java Examples
The following examples show how to use
com.badlogic.gdx.graphics.Color.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CyclicOverlap.java From ud405 with MIT License | 6 votes |
@Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewport.apply(); renderer.setProjectionMatrix(viewport.getCamera().combined); renderer.begin(ShapeType.Filled); renderer.setColor(Color.RED); renderer.rect(2, 3.5f, 3, 1.5f, 6, 1, 1, 1, 0); renderer.setColor(Color.GREEN); renderer.rect(2, 3.5f, 3, 1.5f, 6, 1, 1, 1, 120); renderer.setColor(Color.BLUE); renderer.rect(2, 3.5f, 3, 1.5f, 6, 1, 1, 1, 240); // TODO: Make it look like the left end of RED is on top of BLUE renderer.end(); }
Example #2
Source File: DemoCamera.java From ud405 with MIT License | 6 votes |
/** * Renders a blue rectangle showing the field of view of the closeup camera */ public void render(ShapeRenderer renderer) { if (!inCloseupMode) { // Figure out the location of the camera corners in the world Vector2 bottomLeft = myUnproject(closeupCamera, 0, closeupCamera.viewportHeight); Vector2 bottomRight = myUnproject(closeupCamera, closeupCamera.viewportWidth, closeupCamera.viewportHeight); Vector2 topRight = myUnproject(closeupCamera, closeupCamera.viewportWidth, 0); Vector2 topLeft = myUnproject(closeupCamera, 0, 0); // Draw a rectangle showing the closeup camera's field of view renderer.begin(ShapeType.Line); renderer.setColor(Color.BLUE); float[] poly = {bottomLeft.x, bottomLeft.y, bottomRight.x, bottomRight.y, topRight.x, topRight.y, topLeft.x, topLeft.y }; renderer.set(ShapeType.Line); renderer.polygon(poly); renderer.end(); } }
Example #3
Source File: SplatMap.java From Mundus with Apache License 2.0 | 6 votes |
public void clearChannel(SplatTexture.Channel channel) { Pixmap pixmap = getPixmap(); for (int smX = 0; smX < pixmap.getWidth(); smX++) { for (int smY = 0; smY < pixmap.getHeight(); smY++) { c0.set(pixmap.getPixel(smX, smY)); if (channel == SplatTexture.Channel.R) { c0.set(0, c0.g, c0.b, c0.a); } else if (channel == SplatTexture.Channel.G) { c0.set(c0.r, 0, c0.b, c0.a); } else if (channel == SplatTexture.Channel.B) { c0.set(c0.r, c0.g, 0, c0.a); } else if (channel == SplatTexture.Channel.A) { c0.set(c0.r, c0.g, c0.b, 0); } pixmap.drawPixel(smX, smY, Color.rgba8888(c0)); } } }
Example #4
Source File: Window.java From uracer-kotd with Apache License 2.0 | 6 votes |
@Override public void draw (Batch batch, float parentAlpha) { keepWithinStage(); if (style.stageBackground != null) { Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); Stage stage = getStage(); stageToLocalCoordinates(/* in/out */tmpPosition.set(0, 0)); stageToLocalCoordinates(/* in/out */tmpSize.set(stage.getWidth(), stage.getHeight())); style.stageBackground .draw(batch, getX() + tmpPosition.x, getY() + tmpPosition.y, getX() + tmpSize.x, getY() + tmpSize.y); } super.draw(batch, parentAlpha); }
Example #5
Source File: SplatMap.java From Mundus with Apache License 2.0 | 6 votes |
public int additiveBlend(int pixelColor, SplatTexture.Channel channel, float strength) { c0.set(pixelColor); if (channel == SplatTexture.Channel.BASE) { c0.sub(strength, strength, strength, strength); } else if (channel == SplatTexture.Channel.R) { c0.add(strength, 0, 0, 0); } else if (channel == SplatTexture.Channel.G) { c0.add(0, strength, 0, 0); } else if (channel == SplatTexture.Channel.B) { c0.add(0, 0, strength, 0); } else if (channel == SplatTexture.Channel.A) { c0.add(0, 0, 0, strength); } // prevent the sum to be greater than 1 final float sum = c0.r + c0.g + c0.b + c0.a; if (sum > 1f) { final float correction = 1f / sum; c0.r *= correction; c0.g *= correction; c0.b *= correction; c0.a *= correction; } return Color.rgba8888(c0); }
Example #6
Source File: RibbonRenderer.java From talos with Apache License 2.0 | 6 votes |
public void adjustPointData() { float pointAlpha = accumulator.getPointAlpha(particleRef); Polyline polyline = polyline(); for(int i = 1; i < polyline.points.size; i++) { float topThickness = polyline.points.get(i).thickness; float bottomThickness = polyline.points.get(i-1).thickness; Color topColor = polyline.points.get(i).color; Color bottomColor = polyline.points.get(i).color; tmpColor.set(topColor.r+(bottomColor.r-topColor.r)*pointAlpha, topColor.g+(bottomColor.g-topColor.g)*pointAlpha, topColor.b+(bottomColor.b-topColor.b)*pointAlpha, topColor.a+(bottomColor.a-topColor.a)*pointAlpha); //polyline.setPointData(i, 0, 0, topThickness+(bottomThickness-topThickness)*pointAlpha, tmpColor); } }
Example #7
Source File: RectangularFlower.java From ud405 with MIT License | 6 votes |
@Override public void render () { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(Color.GREEN); shapeRenderer.rectLine(100, 0, 100, 300, 20); // TODO: Draw two leaves on the stem // TODO: Set the active color to yellow // TODO: Use a loop to draw 20 of these petals in a circle float petalAngle = 45.0f; shapeRenderer.rect(100, 300, 0, 0, 40, 40, 1, 1, petalAngle); shapeRenderer.end(); }
Example #8
Source File: Renderer.java From VuforiaLibGDX with MIT License | 6 votes |
public Renderer() { lights = new Environment(); lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE)); camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.near = 1.0F; camera.far = 1000.0F; //set camera into "Vuforia - style" direction camera.position.set(new Vector3(0,0,0)); camera.lookAt(new Vector3(0,0,1)); IntBuffer buffer = BufferUtils.newIntBuffer(16); Gdx.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_IMAGE_UNITS, buffer); int units = buffer.get(0); Log.d("TAG", "Max texture units: "+units); modelBatch = new ModelBatch(new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 0))); }
Example #9
Source File: DrawingLines.java From ud405 with MIT License | 6 votes |
@Override public void render() { // As always, first we clear the screen Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Then we start our shapeRenderer batch, this time with ShapeType.Line shapeRenderer.begin(ShapeType.Line); // A Simple white line shapeRenderer.setColor(Color.WHITE); shapeRenderer.line(0, 0, 100, 100); // We can set different colors using two methods. We can use constants like so. shapeRenderer.setColor(Color.MAGENTA); shapeRenderer.line(10, 0, 110, 100); // We can also set a color using RGBA values shapeRenderer.setColor(0, 1, 0, 1); shapeRenderer.line(20, 0, 120, 100); // We can also do fancy things like gradients shapeRenderer.line(30, 0, 130, 100, Color.BLUE, Color.RED); // The last interesting thing we can do is draw a bunch of connected line segments using polyline // First we set up the list of vertices, where the even positions are x coordinates, and the odd positions are the y coordinates float[] verticies = {100, 200, 300, 300, 200, 300, 300, 200}; shapeRenderer.polyline(verticies); // Finally, as always, we end the batch shapeRenderer.end(); }
Example #10
Source File: NormalBlockRenderer.java From Radix with MIT License | 6 votes |
@Override public void renderWest(int atlasIndex, float z1, float y1, float z2, float y2, float x, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) { // NEGATIVE X float u = getU(atlasIndex); float v = getV(atlasIndex); builder.setUVRange(u, v, u, v); c00.setPos(x, y1, z1).setNor(-1, 0, 0); c01.setPos(x, y1, z2).setNor(-1, 0, 0); c10.setPos(x, y2, z1).setNor(-1, 0, 0); c11.setPos(x, y2, z2).setNor(-1, 0, 0); Color c = getColor((int) x, (int) y1, (int) z1); if(pcld == null) { builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a); } else { c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a); c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a); c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a); c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a); } builder.rect(c01, c11, c10, c00); }
Example #11
Source File: EntityHelpers.java From xibalba with MIT License | 6 votes |
/** * Update sprite position (called after turn is over, after all tweens etc), and update the sprite * color based on cell they're in. * * @param entity The entity * @param cellX x position * @param cellY y position */ public void updateSprite(Entity entity, float cellX, float cellY) { VisualComponent visual = ComponentMappers.visual.get(entity); visual.sprite.setPosition(cellX * Main.SPRITE_WIDTH, cellY * Main.SPRITE_HEIGHT); MapCell cell = WorldManager.mapHelpers.getCell(cellX, cellY); if (cell.isWater()) { Color tinted = visual.color.cpy().lerp(cell.sprite.getColor(), .5f); if (visual.sprite.getColor() != tinted) { visual.sprite.setColor(tinted); } } else { if (visual.sprite.getColor() != visual.color) { visual.sprite.setColor(visual.color); } } }
Example #12
Source File: VisImageTextButton.java From vis-ui with Apache License 2.0 | 6 votes |
@Override public void draw (Batch batch, float parentAlpha) { updateImage(); Color fontColor; if (isDisabled() && style.disabledFontColor != null) fontColor = style.disabledFontColor; else if (isPressed() && style.downFontColor != null) fontColor = style.downFontColor; else if (isChecked() && style.checkedFontColor != null) fontColor = (isOver() && style.checkedOverFontColor != null) ? style.checkedOverFontColor : style.checkedFontColor; else if (isOver() && style.overFontColor != null) fontColor = style.overFontColor; else fontColor = style.fontColor; if (fontColor != null) label.getStyle().fontColor = fontColor; super.draw(batch, parentAlpha); if (focusBorderEnabled && drawBorder && style.focusBorder != null) style.focusBorder.draw(batch, getX(), getY(), getWidth(), getHeight()); }
Example #13
Source File: SkinTextFont.java From beatoraja with GNU General Public License v3.0 | 6 votes |
@Override public void draw(SkinObjectRenderer sprite, float offsetX, float offsetY) { if(font != null) { font.getData().setScale(region.height / parameter.size); sprite.setType(getFilter() != 0 ? SkinObjectRenderer.TYPE_LINEAR : SkinObjectRenderer.TYPE_NORMAL); final float x = (getAlign() == 2 ? region.x - region.width : (getAlign() == 1 ? region.x - region.width / 2 : region.x)); if(!getShadowOffset().isZero()) { setLayout(new Color(color.r / 2, color.g / 2, color.b / 2, color.a), region); sprite.draw(font, layout, x + getShadowOffset().x + offsetX, region.y - getShadowOffset().y + offsetY + region.getHeight()); } setLayout(color, region); sprite.draw(font, layout, x + offsetX, region.y + offsetY + region.getHeight()); } }
Example #14
Source File: TextureUtil.java From seventh with GNU General Public License v2.0 | 6 votes |
/** * Applying mask into image using specified masking color. Any Color in the * image that matches the masking color will be converted to transparent. * * @param img The source image * @param keyColor Masking color * @return Masked image */ public static Pixmap applyMask(Pixmap img, Color keyColor) { Pixmap alpha = new Pixmap(img.getWidth(), img.getHeight(), Format.RGBA8888); //alpha.drawPixmap(img, 0, 0); int width = alpha.getWidth(); int height = alpha.getHeight(); int colorMask = Color.rgba8888(keyColor); //alpha.setColor(0xff00009f); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int col = img.getPixel(x, y); if ( col != colorMask ) { alpha.drawPixel(x, y, img.getPixel(x, y)); } } } return alpha; }
Example #15
Source File: Utils3D.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public static void createFloor() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin(); MeshPartBuilder mpb = modelBuilder.part("parts", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal | Usage.ColorUnpacked, new Material( ColorAttribute.createDiffuse(Color.WHITE))); mpb.setColor(1f, 1f, 1f, 1f); // mpb.box(0, -0.1f, 0, 10, .2f, 10); mpb.rect(-10, 0, -10, -10, 0, 10, 10, 0, 10, 10, 0, -10, 0, 1, 0); floorModel = modelBuilder.end(); floorInstance = new ModelInstance(floorModel); // TODO Set only when FBO is active floorInstance.materials.get(0).set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)); }
Example #16
Source File: CrtScreen.java From uracer-kotd with Apache License 2.0 | 5 votes |
public CrtScreen (boolean barrelDistortion, RgbMode mode, int effectsSupport) { // @off super( ShaderLoader.fromFile( "screenspace", "crt-screen", (barrelDistortion ? "#define ENABLE_BARREL_DISTORTION\n" : "") + (mode == RgbMode.RgbShift ? "#define ENABLE_RGB_SHIFT\n" : "") + (mode == RgbMode.ChromaticAberrations ? "#define ENABLE_CHROMATIC_ABERRATIONS\n" : "") + (isSet(Effect.TweakContrast.v, effectsSupport) ? "#define ENABLE_TWEAK_CONTRAST\n" : "") + (isSet(Effect.Vignette.v, effectsSupport) ? "#define ENABLE_VIGNETTE\n" : "") + (isSet(Effect.Tint.v, effectsSupport) ? "#define ENABLE_TINT\n" : "") + (isSet(Effect.Scanlines.v, effectsSupport) ? "#define ENABLE_SCANLINES\n" : "") + (isSet(Effect.PhosphorVibrance.v, effectsSupport) ? "#define ENABLE_PHOSPHOR_VIBRANCE\n" : "") + (isSet(Effect.ScanDistortion.v, effectsSupport) ? "#define ENABLE_SCAN_DISTORTION\n" : "") )); // @on dodistortion = barrelDistortion; vtint = new Vector3(); tint = new Color(); chromaticDispersion = new Vector2(); setTime(0f); setTint(1.0f, 1.0f, 0.85f); setDistortion(0.3f); setZoom(1f); setRgbMode(mode); // default values switch (mode) { case ChromaticAberrations: setChromaticDispersion(-0.1f, -0.1f); break; case RgbShift: setColorOffset(0.003f); break; case None: break; default: throw new GdxRuntimeException("Unsupported RGB mode"); } }
Example #17
Source File: GdxCanvas.java From seventh with GNU General Public License v2.0 | 5 votes |
@Override public void drawLine(int x1, int y1, int x2, int y2, Integer color, float thickness) { Color c=setTempColor(color); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl.glLineWidth(thickness); this.shapes.setColor(c); this.shapes.begin(ShapeType.Line); this.shapes.line(x1, y1, x2, y2); this.shapes.end(); Gdx.gl.glDisable(GL20.GL_BLEND); }
Example #18
Source File: DefaultAnimator.java From uracer-kotd with Apache License 2.0 | 5 votes |
private void updateLights (TrackProgressData progressData, Color ambient, Color trees, float collisionFactor) { float base = 0.1f; float timeModFactor = URacer.Game.getTimeModFactor(); float blue = (base * 3f * timeModFactor) * (1 - AMath.sigmoidT(collisionFactor, 0.7f, true)); // Gdx.app.log("DefaultAnimator", "blue=" + blue); //@off ambient.set( base * 1.5f, base, base + blue, 0.55f + 0.05f * timeModFactor ); //@on ambient.clamp(); trees.set(ambient); // Gdx.app.log("", "" + ambient); // update point lights, more intensity from lights near the player PlayerCar player = world.getPlayer(); PointLight[] lights = world.getLights(); if (lights != null && player != null) { for (int l = 0; l < lights.length; l++) { float dist = player.getWorldPosMt().dst2(lights[l].getPosition()); float maxdist = 30; maxdist *= maxdist; dist = 1 - MathUtils.clamp(dist, 0, maxdist) / maxdist; float r = 1f; float g = 1f; float b = 1f; float a = 0.65f; lights[l].setColor(r, g, b, a);// + AMath.fixup(0.4f * dist)); } } }
Example #19
Source File: Param.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public static Color parseColor(String color) { if (color == null || color.trim().isEmpty()) { return null; // the default color in the style will be used } switch (color.trim()) { case "black": return Color.BLACK; case "white": return Color.WHITE; default: return Color.valueOf(color); } }
Example #20
Source File: Scenarios.java From collider with Apache License 2.0 | 5 votes |
private static void initFractal(double shotDiam) { Game.engine.setBG(new Color(0.0f, 0.02f, 0.05f, 1.0f)); new CBounds(); HBRect rect = Game.engine.makeRect(); rect.setPos(640, 360); rect.setDims(80); rect.commit(Double.POSITIVE_INFINITY); new CTarget(rect, CPlayerShip.COLOR); for(int i = 0; i < 8; i++) { double angle = 2*Math.PI*i/8.0; double cos = Math.cos(angle); double sin = Math.sin(angle); new CStickyGun(640 + cos*350, 360 + sin*350, angle + Math.PI, shotDiam); } }
Example #21
Source File: GuiFactory.java From Entitas-Java with MIT License | 5 votes |
public Table createScore(float width, float height) { Table tableProfile = new Table(); tableProfile.setBounds(0, 0, width, height); Image imageLives = new Image(((TextureAtlas) assetsManager.getTextureAtlas(GUI_ATLAS)).findRegion("vidas")); imageLives.setName("IMAGE_LIVES"); Label lives = new Label("0", skin, "default", Color.ORANGE); lives.setName("LIVES"); Label labelScore = new Label("Tijeras: ", skin, "default", Color.ORANGE); labelScore.setName("LABEL_SCORE"); Label score = new Label("0000", skin, "default", Color.ORANGE); score.setName("SCORE"); tableProfile.defaults().height(height); tableProfile.defaults().width(width / 4.5f); tableProfile.add(imageLives).left().padRight(15).width(imageLives.getPrefWidth() * ScaleUtil.getSizeRatio()); tableProfile.add(lives).expandY().fill(); tableProfile.add(); tableProfile.add(labelScore).right().expandY().fill(); tableProfile.add(score).right().expandY().fill(); tableProfile.debug(); return tableProfile; }
Example #22
Source File: ColorAttribute.java From uracer-kotd with Apache License 2.0 | 5 votes |
@Override public void set (MaterialAttribute attr) { ColorAttribute colAttr = (ColorAttribute)attr; name = colAttr.name; final Color c = colAttr.color; color.r = c.r; color.g = c.g; color.b = c.b; color.a = c.a; }
Example #23
Source File: GUIConsole.java From libgdx-inGameConsole with Apache License 2.0 | 5 votes |
void refresh () { Array<LogEntry> entries = log.getLogEntries(); logEntries.clear(); // expand first so labels start at the bottom logEntries.add().expand().fill().row(); int size = entries.size; for (int i = 0; i < size; i++) { LogEntry le = entries.get(i); Label l; // recycle the labels so we don't create new ones every refresh if (labels.size > i) { l = labels.get(i); } else { try { l = labelClass.getConstructor(CharSequence.class, Skin.class, String.class, Color.class) .newInstance("", skin, fontName, LogLevel.DEFAULT.getColor()); } catch (Exception e) { try { l = labelClass.getConstructor(CharSequence.class, String.class, Color.class) .newInstance("", fontName, LogLevel.DEFAULT.getColor()); } catch (Exception e2) { throw new RuntimeException( "Label class does not support either (<String>, <Skin>, <String>, <Color>) or (<String>, <String>, <Color>) constructors."); } } l.setWrap(true); labels.add(l); l.addListener(new LogListener(l, skin.getDrawable(tableBackground))); } // I'm not sure about the extra space, but it makes the label highlighting look much better with VisUI l.setText(" " + le.toConsoleString()); l.setColor(le.getColor()); logEntries.add(l).expandX().fillX().top().left().row(); } scroll.validate(); scroll.setScrollPercentY(1); }
Example #24
Source File: NoPageHint.java From gdx-texture-packer-gui with Apache License 2.0 | 5 votes |
public NoPageHint(Skin skin) { String text = App.inst().getI18n().get("atlasPreviewNoPageMsg"); Label lblMessage = new Label(text, new Label.LabelStyle(skin.getFont("default-font"), Color.WHITE)); lblMessage.setAlignment(Align.center); lblMessage.getColor().a = 0.25f; setActor(lblMessage); setFillParent(true); align(Align.center); setTouchable(Touchable.disabled); setBackground(skin.getDrawable("noPreviewFill")); }
Example #25
Source File: DescriptorConverter.java From Mundus with Apache License 2.0 | 5 votes |
public static Fog convert(FogDescriptor fogDescriptor) { if (fogDescriptor == null) return null; Fog fog = new Fog(); fog.density = fogDescriptor.getDensity(); fog.gradient = fogDescriptor.getGradient(); fog.color = new Color(fogDescriptor.getColor()); return fog; }
Example #26
Source File: Scenarios.java From collider with Apache License 2.0 | 5 votes |
private static void initIndicators() { Game.engine.setBG(new Color(0.0f, 0.02f, 0.05f, 1.0f)); new CBounds(); new CVarietyGun(50, 50, .25*Math.PI); new CVarietyGun(1280 - 50, 50, .75*Math.PI); new CVarietyGun(50, 720 - 50, -.25*Math.PI); new CVarietyGun(1280 - 50, 720 - 50, -.75*Math.PI); new CIndicator(640 - 300, 360, true); new CIndicator(640 + 300, 360, false); }
Example #27
Source File: DialogSceneComposerJavaBuilder.java From skin-composer with MIT License | 5 votes |
private static MethodSpec renderMethod() { Color color = rootActor.backgroundColor == null ? Color.WHITE : rootActor.backgroundColor.color; return MethodSpec.methodBuilder("render") .addModifiers(Modifier.PUBLIC) .addStatement("$T.gl.glClearColor($Lf, $Lf, $Lf, $Lf)", Gdx.class, color.r, color.g, color.b, color.a) .addStatement("$T.gl.glClear($T.GL_COLOR_BUFFER_BIT)", Gdx.class, GL20.class) .addStatement("stage.act()") .addStatement("stage.draw()") .returns(void.class).build(); }
Example #28
Source File: DialogColors.java From skin-composer with MIT License | 5 votes |
private void renameColor(ColorData color, String newName) { //style properties for (Array<StyleData> datas : main.getJsonData().getClassStyleMap().values()) { for (StyleData data : datas) { for (StyleProperty property : data.properties.values()) { if (property != null && property.type.equals(Color.class) && property.value != null && property.value.equals(color.getName())) { property.value = newName; } } } } for (DrawableData drawableData : main.getAtlasData().getDrawables()) { //tinted drawables if (drawableData.tintName != null && drawableData.tintName.equals(color.getName())) { drawableData.tintName = newName; } //ten patch drawables else if (drawableData.tenPatchData != null && drawableData.tenPatchData.colorName.equals(color.getName())) { drawableData.tenPatchData.colorName = newName; } } try { color.setName(newName); } catch (ColorData.NameFormatException ex) { Gdx.app.error(getClass().getName(), "Error trying to rename a color.", ex); main.getDialogFactory().showDialogError("Name Error...","Error while naming a color.\\nPlease ensure name is formatted appropriately:\\nNo spaces, don't start with a number, - and _ acceptable.\n\nOpen log?"); } main.getUndoableManager().clearUndoables(); main.getRootTable().refreshStyleProperties(true); main.getRootTable().refreshPreview(); main.getProjectData().setChangesSaved(false); refreshTable(); }
Example #29
Source File: TopPanelModList.java From ModTheSpire with MIT License | 5 votes |
@SpireInsertPatch( locator=Locator.class ) public static void Insert(TopPanel __instance, SpriteBatch sb) { FontHelper.renderFontRightTopAligned( sb, FontHelper.cardDescFont_N, MainMenuModList.makeMTSVersionModCount("ModTheSpire " + Loader.MTS_VERSION), Settings.WIDTH - 16 * Settings.scale, Settings.HEIGHT - 104 * Settings.scale, new Color(1, 1, 1, 0.3f) ); }
Example #30
Source File: ResumeVsJoinTest.java From gdx-ai with Apache License 2.0 | 5 votes |
@Override public void render (float delta) { update(delta); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); gameOver = sheeps.size == 0; if (gameOver) { if (!gameOverButton.isVisible()) { String winner = (resumePredator.score > joinPredator.score ? "Fish" : "Badlogics") + " wins!!!"; if (resumePredator.score == joinPredator.score) winner = "There's no winner!!!"; gameOverButton.setText("Game Over\n\n" + winner); gameOverButton.setVisible(true); } } else { Sheep target1 = resumePredator.target; Sheep target2 = joinPredator.target; if (target1 != null || target2 != null) { // Draw circles shapeRenderer.begin(ShapeType.Line); if (target1 != null) { shapeRenderer.setColor(Color.GREEN); shapeRenderer.circle(target1.getPosition().x, target1.getPosition().y, target1.getBoundingRadius() + 4); } if (target2 != null) { shapeRenderer.setColor(Color.RED); shapeRenderer.circle(target2.getPosition().x, target2.getPosition().y, target2.getBoundingRadius() + 6); } shapeRenderer.end(); } } stage.draw(); }