Example usage for com.badlogic.gdx.graphics Color CLEAR

List of usage examples for com.badlogic.gdx.graphics Color CLEAR

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Color CLEAR.

Prototype

Color CLEAR

To view the source code for com.badlogic.gdx.graphics Color CLEAR.

Click Source Link

Usage

From source file:broken.shotgun.throwthemoon.stages.GameStage.java

License:Open Source License

public GameStage(final AssetManager manager) {
    super(new StretchViewport(WIDTH, HEIGHT));

    this.manager = manager;

    loadLevel();//  ww  w.j  a  va  2  s .  co m

    loadSounds();

    loadFont();

    random = new Random(System.currentTimeMillis());
    fadingOut = false;

    background = new Background(manager);
    chain = new MoonChain(manager);
    player = new Player(manager);
    moon = new Moon(manager);

    moonImpactMeter = new MoonImpactMeter(moon);

    screenFadeActor = new Actor();
    screenFadeActor.setBounds(0, 0, WIDTH, HEIGHT);
    screenFadeActor.setColor(Color.CLEAR);

    levelDebugRenderer = new LevelDebugRenderer();
    screenLogger = new StringBuilder();

    uiBatch = new SpriteBatch();
    renderer = new ShapeRenderer();
    renderer.setAutoShapeType(true);

    touchPoint = new Vector2();

    resetLevel();

    debug = isDebug();
    setDebugAll(debug);

    Gdx.input.setInputProcessor(this);

    addListener(new ActorGestureListener() {
        @Override
        public void touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (pointer == 0 && !(event.getTarget() instanceof Enemy || event.getTarget() instanceof Boss
                    || (boss != null && event.getTarget() instanceof MoonChain))) {
                player.moveTo(touchPoint.set(x, y));
            }

            // FIXME replace String.format with StringBuilder for HTML
            if (isDebug())
                Gdx.app.log("GameStage", String.format("touchDown %s %s", event.getType().toString(),
                        event.getTarget().toString()));
            super.touchDown(event, x, y, pointer, button);
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            if (pointer == 0 && player.isWalking()) {
                player.stop();
            }
            super.touchUp(event, x, y, pointer, button);
        }

        @Override
        public void pan(InputEvent event, float x, float y, float deltaX, float deltaY) {
            if (boss == null || (boss != null && !(event.getTarget() instanceof MoonChain))) {
                player.moveTo(touchPoint.set(x, y));
            }

            super.pan(event, x, y, deltaX, deltaY);
        }

        @Override
        public void tap(InputEvent event, float x, float y, int count, int button) {
            player.performAttack(count);

            float deltaX = ((player.getX() + player.getOriginX()) - x);
            player.setFlipX(deltaX > 0);

            // FIXME replace String.format with StringBuilder for HTML
            if (isDebug()) {
                Actor target = event.getTarget();
                Gdx.app.log("GameStage",
                        String.format("tap type:%s target:%s [target x=%.2f y=%.2f] count:%d [x:%.2f, y:%.2f]",
                                event.getType().toString(), target.toString(), target.getX(), target.getY(),
                                count, x, y));
            }
            super.tap(event, x, y, count, button);
        }

        @Override
        public void fling(InputEvent event, float velocityX, float velocityY, int button) {
            Gdx.app.log("GameStage",
                    String.format("fling velocityX:%.2f velocityY:%.2f", velocityX, velocityY));
            if (player.isMoonThrowEnabled() && velocityY < 0 && chain.isAttached()
                    && event.getTarget() instanceof MoonChain) {
                int multiplier = (boss != null && boss.isDefeated()) ? 10 : 2;
                moon.addDistance(velocityY * multiplier);
                chain.animatePull();
            }
            super.fling(event, velocityX, velocityY, button);
        }

    });

    addListener(new InputListener() {
        int attackCounter = 0;

        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            switch (keycode) {
            case Input.Keys.D:
                if (debug && player.isMoonThrowEnabled() && !moon.isFalling()) {
                    moon.startFalling();
                }
                break;
            case Input.Keys.K:
                if (debug) {
                    clearAllEnemies();
                }
                break;
            case Input.Keys.SPACE:
                attackCounter++;
                player.performAttack(attackCounter);
                return true;
            case Input.Keys.LEFT:
                player.velocity.x = -7;
                player.startWalkState();
                return true;
            case Input.Keys.RIGHT:
                player.velocity.x = 7;
                player.startWalkState();
                return true;
            case Input.Keys.UP:
                player.velocity.y = 7;
                player.startWalkState();
                return true;
            case Input.Keys.DOWN:
                player.velocity.y = -7;
                player.startWalkState();
                return true;
            }

            return super.keyDown(event, keycode);
        }

        @Override
        public boolean keyUp(InputEvent event, int keycode) {
            switch (keycode) {
            case Input.Keys.LEFT:
            case Input.Keys.RIGHT:
                player.velocity.x = 0;
                return true;
            case Input.Keys.UP:
            case Input.Keys.DOWN:
                player.velocity.y = 0;
                return true;
            }
            return super.keyUp(event, keycode);
        }
    });
}

