List of usage examples for com.badlogic.gdx.graphics Color RED
Color RED
To view the source code for com.badlogic.gdx.graphics Color RED.
Click Source Link
From source file:com.dgzt.core.Arrow.java
License:Open Source License
/** * The constructor./*from w ww . j ava2s .c om*/ * * @param parent - The parent object. * @param shader - The shader. */ public Arrow(final Table parent, final ShaderProgram shader) { super(shader, Color.RED); this.parent = parent; visible = false; }
From source file:com.esotericsoftware.spine.SimpleTest2.java
License:Open Source License
public void create() { camera = new OrthographicCamera(); batch = new SpriteBatch(); renderer = new SkeletonRenderer(); renderer.setPremultipliedAlpha(true); debugRenderer = new SkeletonRendererDebug(); atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas")); SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless. json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine. SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy.json")); skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc). skeleton.setPosition(250, 20);//from w w w . ja v a 2 s . c o m skeleton.setAttachment("head-bb", "head"); // Attach "head" bounding box to "head-bb" slot. bounds = new SkeletonBounds(); // Convenience class to do hit detection with bounding boxes. AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between animations. stateData.setMix("run", "jump", 0.2f); stateData.setMix("jump", "run", 0.2f); stateData.setMix("jump", "jump", 0); state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc). state.setTimeScale(0.3f); // Slow all animations down to 30% speed. state.addListener(new AnimationStateListener() { public void event(int trackIndex, Event event) { System.out.println(trackIndex + " event: " + state.getCurrent(trackIndex) + ", " + event.getData().getName() + ", " + event.getInt()); } public void complete(int trackIndex, int loopCount) { System.out.println(trackIndex + " complete: " + state.getCurrent(trackIndex) + ", " + loopCount); } public void start(int trackIndex) { System.out.println(trackIndex + " start: " + state.getCurrent(trackIndex)); } public void end(int trackIndex) { System.out.println(trackIndex + " end: " + state.getCurrent(trackIndex)); } }); // Set animation on track 0. state.setAnimation(0, "run", true); Gdx.input.setInputProcessor(new InputAdapter() { final Vector3 point = new Vector3(); public boolean touchDown(int screenX, int screenY, int pointer, int button) { camera.unproject(point.set(screenX, screenY, 0)); // Convert window to world coordinates. bounds.update(skeleton, true); // Update SkeletonBounds with current skeleton bounding box positions. if (bounds.aabbContainsPoint(point.x, point.y)) { // Check if inside AABB first. This check is fast. BoundingBoxAttachment hit = bounds.containsPoint(point.x, point.y); // Check if inside a bounding box. if (hit != null) { System.out.println("hit: " + hit); skeleton.findSlot("head").getColor().set(Color.RED); // Turn head red until touchUp. } } return true; } public boolean touchUp(int screenX, int screenY, int pointer, int button) { skeleton.findSlot("head").getColor().set(Color.WHITE); return true; } public boolean keyDown(int keycode) { state.setAnimation(0, "jump", false); // Set animation on track 0 to jump. state.addAnimation(0, "run", true, 0); // Queue run to play after jump. return true; } }); }
From source file:com.evoluzion.Qenergia.java
License:Open Source License
public void dibujar(ShapeRenderer sr) { if (visible == true) { sr.setColor(Color.RED); sr.filledCircle(posicion.x, posicion.y, ancho); } }
From source file:com.game.HelloWorld.java
License:Apache License
@Override public void create() { // Stage pour scene2D mT = new Texture(Gdx.files.internal("data/ball.png")); texture = new Texture(Gdx.files.internal("data/main_char.png")); mMainCharBatch = new SpriteBatch(); mMainCharRegions[0] = new TextureRegion(texture, 0, 0, 0.25f, 0.25f); mMainCharRegions[1] = new TextureRegion(texture, 0.25f, 0, 0.5f, 0.25f); mMainCharRegions[2] = new TextureRegion(texture, 0.5f, 0, 0.75f, 0.25f); mMainCharRegions[3] = new TextureRegion(texture, 0, 0.25f, 0.25f, 0.5f); mMainCharRegions[4] = new TextureRegion(texture, 0.25f, 0.25f, 0.5f, 0.5f); mMainCharRegions[5] = new TextureRegion(texture, 0.5f, 0.25f, 0.75f, 0.5f); mMainCharRegions[6] = new TextureRegion(texture, 0, 0.5f, 0.25f, 0.75f); mMainCharRegions[7] = new TextureRegion(texture, 0.25f, 0.5f, 0.5f, 0.75f); mMainCharRegions[8] = new TextureRegion(texture, 0.5f, 0.5f, 0.75f, 0.75f); mMainCharRegions[9] = new TextureRegion(texture, 0, 0.75f, 0.25f, 1.0f); mMainCharRegions[10] = new TextureRegion(texture, 0.25f, 0.75f, 0.5f, 1.0f); mMainCharRegions[11] = new TextureRegion(texture, 0.5f, 0.75f, 0.75f, 1.0f); Image mainChar = new Image("mainChar", mT); mainChar.x = Gdx.graphics.getWidth() / 2; mainChar.y = Gdx.graphics.getHeight() / 2; mRenderTree = new RenderTree(); mRenderTree.getStage().addActor(mainChar); mRenderTree.getStage().addActor(BallSplash.getInstance()); Gdx.input.setInputProcessor(this); font = new BitmapFont(); font.setColor(Color.RED); // Define the audio source music = Gdx.audio.newMusic(Gdx.files.internal("data/music.mp3")); sound = Gdx.audio.newSound(Gdx.files.internal("data/sound.ogg")); music.setLooping(true);//w w w. j a va 2 s . c om music.setVolume(0.0f); music.play(); // Define the orthographic cam mCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.create_tiledMap(); this.mCamera.position.set(new Vector3(this.mTileMapRenderer.getMapWidthUnits() / 2, this.mTileMapRenderer.getMapHeightUnits() / 2, 0)); this.mCamera.update(); }
From source file:com.gemserk.libgdx.test.HelloWorld.java
License:Apache License
@Override public void create() { font = new BitmapFont(); font.setColor(Color.RED); texture = new Texture(Gdx.files.internal("data/badlogic.jpg")); spriteBatch = new SpriteBatch(); }
From source file:com.github.mkjensen.breakall.actor.Paddle.java
License:Apache License
@Override protected void draw(ShapeRenderer renderer) { renderer.begin(ShapeType.Filled);/* ww w. j av a2 s. com*/ renderer.setColor(Color.RED); renderer.rect(getX() - getWidth() / 2, getY() - getHeight() / 2, getWidth(), getHeight()); renderer.end(); }
From source file:com.hindelid.ld.thirtyfour.HUDDisplay.java
License:Apache License
public HUDDisplay() { mShapeRenderer = new ShapeRenderer(); mBatch = new SpriteBatch(); mFont = new BitmapFont(); mFont.setColor(Color.RED); mHUDCamera = new OrthographicCamera(); mHUDCamera.position.set(400 / 2, 400 / 2, 0); mHUDCamera.update();/*from w w w . j a v a 2 s .c om*/ mHUDViewport = new ExtendViewport(400, 400, mHUDCamera); reset(); }
From source file:com.hindelid.ld.thirtyfour.HUDDisplay.java
License:Apache License
public void renderStartScreen() { mHUDCamera.update();// ww w . j a va2 s . c o m mShapeRenderer.setProjectionMatrix(mHUDCamera.combined); mShapeRenderer.begin(ShapeRenderer.ShapeType.Line); mShapeRenderer.setColor(Color.WHITE); mShapeRenderer.polygon(leftArrow); mShapeRenderer.polygon(rightArrow); mShapeRenderer.end(); mBatch.begin(); mFont.setColor(Color.RED); mFont.getData().setScale(4f); mFont.draw(mBatch, "AnglerFish", 70f, 300f); mFont.getData().setScale(1f); mFont.draw(mBatch, "by Christoffer Hindelid", 70f, 240f); mBatch.end(); }
From source file:com.hindelid.ld.thirtyfour.HUDDisplay.java
License:Apache License
public void render(int aPoints) { mHUDCamera.update();//from w w w . ja v a 2 s.c om mBatch.setProjectionMatrix(mHUDCamera.combined); mBatch.begin(); mFont.getData().setScale(1f); mFont.draw(mBatch, "high score:" + mHighScore, 330f, 40f); mFont.draw(mBatch, "score:" + aPoints, 330f, 20f); mBatch.end(); mShapeRenderer.setProjectionMatrix(mHUDCamera.combined); if (mHealth > 0) { mShapeRenderer.begin(ShapeRenderer.ShapeType.Filled); mShapeRenderer.setColor(Color.RED); mShapeRenderer.rect(0f, 20f, 200f, 20f); mShapeRenderer.setColor(Color.GREEN); mShapeRenderer.rect(0f, 20f, mHealth * 40f, 20f); mShapeRenderer.end(); } }
From source file:com.hindelid.ld.thirtyfour.HUDDisplay.java
License:Apache License
public boolean renderGameOver(int aPoints) { if (aPoints > mHighScore) { mHighScore = aPoints;/*from w ww . j a v a 2s . c o m*/ } mHUDCamera.update(); mBatch.setProjectionMatrix(mHUDCamera.combined); if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY)) { mCounter = 49; } if (mCounter < 50) { mCounter--; } mShapeRenderer.begin(ShapeRenderer.ShapeType.Filled); mShapeRenderer.setColor(Color.BLACK); mShapeRenderer.rect(-2f, 0f, 130f, 40f); mShapeRenderer.end(); mBatch.begin(); if (mCounter >= 0) { mFont.getData().setScale(4f + 10f / (mCounter + 1f)); } else { mFont.getData().setScale(4f); } mFont.draw(mBatch, "game over", 60f, 240f); mFont.getData().setScale(2f); mFont.draw(mBatch, "points:" + aPoints, 120f, 160f); mFont.getData().setScale(1f); mFont.setColor(Color.OLIVE); mFont.draw(mBatch, "made by chrizdekok", 0f, 40f); mFont.draw(mBatch, "www.hindelid.com", 0f, 20f); mFont.setColor(Color.RED); mBatch.end(); return mCounter <= 0; }