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

The following examples show how to use com.badlogic.gdx.graphics.Color#BLUE . 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
Source Project: INFDEV02-4   File: GDXDrawingAdapter.java    License: MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch(color) {
        case WHITE:
            return Color.WHITE;
            
        case BLACK:
            return Color.BLACK;
            
        case BLUE:
            return Color.BLUE;
            
        default:
            return Color.RED;
    }
}
 
Example 2
Source Project: INFDEV02-4   File: DefaultUpdateVisitor.java    License: MIT License 5 votes vote down vote up
@Override
public void updateButton(Button element, Float dt) {
    if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
        if (element.
                contains(new Point(
                        (float) Gdx.input.getX(),
                        (float) Gdx.input.getY()
                ))) {
            element.color = Color.BLUE;
            element.action.run();
        }
    } else {
        element.color = Color.WHITE;
    }
}
 
Example 3
Source Project: INFDEV02-4   File: DefaultUpdateVisitor.java    License: MIT License 5 votes vote down vote up
@Override
public void updateButton(Button element, Float dt) {
    if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
        if (element.
                contains(new Point(
                        (float) Gdx.input.getX(),
                        (float) Gdx.input.getY()
                ))) {
            element.color = Color.BLUE;
            element.action.run();
        }
    } else {
        element.color = Color.WHITE;
    }
}
 
Example 4
Source Project: INFDEV02-4   File: GDXDrawingAdapter.java    License: MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch (color) {
        case WHITE:
            return Color.WHITE;

        case BLACK:
            return Color.BLACK;

        case BLUE:
            return Color.BLUE;

        default:
            return Color.RED;
    }
}
 
Example 5
Source Project: INFDEV02-4   File: GDXDrawingAdapter.java    License: MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch (color) {
        case WHITE:
            return Color.WHITE;

        case BLACK:
            return Color.BLACK;

        case BLUE:
            return Color.BLUE;

        default:
            return Color.RED;
    }
}
 
Example 6
Source Project: INFDEV02-4   File: GDXDrawingAdapter.java    License: MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch(color) {
        case WHITE:
            return Color.WHITE;
            
        case BLACK:
            return Color.BLACK;
            
        case BLUE:
            return Color.BLUE;
            
        default:
            return Color.RED;
    }
}
 
Example 7
Source Project: riiablo   File: Map.java    License: Apache License 2.0 5 votes vote down vote up
public static Color getColor(int mainIndex) {
  switch (mainIndex) {
    case 8:  return Color.RED;
    case 9:  return Color.ORANGE;
    case 10: return Color.YELLOW;
    case 12: return Color.GREEN;
    case 13: return Color.BLUE;
    case 16: return Color.TEAL;
    case 20: return Color.VIOLET;
    default: return Color.WHITE;
  }
}
 
Example 8
Source Project: GdxDemo3D   File: FollowPathSteerer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public boolean processSteering(SteeringAcceleration<Vector3> steering) {

	// Check if steering target path segment changed.
	LinePathParam pathParam = followPathSB.getPathParam();
	int traversedSegment = pathParam.getSegmentIndex();
	if (traversedSegment > currentSegmentIndex) {
		currentSegmentIndex = traversedSegment;
	}

	if (prioritySteering.getSelectedBehaviorIndex() == 0) {
		/*
		 * Collision avoidance management
		 */
		float pr = proximity.getRadius() * 1.5f;
		if (linePath.getEndPoint().dst2(steerableBody.getPosition()) <= pr * pr) {
			// Disable collision avoidance near the end of the path since the obstacle
			// will likely prevent the entity from reaching the target.
			collisionAvoidanceSB.setEnabled(false);
			deadlockDetectionStartTime = Float.POSITIVE_INFINITY;
		} else if (deadlockDetection) {
			// Accumulate collision time during deadlock detection
			collisionDuration += GdxAI.getTimepiece().getDeltaTime();

			if (GdxAI.getTimepiece().getTime() - deadlockDetectionStartTime > DEADLOCK_TIME && collisionDuration > DEADLOCK_TIME * .6f) {
				// Disable collision avoidance since most of the deadlock detection period has been spent on collision avoidance
				collisionAvoidanceSB.setEnabled(false);
			}
		} else {
			// Start deadlock detection
			deadlockDetectionStartTime = GdxAI.getTimepiece().getTime();
			collisionDuration = 0;
			deadlockDetection = true;
		}
		return true;
	}

	/*
	 * Path following management
	 */
	float dst2FromPathEnd = steerableBody.getPosition().dst2(linePath.getEndPoint());

	// Check to see if the entity has reached the end of the path
	if (steering.isZero() && dst2FromPathEnd < followPathSB.getArrivalTolerance() * followPathSB.getArrivalTolerance()) {
		return false;
	}

	// Check if collision avoidance must be re-enabled
	if (deadlockDetection && !collisionAvoidanceSB.isEnabled() && GdxAI.getTimepiece().getTime() - deadlockDetectionStartTime > MAX_NO_COLLISION_TIME) {
			collisionAvoidanceSB.setEnabled(true);
			deadlockDetection = false;
	}
	
	// If linear speed is very low and the entity is colliding something at his feet, like a step of the stairs
	// for instance, we have to increase the acceleration to make him go upstairs. 
	float minVel = .2f;
	if (steerableBody.getLinearVelocity().len2() > minVel * minVel) {
		stationarityRayColor = null;
	} else {
		steerableBody.getGroundPosition(stationarityRayLow.origin).add(0, 0.05f, 0);
		steerableBody.getDirection(stationarityRayLow.direction).scl(1f, 0f, 1f).nor();
		stationarityRayLength = steerableBody.getBoundingRadius() + 0.4f;
		Entity hitEntityLow = GameScreen.screen.engine.rayTest(stationarityRayLow, null, GameEngine.ALL_FLAG, GameEngine.PC_FLAG, stationarityRayLength, null);
		if (hitEntityLow instanceof GameObject) {
			stationarityRayColor = Color.RED;
			stationarityRayHigh.set(stationarityRayLow);
			stationarityRayHigh.origin.add(0, .8f, 0);
			Entity hitEntityHigh = GameScreen.screen.engine.rayTest(stationarityRayHigh, null, GameEngine.ALL_FLAG, GameEngine.PC_FLAG, stationarityRayLength, null);
			if (hitEntityHigh == null) {
				// The entity is touching a small obstacle with his feet like a step of the stairs.
				// Increase the acceleration to make him go upstairs.
				steering.linear.scl(8);
			}
			else if (hitEntityHigh instanceof GameObject) {
				// The entity is touching a higher obstacle like a tree, a column or something.
				// Here we should invent something to circumvent this kind of obstacles :)
				//steering.linear.rotateRad(Constants.V3_UP, Constants.PI0_25);
			}
		} else {
			stationarityRayColor = Color.BLUE;
		}
	}

	return true;
}