From source file:broken.shotgun.throwthemoon.stages.GameStage.java

License:Open Source License

public void fadeOut(Runnable runnable) {
    if (fadingOut)
        return;/*www. j  a  v a2s  .c om*/

    fadingOut = true;

    addActor(moon);
    moon.startFalling();

    screenFadeActor.addAction(Actions.sequence(Actions.color(Color.CLEAR),
            Actions.color(Color.RED, 5f, Interpolation.exp5In), Actions.run(runnable)));
    addActor(screenFadeActor);
}

From source file:ch.coldpixel.game.MapDrawing.java

public void showGrid() {
    //Show Grid if G is pressed
    if (Gdx.input.isKeyPressed(Input.Keys.G)) {
        shape.begin(ShapeRenderer.ShapeType.Line);
        shape.setColor(Color.RED);
        for (int i = 0; i <= LEVEL_1_WIDTH; i += TILESIZE) {
            for (int j = 0; j <= LEVEL_1_HEIGTH; j += TILESIZE) {
                shape.rect(0, 0, i, j);/*from  ww w  .  ja  va 2 s .com*/
            }
        }
    }
    shape.setColor(Color.CLEAR);
    shape.end();
}

From source file:com.explatcreations.sft.modes.MenuButton.java

License:Open Source License

private static SpriteBase chooseStatusSprite(boolean isUnskippable, LevelState state) {
    if (isUnskippable && state.eq(LevelState.Unlocked)) {
        return makeStatusSprite(exclamationClass);
    } else if (state.eq(LevelState.Completed)) {
        return makeCheckmarkSprite();
    } else if (state.eq(LevelState.Golden)) {
        return makeGoldStarSprite();
    }/*  w  w w .  ja  v a2 s.  c om*/
    return new RectSprite(16, 16, Color.CLEAR);
}

From source file:com.github.skittishSloth.openSkies.maps.terrains.TerrainTile.java

private static Color buildMineralColor(final float minerals) {
    if (minerals < 0.50f) {
        return Color.CLEAR;
    }/*from   ww w . j ava  2 s  . c  o m*/

    final Color gold = new Color(1.000f, 0.843f, 0.000f, 1.0f);
    final Color silver = new Color(0.753f, 0.753f, 0.753f, 1.0f);
    final Color oil = new Color(0.282f, 0.239f, 0.545f, 1.0f);

    final Color res = new Color(gold.r * minerals, gold.g * minerals, gold.b * minerals, 1.0f);
    return res;
}

From source file:com.idp.engine.App.java

/**
  * Adds new screen to the screen stack.
  * @param s new screen//w  w  w.j  a  v  a 2  s . com
  */
 public void pushScreen(IdpAppScreen s) {
     stack.push(currentScreen);

     currentScreen = s;
     Navbar navbar = currentScreen.getNavbar();

     Rect back = new Navbar.NavButton("back");
     back.setBackgroundColor(Color.CLEAR);
     back.setColor(StartTrackApp.ColorPallete.TEXT_NAVBAR);
     back.addListener(new ClickListener() {
         @Override
         public void clicked(InputEvent event, float x, float y) {
             popScreen();
         }
     });
     navbar.getLeftIcons().addActor(back);

     changeScreen(currentScreen, TransitionManager.TransitionType.SLIDE_RIGHT_LEFT);
 }

From source file:com.idp.engine.ui.graphics.base.Navbar.java

public Navbar() {

    // todo: read style from config

    setName("navbar");
    this.contentColor = Color.BLACK;
    this.iconSize = App.dp2px(40);
    float h = App.dp2px(56);

    setSize(Gdx.graphics.getWidth(), h);
    setBorder(0, 0, App.dp2px(1), 0);/*from   w  ww  . ja  v a  2  s . co m*/
    setBorderColor(Color.BLACK);
    setBackgroundColor(Color.CLEAR);
    float padleft = App.dp2px(8);
    float padright = App.dp2px(8);

    textGroup = new Group();
    textGroup.setSize(Gdx.graphics.getWidth() - App.dp2px(168), App.dp2px(24));

    this.text = new com.idp.engine.ui.graphics.actors.Text("", App.getResources().getLabelStyle("navbar"));
    text.setWidth(Gdx.graphics.getWidth() - App.dp2px(168));
    text.setHeight(App.dp2px(24));
    text.setAlignment(Align.center);

    textGroup.addActor(text);
    text.setY((textGroup.getHeight() - text.getHeight()) / 2);
    text.setX((textGroup.getWidth() - text.getWidth()) / 2);

    this.leftIcons = new Group();
    leftIcons.setSize(iconSize, iconSize);
    leftIcons.setX(padleft);
    leftIcons.setY((h - iconSize) / 2);

    this.rightIcons = new Group();
    rightIcons.setSize(iconSize, iconSize);
    rightIcons.setX(getWidth() - padright - iconSize);
    rightIcons.setY((h - iconSize) / 2);

    addActor(leftIcons);
    addActor(textGroup);
    addActor(rightIcons);

    textGroup.setY((getHeight() - text.getHeight()) / 2);
    textGroup.setX((getWidth() - textGroup.getWidth()) / 2);
}

