List of usage examples for com.badlogic.gdx.graphics Color BLACK
Color BLACK
To view the source code for com.badlogic.gdx.graphics Color BLACK.
Click Source Link
From source file:com.ray3k.skincomposer.utils.Utils.java
License:Open Source License
/** * Does not dispose pixmap.//from w ww .j ava2 s . com * @param pixmap * @return */ public static Color averageColor(Pixmap pixmap) { Color temp = new Color(); float sumR = 0.0f; float sumG = 0.0f; float sumB = 0.0f; int count = 0; for (int y = 0; y < pixmap.getHeight(); y++) { for (int x = 0; x < pixmap.getWidth(); x++) { temp.set(pixmap.getPixel(x, y)); if (temp.a > 0) { sumR += temp.r; sumG += temp.g; sumB += temp.b; count++; } } } if (count == 0) { return new Color(Color.BLACK); } else { return new Color(sumR / count, sumG / count, sumB / count, 1.0f); } }
From source file:com.ray3k.skincomposer.utils.Utils.java
License:Open Source License
/** * Does not dispose pixmap./*from w w w .ja v a 2 s .c om*/ * @param pixmap * @param ninePatch * @return */ public static Color averageEdgeColor(Pixmap pixmap, boolean ninePatch) { int border = 0; if (ninePatch) { border = 1; } Color temp = new Color(); float sumR = 0.0f; float sumG = 0.0f; float sumB = 0.0f; int count = 0; //left edge for (int y = border; y < pixmap.getHeight() - border; y++) { for (int x = border; x < pixmap.getWidth() - border; x++) { temp.set(pixmap.getPixel(x, y)); if (temp.a > 0) { sumR += temp.r; sumG += temp.g; sumB += temp.b; count++; break; } } } //right edge for (int y = border; y < pixmap.getHeight() - border; y++) { for (int x = pixmap.getWidth() - 1 - border; x > border; x--) { temp.set(pixmap.getPixel(x, y)); if (temp.a > 0) { sumR += temp.r; sumG += temp.g; sumB += temp.b; count++; break; } } } //top edge for (int x = border; x < pixmap.getWidth() - border; x++) { for (int y = border; y < pixmap.getHeight() - border; y++) { temp.set(pixmap.getPixel(x, y)); if (temp.a > 0) { sumR += temp.r; sumG += temp.g; sumB += temp.b; count++; break; } } } //bottom edge for (int x = border; x < pixmap.getWidth() - border; x++) { for (int y = pixmap.getHeight() - 1 - border; y > border; y--) { temp.set(pixmap.getPixel(x, y)); if (temp.a > 0) { sumR += temp.r; sumG += temp.g; sumB += temp.b; count++; break; } } } if (count == 0) { return new Color(Color.BLACK); } else { return new Color(sumR / count, sumG / count, sumB / count, 1.0f); } }
From source file:com.sasluca.lcl.graphics.fonts.LCLDistanceFieldFont.java
License:Apache License
public LCLDistanceFieldFont(String fontName, float spread) { super(fontName); m_Spread = spread;/*from w w w .j a va 2 s .c o m*/ LCL.getResourceManager().addTextureLL(fontName, "fonts/distancefieldfonts/" + fontName + "/" + fontName + ".png"); p_Font = new BitmapFont( Gdx.files.internal("fonts/distancefieldfonts/" + fontName + "/" + fontName + ".fnt"), new TextureRegion(LCL.getResourceManager().<Texture>getResource(fontName)), false); p_Font.setColor(Color.BLACK); p_Cache = new BitmapFontCache(p_Font); }
From source file:com.sasluca.lcl.graphics.fonts.LCLDistanceFieldFont.java
License:Apache License
public LCLDistanceFieldFont(String fontName, float spread, String pngPath, String fntPath) { super(fontName); m_Spread = spread;//from w w w .j av a 2 s . c om LCL.getResourceManager().addTextureLL(fontName, pngPath); p_Font = new BitmapFont(Gdx.files.internal(fntPath), new TextureRegion(LCL.getResourceManager().<Texture>getResource(fontName)), false); p_Font.setColor(Color.BLACK); p_Cache = new BitmapFontCache(p_Font); }
From source file:com.sasluca.lcl.ui.overlayview.UIOverlayView.java
License:Apache License
public UIOverlayView() { m_DarkOverlay = new UISprite(LCL.getResourceManager().<Texture>getResource("default")); m_DarkOverlay.setSize(LCL.getCamera().viewportWidth, LCL.getCamera().viewportHeight).setColor(Color.BLACK) .setAlpha(0);/* ww w .j av a 2 s. c o m*/ }
From source file:com.sasluca.lcl.ui.text.UITextArea.java
License:Apache License
public UITextArea(String font, float width, float height, String text, boolean fitText) { image = new UISprite("default"); image.setSize(width, height).setColor(Color.BLUE); m_Font = LCLFontManager.getFont(font); m_Mask = new LCLMask(0, 0, width, height); m_Text = new LCLString(text); m_ScaleW = m_ScaleH = 1f;/* w w w .j av a 2 s . c om*/ m_Color = new Color(Color.BLACK); m_Masking = true; m_FitText = fitText; m_Smoothing = 4; if (m_FitText) fitText(); }
From source file:com.sebasxogo2d.renderer.RendererXogo.java
License:Open Source License
public RendererXogo(Mundo mundo) { inicioBola();//Direccion aleatorio no eixo das X. inicioBola2();// w w w. ja v a2s. co m batch = new SpriteBatch(); camara2d = new OrthographicCamera(); bitMapFont = new BitmapFont(); bitMapFont.setColor(Color.BLACK); bitMapFont.setScale(1f, 1f); vidas = 5; gameOver = false; son = true; velocidadeBola = 350f; paleta = new Rectangle(); rectBola = new Rectangle(); rectBola2 = new Rectangle(); //Espacions de colision, fin da pantalla de xogo. norte = new Rectangle(0, Mundo.MUNDO_ALTO - ANCHO_COLISION, Mundo.MUNDO_ANCHO, ANCHO_COLISION);//De 0x, y= alto -5 a largoPantalla oeste = new Rectangle(0, 0, ANCHO_COLISION, Mundo.MUNDO_ALTO); este = new Rectangle(Mundo.MUNDO_ANCHO - ANCHO_COLISION, 0, ANCHO_COLISION, Mundo.MUNDO_ALTO); plin = Gdx.audio.newSound(Gdx.files.internal("MENU B_Back.wav")); //Puntuacion a 0 o iniciar o xogo. puntuacionTotal = 0; //Nivel seleccionado. level = PantallaXogo.levelInteger; asignarVelocidade(level); //Empezar a funcionar a app cando fagan click na pantalla. running = false; //Levels isBola2Enabled = false; subirLevels = false; idLevel = 2; easy = 34; // Initial points by dificulty normal = 52; kappa = 79; //Izquierdo y Derecho izquierdo = new Rectangle(0, 50, 100, 100); derecho = new Rectangle(260, 50, 100, 100); move = true; }
From source file:com.sidereal.dolphinoes.behaviors.pathfinding.PathfindingHandler.java
License:Apache License
@Override protected void initialiseClass() { if (maps == null) { maps = new HashMap<String, PathfindingMap>(); }/*from w ww . j a v a 2s .co m*/ if (!DolphinOES.debug.isEnabled()) return; if (font == null) { font = DolphinOES.assets.get(DolphinOES.assets.frameworkAssetsFolder + "Blocks.fnt", BitmapFont.class); font.setColor(Color.BLACK); font.setScale(2); } DolphinOES.assets.load(DolphinOES.assets.frameworkAssetsFolder + "White.png", Texture.class); if (debugOpen == null) { debugOpen = new Sprite( DolphinOES.assets.get(DolphinOES.assets.frameworkAssetsFolder + "White.png", Texture.class)); debugOpen.setColor(new Color(0, 1, 0, 0.5f)); } if (debugClosed == null) { debugClosed = new Sprite( DolphinOES.assets.get(DolphinOES.assets.frameworkAssetsFolder + "White.png", Texture.class)); debugClosed.setColor(new Color(1, 0, 0, 0.5f)); } }
From source file:com.smeanox.games.sg002.screen.GameScreen.java
License:Open Source License
/** * Create all GUI elements//from w w w . j a va 2 s.c o m */ private void createUI() { LinkedList<Button> toLayout = new LinkedList<Button>(); // GUI Button b; // + b = new Button(new Sprite(Assets.button), Assets.liberationMedium, "+", Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { zoomIn(); } }); addGUIElement(b); toLayout.add(b); // - b = new Button(new Sprite(Assets.button), Assets.liberationMedium, "-", Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { zoomOut(); } }); addGUIElement(b); toLayout.add(b); layout(toLayout, 2, 1, -1, -1, -0.48f, -0.48f, 40, 40, 10, 0); toLayout.clear(); // money label b = new Button(null, Assets.liberationMedium, Language.getStrings().format("gameScreen.currency", 0), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); addGUIElement(b); toLayout.add(b); moneyLabel = b; // name label b = new Button(null, Assets.liberationMedium, "name", Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); addGUIElement(b); toLayout.add(b); nameLabel = b; layout(toLayout, 1, 2, 1, -1, 0.48f, -0.48f, 150, 40, 0, 10); toLayout.clear(); // produce b = new Button(new Sprite(Assets.button), Assets.liberationSmall, Language.getStrings().get("gameScreen.produce"), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { startProduce(); } }); addGUIElement(b); toLayout.add(b); produceButton = b; // cancel b = new Button(new Sprite(Assets.button), Assets.liberationSmall, Language.getStrings().get("gameScreen.cancel"), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { cancelAction(); } }); addGUIElement(b); toLayout.add(b); cancelButton = b; // move b = new Button(new Sprite(Assets.button), Assets.liberationSmall, Language.getStrings().get("gameScreen.move"), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { startMove(); } }); addGUIElement(b); toLayout.add(b); moveButton = b; // fight b = new Button(new Sprite(Assets.button), Assets.liberationSmall, Language.getStrings().get("gameScreen.fight"), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { startFight(); } }); addGUIElement(b); toLayout.add(b); fightButton = b; layout(toLayout, 2, 2, -1, 1, -0.48f, 0.48f, 150, 40, 10, 5); toLayout.clear(); // nextPlayer b = new Button(new Sprite(Assets.button), Assets.liberationSmall, Language.getStrings().get("gameScreen.nextPlayer"), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { proposeEndPlaying(); } }); addGUIElement(b); toLayout.add(b); nextPlayerButton = b; layout(toLayout, 1, 1, 1, 1, 0.48f, 0.48f, 200, 40, 0, 0); // produce buttons produceButtons = new LinkedList<Button>(); gameObjectTypeToProduceButton = new HashMap<GameObjectType, Button>(); int cols, rows; cols = (int) Math.round(Math.sqrt(GameObjectType.getAllGameObjectTypes().size() / 2.0)); rows = (int) Math.ceil((double) GameObjectType.getAllGameObjectTypes().size() / cols); for (final GameObjectType gameObjectType : GameObjectType.getAllGameObjectTypesSorted()) { b = new Button(new Sprite(Assets.button), Assets.liberationSmall, gameObjectType.getName() + " (" + Language.getStrings().format("gameScreen.currency", gameObjectType.getValue()) + ")", Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { selectProduceGameObjectType(gameObjectType); } }); addGUIElement(b); produceButtons.add(b); gameObjectTypeToProduceButton.put(gameObjectType, b); } layout(produceButtons, cols, rows, 0, 0, 0, 0, 250, 40, 5, 5); }
From source file:com.smeanox.games.sg002.screen.MenuScreen.java
License:Open Source License
/** * Create all GUI elements/* w w w. j a va 2 s.co m*/ */ private void createUI() { LinkedList<Button> toLayout = new LinkedList<Button>(); Button b; // playerCountLabel b = new Button(new Sprite(Assets.button), Assets.liberationMedium, "playerCount", Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { increasePlayerCount(); } }); addGUIElement(b); playerCountLabel = b; toLayout.add(b); // scenarioInfLabel b = new Button(null, Assets.liberationSmall, "scenarioInfo", Color.WHITE, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); addGUIElement(b); scenarioInfoLabel = b; toLayout.add(b); // scenarioLabel b = new Button(new Sprite(Assets.button), Assets.liberationMedium, "scenarioName", Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { nextScenario(); } }); addGUIElement(b); scenarioLabel = b; toLayout.add(b); // start game b = new Button(new Sprite(Assets.button), Assets.liberationMedium, Language.getStrings().get("menu.startGame"), Color.BLACK, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); b.addClickHandler(new ClickHandler() { @Override public void onClick() { prepareStart(); } }); addGUIElement(b); toLayout.add(b); // game name b = new Button(null, Assets.liberationLarge, Language.getStrings().get("game.name"), Color.ORANGE, Color.WHITE, Color.LIGHT_GRAY, Color.DARK_GRAY); addGUIElement(b); toLayout.add(b); layout(toLayout, 1, 5, 0, 0, 0, 0, 300, 60, 0, 30); toLayout.clear(); }