Java Code Examples for com.badlogic.gdx.graphics.Color#GRAY

The following examples show how to use com.badlogic.gdx.graphics.Color#GRAY . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void unfocus(MusicSelector selector) {
	search.setText("");
	search.setMessageText("search song");
	search.getStyle().messageFontColor = Color.GRAY;
	search.getOnscreenKeyboard().show(false);
	setKeyboardFocus(null);
	selector.main.getInputProcessor().getKeyBoardInputProcesseor().setEnable(true);
}
 
Example 2
@Override
public void render(float delta) {

	if (!EngineAssetManager.getInstance().isLoading()) {
		ui.setCurrentScreen(Screens.SCENE_SCREEN);
		return;
	}

	Gdx.gl.glClearColor(0, 0, 0, 1);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

	// Only show the squares when time > INIT_TIME
	if (initTime < INIT_TIME_SEG) {
		initTime += delta;
		return;
	}

	final SpriteBatch batch = ui.getBatch();

	batch.setProjectionMatrix(viewport.getCamera().combined);
	batch.begin();

	update(delta);

	for (int i = 0; i < numSquares; i++) {
		final Color color = i == pos ? Color.WHITE : Color.GRAY;
		RectangleRenderer.draw(ui.getBatch(), x + i * (squareWidth + margin), y, squareWidth, squareHeight, color);
	}
	batch.end();
}
 
Example 3
Source Project: talos   File: ViewportWidget.java    License: Apache License 2.0 4 votes vote down vote up
protected void drawGrid(Batch batch, float parentAlpha) {
    Gdx.gl.glLineWidth(1f);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    Color gridColor = new Color(Color.GRAY);

    int minCount = 3;
    int maxCount = 100;

    float width = camera.viewportWidth * camera.zoom;
    float height = camera.viewportHeight * camera.zoom;

    float x = camera.position.x;
    float y = camera.position.y;

    int countX = MathUtils.ceil(width/gridSize);
    int countY = MathUtils.ceil(height/gridSize);

    float falloff = ((float)(MathUtils.clamp(countX, minCount, maxCount)-minCount))/(maxCount-minCount);
    float brightAlpha = (1f-falloff*0.95f) * 0.5f * parentAlpha;
    float dimAlpha = gridColor.a * 0.05f * parentAlpha;

    // camera offsets
    x =  x - x % (gridSize*8f);
    y =  y - y % (gridSize*8f);

    float thickness = pixelToWorld(1.2f);

    for(int i = -countX/2-8; i <= countX/2+8; i++) {
        if(i % 4 == 0) gridColor.a = brightAlpha;
        else gridColor.a = dimAlpha;
        shapeRenderer.setColor(gridColor);
        shapeRenderer.rectLine(i * gridSize + x , -height/2f + y - gridSize*8f, i * gridSize + x, height/2f + y + gridSize*8f, thickness);
    }
    for(int i = -countY/2-8; i <= countY/2+8; i++) {
        if(i % 4 == 0) gridColor.a = brightAlpha;
        else gridColor.a = dimAlpha;
        shapeRenderer.setColor(gridColor);
        shapeRenderer.rectLine(-width/2f + x - gridSize * 8f, i * gridSize + y, width/2f + x + gridSize*8f, i * gridSize + y, thickness);
    }

    shapeRenderer.end();
}
 
Example 4
Source Project: dice-heroes   File: State.java    License: GNU General Public License v3.0 4 votes vote down vote up
protected Color getBackgroundColor() {
    return Color.GRAY;
}