From source file:com.kotcrab.vis.editor.proxy.EntityProxy.java

License:Apache License

public Color getColor() {
    if (tintOwner == null)
        return Color.CLEAR;
    return tintOwner.getTint();
}

From source file:com.ray3k.skincomposer.dialog.DialogColorPicker.java

License:Open Source License

public DialogColorPicker(Main main, String style, ColorListener listener, Color previousColor) {
    super("", main.getSkin(), style);

    if (previousColor == null) {
        selectedColor = new Color(Color.RED);
    } else {//from   w ww .  jav a 2s . c o  m
        this.previousColor = new Color(previousColor);
        selectedColor = new Color(previousColor);
    }

    this.skin = main.getSkin();
    this.main = main;
    this.listener = listener;

    spinnerStyle = new Spinner.SpinnerStyle(skin.get("spinner-minus-h", Button.ButtonStyle.class),
            skin.get("spinner-plus-h", Button.ButtonStyle.class),
            skin.get("default", TextField.TextFieldStyle.class));

    gradientAlpha = new GradientDrawable(new Color(1.0f, 0, 0, 0), new Color(1.0f, 0, 0, 0), Color.RED,
            Color.RED);
    Vector3 v = rgbToHsb(selectedColor.r, selectedColor.g, selectedColor.b);
    Color temp = hsbToRgb(v.x * 360.0f, 1.0f, 1.0f);
    gradientS = new GradientDrawable(Color.WHITE, temp, temp, Color.WHITE);
    gradientB = new GradientDrawable(Color.BLACK, Color.BLACK, Color.CLEAR, Color.CLEAR);
    gradientSB = new StackedDrawable(gradientS, gradientB);

    hueGradient = new Array<>();
    hueGradient.add(new GradientDrawable(Color.MAGENTA, Color.MAGENTA, Color.RED, Color.RED));
    hueGradient.add(new GradientDrawable(Color.BLUE, Color.BLUE, Color.MAGENTA, Color.MAGENTA));
    hueGradient.add(new GradientDrawable(Color.CYAN, Color.CYAN, Color.BLUE, Color.BLUE));
    hueGradient.add(new GradientDrawable(Color.GREEN, Color.GREEN, Color.CYAN, Color.CYAN));
    hueGradient.add(new GradientDrawable(Color.YELLOW, Color.YELLOW, Color.GREEN, Color.GREEN));
    hueGradient.add(new GradientDrawable(Color.RED, Color.RED, Color.YELLOW, Color.YELLOW));

    Drawable tinted = ((TextureRegionDrawable) skin.getDrawable("white")).tint(Color.LIGHT_GRAY);
    checker = new CheckerDrawable(skin.getDrawable("white"), tinted, 10.0f, 10.0f);
    alphaStack = new StackedDrawable(checker, gradientAlpha);

    Table root = getContentTable();
    Label label = new Label("Choose a Color", skin, "title");
    label.setAlignment(Align.center);
    root.add(label).growX();

    root.row();
    content = new Table(skin);
    root.add(content);

    addListener(new InputListener() {
        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            if (keycode == Keys.ESCAPE) {
                if (listener != null) {
                    listener.handle(new ColorListener.ColorEvent(null));
                }
                hide();
            }
            return false;
        }
    });

    populate();
}

From source file:com.spaceapps.liftoffgame.screens.GameScreen.java

public void rocketPlatformOnAnimation() {
    MoveToAction action = Actions.action(MoveToAction.class);
    action.setPosition(-100, 100);/*from   w  ww  .java 2  s .  co m*/
    action.setDuration(1f);
    game.platform.addAction(action);

    AlphaAction action6 = Actions.action(AlphaAction.class);
    // action6.setRotation(90f);
    action6.setColor(Color.CLEAR);
    action6.setDuration(1f);
    game.platform.addAction(action6);
}