List of usage examples for com.badlogic.gdx.graphics Color WHITE
Color WHITE
To view the source code for com.badlogic.gdx.graphics Color WHITE.
Click Source Link
From source file:de.bioviz.messages.MessageBase.java
License:Open Source License
/** * Creates a message that will be printed in white. * * @param message The message that will be displayed later on *//*from w w w . j a v a 2s. co m*/ MessageBase(final String message) { this.message = message; this.color = Color.WHITE.cpy(); }
From source file:de.bioviz.messages.MessageCenter.java
License:Open Source License
/** * Retrives the font that is used to display stuff on top of * droplets/fields./* ww w. j a v a 2 s.c o m*/ * * @return The font that is used to display stuff on top of droplets/fields */ private BitmapFont getFont() { if (fontInvalidated) { fontInvalidated = false; FreeTypeFontGenerator generator = new FreeTypeFontGenerator( Gdx.files.internal("images/FreeUniversal-Regular.ttf")); FreeTypeFontParameter parameter = new FreeTypeFontParameter(); parameter.size = (int) textRenderResolution; parameter.color = Color.WHITE.cpy(); parameter.borderWidth = 2; parameter.borderColor = Color.BLACK.cpy(); parameter.genMipMaps = true; BitmapFont font12 = generator.generateFont(parameter); // font size 12 pixels generator.dispose(); // don't forget to dispose to avoid memory // leaks! generator = new FreeTypeFontGenerator(Gdx.files.internal("images/Anonymous_Pro.ttf")); parameter = new FreeTypeFontParameter(); parameter.size = (int) msgTextRenderResolution; parameter.color = Color.BLACK.cpy(); this.messageFont = generator.generateFont(parameter); generator.dispose(); logger.debug("set up font"); font = font12; //new BitmapFont(); } return font; }
From source file:de.bioviz.messages.MessageCenter.java
License:Open Source License
/** * Renders the message.//from w ww. ja v a 2s . c o m */ public void render() { if (hidden) { return; } if (font == null || fontInvalidated) { getFont(); } Matrix4 normalProjection = new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); int spacing = 2 + (int) getmsgTextRenderResolution(); int yCoord = Gdx.graphics.getHeight() - spacing; for (final Message m : this.messages) { if (m.color != null) { messageFont.setColor(m.color); } else { messageFont.setColor(Color.WHITE); } int startX = spacing; int startY = yCoord; parent.batch.drawMessage(messageFont, m.message, startX, startY, normalProjection, DEFAULT_Z); yCoord -= spacing; } final float fullyTransparent = 0f; for (final HUDMessage s : this.hudMessages.values()) { Color targetColor = s.color.cpy(); float hideAt = textRenderResolution; float showAt = textRenderResolution * 2; if (parent.currentAssay.getDisplayOptions().getOption(BDisplayOptions.HideTextOnZoom)) { // Hide when zoomed out float xScale = this.parent.currentAssay.getScaleX(); if (xScale < hideAt) { targetColor.a = fullyTransparent; } else if (xScale < showAt) { float val = xScale; val = (val - hideAt) / (showAt - hideAt); targetColor.a = val * getDefaultTextTransparency(); } else { targetColor.a = getDefaultTextTransparency(); } } else { targetColor.a = getDefaultTextTransparency(); } font.setColor(targetColor); if (targetColor.a > fullyTransparent) { final GlyphLayout layout = new GlyphLayout(font, s.message); final float fontX = s.x - layout.width / 2f + Gdx.graphics.getWidth() / 2f; final float fontY = s.y + layout.height / 2f + Gdx.graphics.getHeight() / 2f; parent.batch.drawMessage(font, layout, fontX, fontY, normalProjection, DEFAULT_Z); } } while (!this.messages.isEmpty() && this.messages.get(0).expired()) { this.messages.remove(0); } }
From source file:de.bioviz.ui.DrawableAssay.java
License:Open Source License
/** * Draws the coordinates of the grid on top of and to the left of the grid. * This in fact uses the message center to display the numbers, so the * actual drawing will be done after the rest has been drawn. *//* ww w. ja va 2s .c om*/ private void displayCoordinates() { Quadruple<Integer, Integer, Integer, Integer> minMaxVals = minMaxXY(); int minX = minMaxVals.fst; int minY = minMaxVals.snd; int maxX = minMaxVals.thd; int maxY = minMaxVals.fth; final int offset = 32; float topYCoord = Gdx.graphics.getHeight() / 2f - offset; if (topYCoord > this.yCoordOnScreen(maxY + 1)) { topYCoord = this.yCoordOnScreen(maxY + 1); } float leftXCoord = -Gdx.graphics.getWidth() / 2f + offset; if (leftXCoord < this.xCoordOnScreen(minX - 1)) { leftXCoord = this.xCoordOnScreen(minX - 1); } // Defines when numbers should start fading and be completely hidden final float startFadingAtScale = 32f; final float endFadingAtScale = 24f; Color col = Color.WHITE.cpy(); if (this.getSmoothScale() < startFadingAtScale) { if (this.getSmoothScale() > endFadingAtScale) { float alpha = 1f - ((startFadingAtScale - getSmoothScale()) / (startFadingAtScale - endFadingAtScale)); col.a = alpha; } else { col.a = 0; } } // indeed draw, top first, then left for (int i = minX; i < maxX + 1; i++) { this.getParent().messageCenter.addHUDMessage(this.hashCode() + i, // unique ID for each message Integer.toString(i).trim(), // message this.xCoordOnScreen(i), // x topYCoord, // y col // message color, used for fading ); } for (int i = minY; i < maxY + 1; i++) { this.getParent().messageCenter.addHUDMessage(this.hashCode() + maxX + Math.abs(minY) + 1 + i, // unique ID for each message, starting after the previous // ids Integer.toString(i).trim(), // message leftXCoord, // x this.yCoordOnScreen(i), // y col // message color, used for fading ); } }
From source file:de.bitbrain.craft.Styles.java
License:Open Source License
public static void load() { BTN_GREEN.font = SharedAssetManager.get(Assets.FNT_LARGER, BitmapFont.class); BTN_GREEN.down = new SpriteDrawable( new Sprite(SharedAssetManager.get(Assets.TEX_BUTTON_GREEN, Texture.class))); BTN_GREEN.up = new SpriteDrawable( new Sprite(SharedAssetManager.get(Assets.TEX_BUTTON_GREEN_DARK, Texture.class))); BTN_GREEN.fontColor = Assets.CLR_GREEN_GRASS; BTN_GREEN.downFontColor = Assets.CLR_GREEN_GRASS_LIGHT; BTN_RED.font = SharedAssetManager.get(Assets.FNT_LARGER, BitmapFont.class); BTN_RED.down = new SpriteDrawable(new Sprite(SharedAssetManager.get(Assets.TEX_BUTTON_RED, Texture.class))); BTN_RED.up = new SpriteDrawable( new Sprite(SharedAssetManager.get(Assets.TEX_BUTTON_RED_DARK, Texture.class))); BTN_RED.fontColor = Assets.CLR_RED;//ww w .j a v a2 s . c o m BTN_RED.downFontColor = Assets.CLR_RED_LIGHT; BTN_PROFESSION.font = SharedAssetManager.get(Assets.FNT_LARGER, BitmapFont.class); BTN_PROFESSION.down = new NinePatchDrawable( GraphicsFactory.createNinePatch(Assets.TEX_PANEL_HIGHLIGHT_9patch, Sizes.panelRadius())); BTN_PROFESSION.over = new NinePatchDrawable( GraphicsFactory.createNinePatch(Assets.TEX_PANEL_HIGHLIGHT_9patch, Sizes.panelRadius())); BTN_PROFESSION.up = new NinePatchDrawable( GraphicsFactory.createNinePatch(Assets.TEX_PANEL_9patch, Sizes.panelRadius())); BTN_PROFESSION.fontColor = Assets.CLR_INACTIVE; BTN_PROFESSION.downFontColor = Assets.CLR_YELLOW_SAND; BTN_PROFESSION.overFontColor = Assets.CLR_YELLOW_SAND; BTN_PROFESSION_INACTIVE.font = SharedAssetManager.get(Assets.FNT_LARGER, BitmapFont.class); BTN_PROFESSION_INACTIVE.up = new NinePatchDrawable( GraphicsFactory.createNinePatch(Assets.TEX_PANEL_9patch, Sizes.panelRadius())); BTN_PROFESSION_INACTIVE.fontColor = new Color(Assets.CLR_INACTIVE); BTN_PROFESSION_INACTIVE.fontColor.a = 0.3f; LBL_BROWN.fontColor = Assets.CLR_BROWN_TEAK; LBL_BROWN.font = SharedAssetManager.get(Assets.FNT_SMALL, BitmapFont.class); LBL_ITEM.fontColor = new Color(Color.WHITE); LBL_ITEM.font = SharedAssetManager.get(Assets.FNT_LARGER, BitmapFont.class); LBL_TEXT.fontColor = new Color(Color.WHITE); LBL_TEXT.font = SharedAssetManager.get(Assets.FNT_MEDIUM, BitmapFont.class); LBL_CAPTION.fontColor = Assets.CLR_YELLOW_SAND; LBL_CAPTION.font = SharedAssetManager.get(Assets.FNT_LARGER, BitmapFont.class); LBL_TOOLTIP.fontColor = new Color(Color.WHITE); LBL_TOOLTIP.font = SharedAssetManager.get(Assets.FNT_SMALLEST, BitmapFont.class); BTN_TAB.up = new NinePatchDrawable( GraphicsFactory.createNinePatch(Assets.TEX_PANEL_TAB_9patch, Sizes.panelRadius())); BTN_TAB_ACTIVE.up = new NinePatchDrawable( GraphicsFactory.createNinePatch(Assets.TEX_PANEL_TAB_ACTIVE_9patch, Sizes.panelRadius())); TXT_COMMANDLINE.font = SharedAssetManager.get(Assets.FNT_MONO, BitmapFont.class); TXT_COMMANDLINE.fontColor = Color.GRAY; TXT_COMMANDLINE.messageFont = SharedAssetManager.get(Assets.FNT_MONO, BitmapFont.class); TXT_COMMANDLINE.messageFontColor = Color.WHITE; TXT_COMMANDLINE.cursor = new SpriteDrawable( new Sprite(SharedAssetManager.get(Assets.TEX_CURSOR, Texture.class))); TXT_COMMANDLINE.focusedFontColor = Color.WHITE; }
From source file:de.cubicvoxel.openspacebox.ingame.ui.hud.Menu.java
License:Open Source License
private void closeMenu() { openCloseMenuButton.setText(FA.BARS.asString()); openCloseMenuButton.setColor(Color.WHITE); final float openCloseButtonYOnMenuItemsGroup = openCloseButtonYOnMenuItemsGroup(); for (final Actor menuItem : menuItemsGroup.getChildren()) { final float menuItemOriginalY = menuItem.getY(); Anim.on(menuItem).easing(Easing.CUBIC_OUT).duration(.25f) .animatePosition(menuItem.getX(), openCloseButtonYOnMenuItemsGroup()).using(updateMultiplexer) .finishedListener(() -> { menuItem.setY(menuItemOriginalY); removeActor(menuItemsGroup); }).start();/* www . ja v a2s. c om*/ } }
From source file:de.gebatzens.meteva.Button.java
License:Open Source License
public void render() { GScout.batch.setColor(color);//from w w w . j a v a 2 s . co m GScout.batch.draw(tex, (float) x, (float) y, width, height); //int fs = Meteva.fontSurvivant.getFontsize(text, (int) (width * 0.8f), 5, 80, 7); GScout.setFontSize(height / 2); TextBounds bounds = GScout.survivant.getBounds(text); Color c = Color.WHITE; GScout.survivant.setColor(c); GScout.drawText(text, (float) (x + width / 2 - bounds.width / 2), (float) (y + height / 2 + bounds.height / 2 + height / 9), true); GScout.survivant.setColor(Color.WHITE); }
From source file:de.gebatzens.meteva.DeleteButton.java
License:Open Source License
public void render() { GScout.batch.setColor(Color.WHITE); GScout.batch.draw(tex1, (float) x, (float) y, width, height); }
From source file:de.gebatzens.meteva.GamemodeButton.java
License:Open Source License
@Override public void render() { super.render(); GScout.batch.setColor(Color.WHITE); if (activated) GScout.batch.draw(GScout.whiteTexture, (float) (x + width * 0.25f), (float) (y + height * 0.24f), width / 2, height * 0.05f); }
From source file:de.gebatzens.meteva.GameObject.java
License:Open Source License
public GameObject(TextureRegion tex, double x, double y) { texture = tex;/*from ww w . j a va2 s .c o m*/ this.x = x; this.y = y; color = Color.WHITE.cpy(); state = (LevelState) GScout.state; lwidth = width = texture.getRegionWidth(); lheight = height = texture.getRegionHeight(); poly = GScout.createPolygon(width * 0.8f, height * 0.8f); poly.setPosition((float) (x + width / 2), (float) (y + height / 2)); }