List of usage examples for com.badlogic.gdx.graphics Color toFloatBits
public float toFloatBits()
From source file:com.ridiculousRPG.DebugHelper.java
License:Apache License
public static void debugPolygons(List<PolygonObject> polyList) { for (PolygonObject poly : polyList) { for (int i = poly.vertexX.length - 1; i >= 0; i--) { float x = poly.vertexX[i]; Color c = poly.getColor(); if (c == null) c = poly.blockingBehavior.color; if (poly.loop && i == 0) x -= 20;//w w w .ja va 2s .c om getTextMapDebugger().addMessage("#" + i, c.toFloatBits(), x, poly.vertexY[i], 0f, true); } } }
From source file:com.ridiculousRPG.event.EventObject.java
License:Apache License
public void setColor(Color color) { this.color.set(color); colorFloatBits = color.toFloatBits(); }
From source file:com.ridiculousRPG.GameBase.java
License:Apache License
/** * The default tint is {@link Color#WHITE}. That means, that everything is * drawn as it is.<br>//from w w w . j a v a 2 s . c o m * Reset to {@link Color#WHITE} if you want to remove the coloring.<br> * If you use the alpha channel on the entire game, all layers of a map will * become visible. That's probably not what you want.<br> * If you want to fade the entire game out, make a transition to * {@link Color#BLACK}.<br> * Tip: Use an {@link EventObject} in combination with the * {@link MoveFadeColorAdapter} to create color animations (e.g. day and * night effects). * * @see {@link MoveFadeColorAdapter#$(Speed, Color, boolean)} */ public void setGameColorTint(Color tint) { gameColorTint = ColorSerializable.wrap(tint); gameColorBits = tint.toFloatBits(); }
From source file:com.ridiculousRPG.ui.DisplayFPSService.java
License:Apache License
/** * Displays the rendering speed in frames per second. * //ww w . j a v a 2 s .co m * @param font * The font will automatically be disposed when disposing this * service. * @param alignRight * If true the text will be aligned right. * @param valignBottom * If true the text will be displayed at the bottom of the * screen. */ public DisplayFPSService(Color color, Alignment horiAlign, Alignment vertAlign) { this.colorBits = color.toFloatBits(); this.horiAlign = horiAlign; this.vertAlign = vertAlign; }
From source file:de.homelab.madgaksha.lotsofbs.bettersprite.CroppableSprite.java
License:Apache License
/** * Sets the color used to tint this sprite. Default is {@link Color#WHITE}. *///from www. j ava 2s. c o m public void setColor(Color tint) { float color = tint.toFloatBits(); float[] vertices = this.vertices; vertices[C1] = color; vertices[C2] = color; vertices[C3] = color; vertices[C4] = color; }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.ImmediateRenderer.java
License:Apache License
public void color(Color color) { vertices[vertexIdx + colorOffset] = color.toFloatBits(); }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public short vertex(Vector3 pos, Vector3 nor, Color col, Vector2 uv) { if (vindex >= Short.MAX_VALUE) throw new GdxRuntimeException("Too many vertices used"); if (col == null && colorSet) col = color;/*from ww w . jav a 2 s . co m*/ if (pos != null) { if (vertexTransformationEnabled) { tempVTransformed.set(pos).mul(positionTransform); vertex[posOffset] = tempVTransformed.x; if (posSize > 1) vertex[posOffset + 1] = tempVTransformed.y; if (posSize > 2) vertex[posOffset + 2] = tempVTransformed.z; } else { vertex[posOffset] = pos.x; if (posSize > 1) vertex[posOffset + 1] = pos.y; if (posSize > 2) vertex[posOffset + 2] = pos.z; } } if (nor != null && norOffset >= 0) { if (vertexTransformationEnabled) { tempVTransformed.set(nor).mul(normalTransform).nor(); vertex[norOffset] = tempVTransformed.x; vertex[norOffset + 1] = tempVTransformed.y; vertex[norOffset + 2] = tempVTransformed.z; } else { vertex[norOffset] = nor.x; vertex[norOffset + 1] = nor.y; vertex[norOffset + 2] = nor.z; } } if (col != null) { if (colOffset >= 0) { vertex[colOffset] = col.r; vertex[colOffset + 1] = col.g; vertex[colOffset + 2] = col.b; if (colSize > 3) vertex[colOffset + 3] = col.a; } else if (cpOffset > 0) vertex[cpOffset] = col.toFloatBits(); // FIXME cache packed color? } if (uv != null && uvOffset >= 0) { vertex[uvOffset] = uv.x; vertex[uvOffset + 1] = uv.y; } addVertex(vertex, 0); return lastIndex; }
From source file:net.mwplay.cocostudio.ui.particleutil.CCParticleActor.java
License:Apache License
private void updateParticleQuads(Particle _particleData, int idx) { if (_particleCount <= 0) { return;/*from www .j a v a 2 s. c om*/ } pos.setZero(); if (_positionType == PositionTypeFree) { //Vector3 p1 = new Vector3(); p1.setZero(); p1.set(currentPosition.x, currentPosition.y, 0); transformPoint(p1); p2.setZero(); newPos.setZero(); p2.set(_particleData.startPos.x, _particleData.startPos.y, 0); // matrix4.trn(p2); // matrix4.getTranslation(p2); transformPoint(p2); newPos.set(_particleData.pos.x, _particleData.pos.y); p2.x = p1.x - p2.x; p2.y = p1.y - p2.y; newPos.x -= p2.x - pos.x; newPos.y -= p2.y - pos.y; updatePosWithParticle(_particleData, newPos, _particleData.size, _particleData.rotation, idx); } else if (_positionType == PositionTypeRelative) { newPos.setZero(); newPos.set(_particleData.pos.x, _particleData.pos.y); newPos.x = _particleData.pos.x - (currentPosition.x - _particleData.startPos.x); newPos.y = _particleData.pos.y - (currentPosition.y - _particleData.startPos.y); newPos.add(pos); updatePosWithParticle(_particleData, newPos, _particleData.size, _particleData.rotation, idx); } else { newPos.setZero(); newPos.set(_particleData.pos.x + pos.x, _particleData.pos.y + pos.y); updatePosWithParticle(_particleData, newPos, _particleData.size, _particleData.rotation, idx); } Color color = new Color(); if (m_bOpacityModifyRGB) { //for(int i=0;i<_particleCount;++i){ // Particle _particleData = m_pParticles[i]; color.set(_particleData.color.r * _particleData.color.a, _particleData.color.g * _particleData.color.a, _particleData.color.b * _particleData.color.a, _particleData.color.a); float[] toUpdate = vertices[idx]; float colorFloat = color.toFloatBits(); toUpdate[C1] = colorFloat; toUpdate[C2] = colorFloat; toUpdate[C3] = colorFloat; toUpdate[C4] = colorFloat; //} } else { //for(int i=0;i<_particleCount;++i){ // Particle _particleData = m_pParticles[i]; float[] toUpdate = vertices[idx]; float colorFloat = _particleData.color.toFloatBits(); toUpdate[C1] = colorFloat; toUpdate[C2] = colorFloat; toUpdate[C3] = colorFloat; toUpdate[C4] = colorFloat; //} } }
From source file:okj.easy.graphics.graphics2d.SpriteA.java
License:Apache License
public void setColor(Color tint) { float color = tint.toFloatBits(); final float[] vertices = this.vertices; vertices[C1] = color;//from www . j ava2 s . co m vertices[C2] = color; vertices[C3] = color; vertices[C4] = color; }