List of usage examples for com.badlogic.gdx.graphics Color Color
public Color(Color color)
From source file:com.tnf.ptm.handler.dra.RectSprite.java
License:Apache License
/** * consumes relPos, doesn't consume Color *//*from w w w .j ava2s. com*/ public RectSprite(TextureAtlas.AtlasRegion tex, float texSz, float origPercX, float origPercY, @Consumed Vector2 relPos, DraLevel level, float relAngle, float rotSpd, Color tint, boolean additive) { if (tex == null) { throw new AssertionError("tex is null"); } myTex = tex; myOrigPercX = origPercX; myOrigPercY = origPercY; this.relPos = relPos; myPos = new Vector2(); myLevel = level; this.relAngle = relAngle; myRotSpd = rotSpd; myEnabled = true; baseAlpha = tint.a; this.tint = new Color(tint); setTexSz(texSz); myAdditive = additive; }
From source file:com.tnf.ptm.screens.controlers.PtmInputManager.java
License:Apache License
public PtmInputManager(TextureManager textureManager, OggSoundManager soundManager) { inputPointers = new InputPointer[POINTER_COUNT]; for (int i = 0; i < POINTER_COUNT; i++) { inputPointers[i] = new InputPointer(); }// w ww .j a v a2s . com PtmInputProcessor sip = new PtmInputProcessor(this); Gdx.input.setInputProcessor(sip); flashInputPointer = new InputPointer(); mousePos = new Vector2(); mousePrevPos = new Vector2(); // Create an empty 1x1 pixmap to use as hidden cursor Pixmap pixmap = new Pixmap(1, 1, RGBA8888); hiddenCursor = Gdx.graphics.newCursor(pixmap, 0, 0); pixmap.dispose(); // We want the original mouse cursor to be hidden as we draw our own mouse cursor. Gdx.input.setCursorCatched(false); setMouseCursorHidden(); uiCursor = textureManager.getTexture("ui/cursor"); warnColor = new Color(PtmColor.UI_WARN); hoverSound = soundManager.getSound("engine:uiHover"); }
From source file:com.tnf.ptm.screens.game.WarnDrawer.java
License:Apache License
WarnDrawer(float resolutionRatio, String text) { myWarn = rect(resolutionRatio);// ww w .j av a 2 s .co m myText = text; myBgCol = new Color(PtmColor.UI_WARN); myBgOrigA = myBgCol.a; myTextCol = new Color(PtmColor.WHITE); }
From source file:com.trgk.touchwave.gamescene.HitCircleLines.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { ArrayList<HitCircle> circles = parent.circles; if (circles.size() > 1) { for (int i = 0; i < circles.size(); i++) { for (int j = i + 1; j < circles.size(); j++) { HitCircle p1 = circles.get(i); HitCircle p2 = circles.get(j); Color color = new Color(lineColor); if (p1.isTouched() && p2.isTouched()) { color.a = 0.8f * parentAlpha; } else { color.a = 0.4f * parentAlpha; }/*from w w w . j a v a2 s . c o m*/ TGPrimitive.drawDottedLine(batch, p1.getX() + p1.getWidth() / 2, p1.getY() + p1.getHeight() / 2, p2.getX() + p2.getWidth() / 2, p2.getY() + p2.getHeight() / 2, 1f, 0.2f, color); } } } }
From source file:com.trgk.touchwave.tgengine.ui.TGText.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { Matrix4 oldTransform = new Matrix4(batch.getTransformMatrix()); Affine2 localTransform = new Affine2(); localTransform.setToTrnScl(getX() + getOriginX(), getY() + getOriginY(), getScaleX(), getScaleY()); localTransform.translate(-getOriginX(), -getOriginY()); localTransform.scale(1f / TGResources.baseFontSize, 1f / TGResources.baseFontSize); Matrix4 localTransformMatrix = new Matrix4(); localTransformMatrix.set(localTransform); Matrix4 newTransform = new Matrix4(oldTransform); newTransform.mul(localTransformMatrix); batch.setTransformMatrix(newTransform); Color alphaMultipliedColor = new Color(getColor()); alphaMultipliedColor.a *= parentAlpha; drawCache.tint(alphaMultipliedColor); drawCache.draw(batch);/*from www . ja v a 2 s . c om*/ batch.setTransformMatrix(oldTransform); }
From source file:com.turbogerm.helljump.screens.ScreenBase.java
License:Open Source License
public ScreenBase(HellJump game) { mGame = game;/*from www .j a v a 2 s .co m*/ mInitData = mGame.getInitData(); mResources = mGame.getResources(); mAssetManager = mResources.getAssetManager(); mGuiSkin = mResources.getGuiSkin(); mGameData = mGame.getGameData(); mCameraData = mGame.getCameraData(); mGuiCameraRect = mCameraData.getGuiCameraRect(); mBatch = new SpriteBatch(); mGuiStage = new Stage(); mGuiStage.setCamera(mCameraData.getGuiCamera()); mClearColor = new Color(Color.BLACK); }
From source file:de.bioviz.ui.DrawableDroplet.java
License:Open Source License
/** * @param droplet//from w w w.j a v a 2 s. c o m * The 'data' droplet that is to be visualized. * @param parent * The circuit the droplet belongs to. */ public DrawableDroplet(final Droplet droplet, final DrawableAssay parent) { super(TextureE.Droplet, parent.getParent()); this.parentAssay = parent; this.droplet = droplet; super.addLOD(DEFAULT_LOD_THRESHOLD, TextureE.BlackPixel); super.setZ(DisplayValues.DEFAULT_DROPLET_DEPTH); /* Compute the droplet's color */ if (randnum == null) { randnum = new Random(); } randnum.setSeed(droplet.getID()); super.setColor(new Color(randnum.nextInt())); Color c = super.getColor(); c.a = 1f; super.setColor(c); this.dropletColor = c; /////////////////////////// route = new DrawableRoute(this); /* Set the initial coordinates for the droplet. Jannis chose the upper left corner of the droplet to be the reference. */ Point p = droplet.getFirstPosition().upperLeft(); smoothX = p.fst; smoothY = p.snd; originX = p.fst; originY = p.snd; }
From source file:de.bioviz.ui.DrawableField.java
License:Open Source License
/** * Colors based on the interference region. * * @param result//from ww w. j a va2 s .c om * The color that results from this method call. * @return The amount of color overlays produced by this method. */ private int inteferenceRegionColoring(final de.bioviz.ui.Color result) { int colorOverlayCount = 0; boolean isBlocked = getField().isBlocked(getParentAssay().getCurrentTime()); /** Colours the interference region **/ if (getOption(InterferenceRegion)) { int amountOfInterferenceRegions = 0; final Set<Droplet> dropsSet = getParentAssay().getData().getDroplets(); ArrayList<Droplet> drops = dropsSet.stream().filter(d -> isPartOfInterferenceRegion(d)) .collect(Collectors.toCollection(ArrayList<Droplet>::new)); for (int i = 0; i < drops.size(); ++i) { boolean interferenceViolation = false; for (int j = i + 1; j < drops.size(); j++) { final Droplet drop1 = drops.get(i); final Droplet drop2 = drops.get(j); boolean sameNet = getParentAssay().getData().sameNet(drop1, drop2); if (!sameNet && !isBlocked) { result.add(Colors.INTERFERENCE_REGION_OVERLAP_COLOR); ++colorOverlayCount; interferenceViolation = true; } } /* We only increase the amount of interference regions if no violation took place. This makes sense as a violation is handled differently. */ if (!interferenceViolation) { ++amountOfInterferenceRegions; } } if (amountOfInterferenceRegions > 0 && !isBlocked) { float scale = (float) Math.sqrt(amountOfInterferenceRegions); Color c = new Color(Colors.INTERFERENCE_REGION_COLOR); result.add(c.mul(scale)); ++colorOverlayCount; } } return colorOverlayCount; }
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;// w w w. j av a 2s .co 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.bitbrain.craft.ui.widgets.PlayerWidget.java
License:Open Source License
public PlayerWidget(Profession profession) { SharedInjector.get().injectMembers(this); progressProvider = new FloatValueProvider(); textProvider = new DefaultTextProvider(); this.profession = profession; eventBus.subscribe(this); this.progress = api.getProgress(profession); setProgress(progress);/*w w w . java2 s . co m*/ background1 = GraphicsFactory.createNinePatch(Assets.TEX_PANEL_TRANSPARENT_9patch, 5); background2 = GraphicsFactory.createNinePatch(Assets.TEX_PANEL_BAR_9patch, 5); caption = SharedAssetManager.get(Assets.FNT_SMALL, BitmapFont.class); setColor(new Color(Assets.CLR_YELLOW_SAND)); }