List of usage examples for com.badlogic.gdx.graphics Color Color
public Color(float r, float g, float b, float a)
From source file:com.andgate.pokeadot.GameScreen.java
License:Open Source License
private void buildGameOverContinueStage() { gameOverStage = new Stage(); //gameOverStage.getViewport().setCamera(camera); final Label.LabelStyle largeLabelStyle = new Label.LabelStyle(game.largeFont, new Color(0.7f, 0.0f, 0.0f, 0.7f)); final Label.LabelStyle smallLabelStyle = new Label.LabelStyle(game.smallFont, new Color(1.0f, 1.0f, 1.0f, 0.7f)); final Label gameOverLabel = new Label("Game Over", largeLabelStyle); final Label continueLabel = new Label("tap to continue", smallLabelStyle); Table table = new Table(game.skin); table.add(gameOverLabel).center().row(); table.add(continueLabel).center().top().row(); table.setFillParent(true);/*ww w. j av a2s.co m*/ gameOverStage.addActor(table); }
From source file:com.andgate.pokeadot.util.HSL.java
License:Open Source License
/** * Converts an HSL color value to RGB. Conversion formula * adapted from http://en.wikipedia.org/wiki/HSL_color_space. * Assumes h, s, and l are contained in the set [0, 1] and * returns r, g, and b in the set [0, 1]. * * @return The RGB representation//from ww w . ja va 2s. co m */ public Color toRGB() { float r, g, b; if (s == 0) { r = l; g = l; b = l; } else { float q = (l < 0.5f) ? (l * (1.0f + s)) : (l + s - l * s); float p = 2.0f * l - q; r = hue2rgb(p, q, h + 1.0f / 3.0f); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1.0f / 3.0f); } return new Color(r, g, b, 1.0f); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Sets this color to the given color. * /*ww w . j a va2s . c o m*/ * @param color the Color */ public Color set(Color color) { this.r = color.r; this.g = color.g; this.b = color.b; this.a = color.a; clamp(); return new Color(this.r, this.g, this.b, this.a); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Multiplies the this color and the given color * //from w w w . j a va 2s. com * @param color the color * @return this color. */ public Color mul(Color color) { this.r *= color.r; this.g *= color.g; this.b *= color.b; this.a *= color.a; clamp(); return new Color(this.r, this.g, this.b, this.a); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Multiplies all components of this Color with the given value. * /*from www . ja va2 s. c o m*/ * @param value the value * @return this color */ public Color mul(float value) { this.r *= value; this.g *= value; this.b *= value; this.a *= value; clamp(); return new Color(this.r, this.g, this.b, this.a); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Adds the given color to this color. * //from ww w . j a v a 2s . c o m * @param color the color * @return this color */ public Color add(Color color) { this.r += color.r; this.g += color.g; this.b += color.b; this.a += color.a; clamp(); return new Color(this.r, this.g, this.b, this.a); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Subtracts the given color from this color * //from ww w . j a v a 2 s . co m * @param color the color * @return this color */ public Color sub(Color color) { this.r -= color.r; this.g -= color.g; this.b -= color.b; this.a -= color.a; clamp(); return new Color(this.r, this.g, this.b, this.a); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Returns a new color from a hex string with the format RRGGBBAA. * @see #toString() *///from w ww .java 2 s .c o m public static Color valueOf(String hex) { int r = Integer.valueOf(hex.substring(0, 2), 16); int g = Integer.valueOf(hex.substring(2, 4), 16); int b = Integer.valueOf(hex.substring(4, 6), 16); int a = hex.length() != 8 ? 255 : Integer.valueOf(hex.substring(6, 8), 16); return new Color(r / 255f, g / 255f, b / 255f, a / 255f); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** Returns a temporary copy of this color. This is not thread safe, do not save a reference to this instance. * //from www . ja v a 2s.c om * @return a temporary copy of this color */ public Color tmp() { return tmp.set(new Color(this.r, this.g, this.b, this.a)); }
From source file:com.anythingmachine.gdxwrapper.ColorWrap.java
License:Apache License
/** @return a copy of this color */ public Color cpy() { return new Color(this.r, this.g, this.b, this.a); }