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

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

Introduction

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

Prototype

Color BLACK

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

Click Source Link

Usage

From source file:com.jupiter.europa.screen.MainMenuScreen.java

License:Open Source License

private static void buildMainMenuSkin() {
    Skin skin = new Skin();

    // Fonts/*from   w w w . ja v a2 s.  co  m*/
    skin.add(BUTTON_FONT_KEY, EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(BUTTON_FONT).toString()));
    skin.add(TITLE_FANCY_FONT_KEY, EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(TITLE_FANCY_FONT).toString()));
    skin.add(TITLE_FONT_KEY, EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(TITLE_FONT).toString()));
    skin.add(LIST_FONT_KEY,
            EuropaGame.game.getAssetManager().get(FileLocations.FONTS_DIRECTORY.resolve(LIST_FONT).toString()));
    skin.add(TEXT_FIELD_FONT_KEY, EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(TEXT_FIELD_FONT).toString()));
    skin.add(INFO_LABEL_FONT_KEY, EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(INFO_LABEL_FONT).toString()));

    // Set the background texture
    Pixmap pixmap = new Pixmap(1, (int) 1, Pixmap.Format.RGB888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add(SOLID_TEXTURE_KEY, new Texture(pixmap));
    Drawable transparentDrawable = skin.newDrawable(SOLID_TEXTURE_KEY, TRANSPARENT);

    // Get values from the atlas
    skin.addRegions(
            EuropaGame.game.getAssetManager().get(MAIN_MENU_SKIN_DIRECTORY.resolve(ATLAS_KEY).toString()));

    // Colors
    Color textButtonFontColor = new Color(0.85f, 0.85f, 0.85f, 1.0f);

    // Set images
    Drawable textButtonBackground = new TextureRegionDrawable(
            skin.get(BUTTON_BACKGROUND_KEY, TextureRegion.class));
    textButtonBackground.setLeftWidth(32);
    textButtonBackground.setRightWidth(32);
    textButtonBackground.setTopHeight(5);
    textButtonBackground.setBottomHeight(5);
    skin.add(BUTTON_BACKGROUND_KEY, textButtonBackground);

    Drawable textButtonBackgroundDown = new TextureRegionDrawable(
            skin.get(BUTTON_DOWN_KEY, TextureRegion.class));
    textButtonBackgroundDown.setLeftWidth(32);
    textButtonBackgroundDown.setRightWidth(32);
    textButtonBackgroundDown.setTopHeight(5);
    textButtonBackgroundDown.setBottomHeight(5);
    skin.add(BUTTON_DOWN_KEY, textButtonBackgroundDown);

    Drawable listSelection = new TextureRegionDrawable(skin.get(LIST_SELECTION_KEY, TextureRegion.class));
    listSelection.setLeftWidth(7);
    listSelection.setRightWidth(7);
    listSelection.setTopHeight(0);
    listSelection.setBottomHeight(0);
    skin.add(LIST_SELECTION_KEY, listSelection);

    Drawable tabButtonBackground = new TextureRegionDrawable(
            skin.get(TAB_BUTTON_BACKGROUND_KEY, TextureRegion.class));
    tabButtonBackground.setLeftWidth(5);
    tabButtonBackground.setRightWidth(5);
    tabButtonBackground.setTopHeight(0);
    tabButtonBackground.setBottomHeight(0);
    skin.add(TAB_BUTTON_BACKGROUND_KEY, tabButtonBackground);

    Drawable tabButtonBackgroundSelected = new TextureRegionDrawable(
            skin.get(TAB_BUTTON_SELECTED_KEY, TextureRegion.class));
    tabButtonBackgroundSelected.setLeftWidth(5);
    tabButtonBackgroundSelected.setRightWidth(5);
    tabButtonBackgroundSelected.setTopHeight(0);
    tabButtonBackgroundSelected.setBottomHeight(0);
    skin.add(TAB_BUTTON_SELECTED_KEY, tabButtonBackgroundSelected);

    Drawable titleBackground = new TextureRegionDrawable(skin.get(TITLE_BACKGROUND_KEY, TextureRegion.class));
    titleBackground.setLeftWidth(10);
    titleBackground.setRightWidth(10);
    titleBackground.setTopHeight(0);
    titleBackground.setBottomHeight(0);
    skin.add(TITLE_BACKGROUND_KEY, titleBackground);

    Drawable numberIncreaseDrawable = new TextureRegionDrawable(
            skin.get(NUMBER_SELECTOR_INCREASE_KEY, TextureRegion.class));
    numberIncreaseDrawable.setLeftWidth(0);
    numberIncreaseDrawable.setRightWidth(0);
    numberIncreaseDrawable.setTopHeight(0);
    numberIncreaseDrawable.setBottomHeight(0);
    skin.add(NUMBER_SELECTOR_INCREASE_KEY, numberIncreaseDrawable);

    Drawable numberDecreaseDrawable = new TextureRegionDrawable(
            skin.get(NUMBER_SELECTOR_DECREASE_KEY, TextureRegion.class));
    numberDecreaseDrawable.setLeftWidth(0);
    numberDecreaseDrawable.setRightWidth(0);
    numberDecreaseDrawable.setTopHeight(0);
    numberDecreaseDrawable.setBottomHeight(0);
    skin.add(NUMBER_SELECTOR_DECREASE_KEY, numberDecreaseDrawable);

    skin.add(DIALOG_BACKGROUND_KEY,
            skin.newDrawable(new TextureRegionDrawable(skin.get(DIALOG_BACKGROUND_KEY, TextureRegion.class)),
                    new Color(1.0f, 1.0f, 1.0f, 1.0f)));
    skin.add(POPUP_BACKGROUND_KEY,
            skin.newDrawable(new TextureRegionDrawable(skin.get(POPUP_BACKGROUND_KEY, TextureRegion.class)),
                    new Color(1.0f, 1.0f, 1.0f, 1.0f)));
    skin.add(LIST_BACKGROUND_KEY,
            skin.newDrawable(new TextureRegionDrawable(skin.get(LIST_BACKGROUND_KEY, TextureRegion.class)),
                    new Color(1.0f, 1.0f, 1.0f, 1.0f)));
    skin.add(LIST_SELECTION_KEY,
            skin.newDrawable(new TextureRegionDrawable(skin.get(LIST_SELECTION_KEY, TextureRegion.class)),
                    new Color(1.0f, 1.0f, 1.0f, 1.0f)));
    skin.add(CREDITS_BACKGROUND_KEY,
            skin.newDrawable(new TextureRegionDrawable(skin.get(CREDITS_BACKGROUND_KEY, TextureRegion.class)),
                    new Color(1.0f, 1.0f, 1.0f, 1.0f)));

    Drawable dropdownListBackground = skin.newDrawable(
            new TextureRegionDrawable(skin.get(DROP_DOWN_LIST_BACKGROUND, TextureRegion.class)),
            new Color(1, 1, 1, 1));
    dropdownListBackground.setLeftWidth(28);
    dropdownListBackground.setRightWidth(28);
    dropdownListBackground.setTopHeight(0);
    dropdownListBackground.setBottomHeight(0);
    skin.add(DROP_DOWN_LIST_BACKGROUND, dropdownListBackground);

    // Create a Label style for the title
    Label.LabelStyle titleStyle = new Label.LabelStyle();
    titleStyle.background = transparentDrawable;
    titleStyle.font = skin.getFont(TITLE_FONT_KEY);
    titleStyle.fontColor = new Color(Color.BLACK);
    skin.add(DEFAULT_KEY, titleStyle);

    // Fancy Character Label Style
    Label.LabelStyle fancyTitleStyle = new Label.LabelStyle();
    fancyTitleStyle.background = transparentDrawable;
    fancyTitleStyle.font = skin.getFont(TITLE_FANCY_FONT_KEY);
    fancyTitleStyle.fontColor = new Color(Color.BLACK);
    skin.add(FANCY_KEY, fancyTitleStyle);

    // Create a Label style for dialogs
    LabelStyle infoStyle = new LabelStyle();
    infoStyle.background = transparentDrawable;
    infoStyle.font = skin.getFont(INFO_LABEL_FONT_KEY);
    infoStyle.fontColor = new Color(Color.BLACK);
    skin.add(INFO_STYLE_KEY, infoStyle);

    // Default Button Style
    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.up = textButtonBackground;
    textButtonStyle.down = textButtonBackgroundDown;
    textButtonStyle.checked = textButtonBackground;
    textButtonStyle.over = textButtonBackgroundDown;
    textButtonStyle.disabled = textButtonBackground;
    textButtonStyle.font = skin.getFont(BUTTON_FONT_KEY);
    textButtonStyle.fontColor = textButtonFontColor;
    textButtonStyle.disabledFontColor = new Color(0.3f, 0.3f, 0.3f, 1.0f);
    //        textButtonStyle.pressedOffsetX = 2f;
    //        textButtonStyle.pressedOffsetY = -3f;
    skin.add(DEFAULT_KEY, textButtonStyle);

    // Tab Button Style
    TextButtonStyle tabButtonStyle = new TextButtonStyle();
    tabButtonStyle.up = tabButtonBackground;
    tabButtonStyle.down = tabButtonBackground;
    tabButtonStyle.checked = tabButtonBackgroundSelected;
    tabButtonStyle.over = tabButtonBackground;
    tabButtonStyle.disabled = tabButtonBackground;
    tabButtonStyle.font = skin.getFont(BUTTON_FONT_KEY);
    tabButtonStyle.fontColor = textButtonFontColor;
    tabButtonStyle.overFontColor = textButtonFontColor;
    tabButtonStyle.disabledFontColor = new Color(Color.GRAY);
    skin.add(TAB_STYLE_KEY, tabButtonStyle);

    // Create a TextField style
    TextFieldStyle textFieldStyle = new TextFieldStyle();
    textFieldStyle.background = skin.newDrawable(SOLID_TEXTURE_KEY, new Color(0f, 0f, 0f, 0.1f));
    textFieldStyle.selection = skin.newDrawable(SOLID_TEXTURE_KEY, new Color(0f, 0f, 1f, 0.3f));
    textFieldStyle.cursor = skin.newDrawable(SOLID_TEXTURE_KEY, Color.BLACK);
    textFieldStyle.font = skin.getFont(TEXT_FIELD_FONT_KEY);
    textFieldStyle.fontColor = Color.BLACK;
    skin.add(DEFAULT_KEY, textFieldStyle);

    // Create a List style
    ListStyle listStyle = new ListStyle();
    listStyle.font = skin.getFont(LIST_FONT_KEY);
    listStyle.fontColorSelected = Color.BLACK;
    listStyle.fontColorUnselected = Color.BLACK;
    listStyle.selection = listSelection;
    listStyle.background = transparentDrawable;
    skin.add(DEFAULT_KEY, listStyle);

    // Create a Scroll Pane Style
    ScrollPaneStyle scrollPaneStyle = new ScrollPaneStyle();
    scrollPaneStyle.background = transparentDrawable;
    //        scrollPaneStyle.vScroll = skin.newDrawable(MainMenuScreen.SCROLL_BAR_VERTICAL_KEY);
    //        scrollPaneStyle.vScrollKnob = skin.newDrawable(MainMenuScreen.SCROLL_BAR_VERTICAL_KNOB_KEY);
    skin.add(DEFAULT_KEY, scrollPaneStyle);

    // Create a Dialog Style
    WindowStyle dialogStyle = new WindowStyle();
    dialogStyle.background = new SpriteDrawable(
            new Sprite(EuropaGame.game.getAssetManager().get(BACKGROUND_FILE_NAME, Texture.class)));
    dialogStyle.titleFont = skin.getFont(TITLE_FONT_KEY);
    dialogStyle.titleFontColor = new Color(Color.BLACK);
    skin.add(DEFAULT_KEY, dialogStyle);

    // Popup Dialog Style
    WindowStyle popupStyle = new WindowStyle();
    popupStyle.titleFont = skin.getFont(TITLE_FONT_KEY);
    popupStyle.titleFontColor = new Color(Color.BLACK);
    skin.add(POPUP_DIALOG_STYLE_KEY, popupStyle);

    // Create a Slider Skin
    SliderStyle sliderStyle = new SliderStyle();
    sliderStyle.background = new TextureRegionDrawable(skin.get(SLIDER_BACKGROUND_KEY, TextureRegion.class));
    sliderStyle.knob = new TextureRegionDrawable(skin.get(SLIDER_KNOB_KEY, TextureRegion.class));
    skin.add(DEFAULT_KEY, sliderStyle);

    // Create a Drop Down Menu Skin
    SelectBoxStyle selectBoxStyle = new SelectBoxStyle();
    selectBoxStyle.background = textButtonBackground;
    selectBoxStyle.backgroundOpen = textButtonBackgroundDown;
    selectBoxStyle.backgroundOver = textButtonBackgroundDown;
    selectBoxStyle.scrollStyle = scrollPaneStyle;
    selectBoxStyle.font = skin.getFont(TEXT_FIELD_FONT_KEY);
    selectBoxStyle.fontColor = textButtonFontColor;
    ListStyle selectBoxListStyle = new ListStyle();
    selectBoxListStyle.font = skin.getFont(LIST_FONT_KEY);
    selectBoxListStyle.fontColorSelected = textButtonFontColor;
    selectBoxListStyle.fontColorUnselected = textButtonFontColor;
    selectBoxListStyle.selection = skin.newDrawable(SOLID_TEXTURE_KEY, SELECTION_COLOR);
    selectBoxListStyle.background = dropdownListBackground;
    selectBoxStyle.listStyle = selectBoxListStyle;
    skin.add(DEFAULT_KEY, selectBoxStyle);

    // NumberSelectorStyle
    NumberSelectorStyle numberStyle = new NumberSelectorStyle();
    numberStyle.decrease = numberDecreaseDrawable;
    numberStyle.increase = numberIncreaseDrawable;
    numberStyle.minimumNumberSize = 50;
    numberStyle.numberLabelStyle = infoStyle;
    numberStyle.spacing = COMPONENT_SPACING;
    skin.add(DEFAULT_KEY, numberStyle);

    // AttributeSelectorStyle
    MultipleNumberSelectorStyle attrStyle = new MultipleNumberSelector.MultipleNumberSelectorStyle();
    attrStyle.labelStyle = infoStyle;
    attrStyle.numberSelectorStyle = numberStyle;
    attrStyle.spacing = COMPONENT_SPACING;
    skin.add(DEFAULT_KEY, attrStyle);

    mainMenuSkin = skin;
}

From source file:com.jupiter.europa.screen.overlay.PauseMenu.java

License:Open Source License

private static void buildPauseMenuSkin() {
    Skin skin = new Skin();

    skin.add("button-font", EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(BUTTON_FONT).toString()));
    skin.add("title-font", EuropaGame.game.getAssetManager()
            .get(FileLocations.FONTS_DIRECTORY.resolve(TITLE_FONT).toString()));

    // Set the background texture
    Pixmap pixmap = new Pixmap(1, (int) 1, Pixmap.Format.RGB888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();// w w w. ja v a  2s. c  om
    skin.add("background", new Texture(pixmap));

    // Create a Label style for the title
    Label.LabelStyle titleStyle = new Label.LabelStyle();
    titleStyle.background = skin.newDrawable("background", TRANSPARENT);
    titleStyle.font = skin.getFont("title-font");
    titleStyle.fontColor = Color.BLACK;
    skin.add("default", titleStyle);

    //Create a button style
    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("background", TRANSPARENT);
    textButtonStyle.down = skin.newDrawable("background", TRANSPARENT);
    textButtonStyle.checked = skin.newDrawable("background", TRANSPARENT);
    textButtonStyle.over = skin.newDrawable("background", TRANSPARENT);
    textButtonStyle.disabled = skin.newDrawable("background", TRANSPARENT);
    textButtonStyle.font = skin.getFont("button-font");
    textButtonStyle.fontColor = Color.TEAL;
    textButtonStyle.overFontColor = Color.YELLOW;
    textButtonStyle.disabledFontColor = Color.GRAY;
    textButtonStyle.pressedOffsetX = 2f;
    textButtonStyle.pressedOffsetY = -3f;
    skin.add("default", textButtonStyle);
    //        
    //        skin = EmergenceGame.game.getAssetManager().get(
    //                new File(FileLocations.SKINS_DIRECTORY, "main_menu.skin").getPath());
    pauseMenuSkin = skin;
}

From source file:com.kasetagen.game.bubblerunner.screen.BubbleRunnerMenu.java

License:Creative Commons License

public BubbleRunnerMenu(IGameProcessor delegate) {
    super(delegate);
    this.gameProcessor = delegate;
    stage = new BaseStage(delegate);

    bgMusic = gameProcessor.getAssetManager().get(AssetsUtil.MENU_BG_MUSIC, AssetsUtil.MUSIC);
    bgMusic.setVolume(gameProcessor.getStoredFloat(GameOptions.BG_MUSIC_VOLUME_PREF_KEY));
    bgMusic.play();//ww w . j av a2s .  c om
    bgMusic.setLooping(true);
    this.gameProcessor.setBGMusic(bgMusic);

    assignScoreValues();

    edynReady = gameProcessor.getAssetManager().get(AssetsUtil.SND_EDYN_READY, AssetsUtil.SOUND);
    edisonReady = gameProcessor.getAssetManager().get(AssetsUtil.SND_EDISON_READY, AssetsUtil.SOUND);

    bgGroup = new GenericGroup(0f, 0f, ViewportUtil.VP_WIDTH, ViewportUtil.VP_HEIGHT, null, Color.BLACK);
    menuGroup = new GenericGroup(0f, 0f, ViewportUtil.VP_WIDTH, ViewportUtil.VP_HEIGHT, null, Color.BLACK);
    optionsGroup = new GenericGroup(ViewportUtil.VP_WIDTH, 0f, ViewportUtil.VP_WIDTH, ViewportUtil.VP_HEIGHT,
            null, Color.BLACK);
    highScoreGroup = new GenericGroup(-1f * ViewportUtil.VP_WIDTH, 0f, ViewportUtil.VP_WIDTH,
            ViewportUtil.VP_HEIGHT, null, Color.BLACK);
    stage.addActor(bgGroup);
    stage.addActor(menuGroup);
    stage.addActor(optionsGroup);
    stage.addActor(highScoreGroup);

    TextureAtlas atlas = gameProcessor.getAssetManager().get(AssetsUtil.ANIMATION_ATLAS,
            AssetsUtil.TEXTURE_ATLAS);
    listener = new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Actor btn = event.getListenerActor();

            if (btn == startGameButton) {
                bgMusic.stop();
                clearMainButtonSettings();
                startGameButton.setChecked(true);
                if (!startUiContainer.hasDecorator(checkedMenuOptionDecorator)) {
                    startUiContainer.addDecorator(checkedMenuOptionDecorator);
                }
                gameProcessor.changeToScreen(BubbleRunnerGame.RUNNER);
            } else if (btn == optionsButton) {
                showOptionsMenu();

                //gameProcessor.changeToScreen(BubbleRunnerGame.OPTIONS);
            } else if (btn == highScoreButton) {
                showHighScoreMenu();
                //gameProcessor.changeToScreen(BubbleRunnerGame.OPTIONS);
            } else if (btn == edynSelect) {
                selectCharacter(true);
            } else if (btn == edisonSelect) {
                selectCharacter(false);
            } else if (btn == mainMenuButton) {
                showMainMenu(false);
            } else if (btn == closeScoresButton) {
                showMainMenu(true);
            }
        }
    };

    indicators = new Array<AnimatedActor>();
    assembleMenuGroup(atlas);

    assembleOptionsGroup(atlas);

    assembleHighScoreView(atlas);

    indicators.add(charIndicator);
    indicators.add(bgIndicator);
    indicators.add(sfxIndicator);
}

From source file:com.kasetagen.game.bubblerunner.screen.BubbleRunnerMenu.java

License:Creative Commons License

private void assembleMenuGroup(TextureAtlas atlas) {

    infiniteLeftDecorator = new ActorDecorator() {
        @Override/*from w  w w  .j  ava  2s.  co m*/
        public void applyAdjustment(Actor actor, float v) {
            if (actor.getRight() <= 0f) {
                actor.setPosition(actor.getX() + (actor.getWidth() * 2f), 0f);
            }
        }
    };

    checkedMenuOptionDecorator = new PulsingScaleDecorator(0.025f, 1f);

    float w = stage.getWidth();
    float h = stage.getHeight();
    //Add BG
    bgGroup.addActor(new GenericActor(0f, 0f, w, h, atlas.findRegion(AtlasUtil.ANI_TITLE_BG), Color.BLACK));

    GenericActor moon = new GenericActor(600f, 500f, MOON_WIDTH, MOON_HEIGHT,
            atlas.findRegion(AtlasUtil.ANI_TITLE_MOON), Color.YELLOW);
    moon.addDecorator(new ShakeDecorator(5f, 5f, 4f));
    moon.addDecorator(new OscillatingDecorator(5f, 10f, 2.5f));
    bgGroup.addActor(moon);
    //add Clouds5 setup
    addClouds(atlas.findRegion(AtlasUtil.ANI_TITLE_C5), -25f);

    //Add Skyline2
    bgGroup.addActor(
            new GenericActor(0f, 0f, w, h, atlas.findRegion(AtlasUtil.ANI_TITLE_SKYLINE2), Color.BLACK));

    //Add Cloud 4
    addClouds(atlas.findRegion(AtlasUtil.ANI_TITLE_C4), -25f);

    //Add Cloud 3
    addClouds(atlas.findRegion(AtlasUtil.ANI_TITLE_C3), -75f);

    //Add Skyline1
    bgGroup.addActor(
            new GenericActor(0f, 0f, w, h, atlas.findRegion(AtlasUtil.ANI_TITLE_SKYLINE1), Color.BLACK));

    //Add Title
    bgGroup.addActor(new GenericActor(150f, 25f, TITLE_WIDTH, TITLE_HEIGHT,
            atlas.findRegion(AtlasUtil.ANI_TITLE_TITLE), Color.WHITE));

    //Add Cloud 2
    addClouds(atlas.findRegion(AtlasUtil.ANI_TITLE_C2), -100);

    //Add Cloud 1
    addClouds(atlas.findRegion(AtlasUtil.ANI_TITLE_C1), -125f);

    //Add Platform
    menuGroup.addActor(
            new GenericActor(0f, 0f, w, h, atlas.findRegion(AtlasUtil.ANI_TITLE_PLATFORM), Color.BLACK));

    //Add Edison
    Animation eddyAni = new Animation(EDISON_CYCLE_RATE, atlas.findRegions(AtlasUtil.ANI_TITLE_EDISON));
    menuGroup.addActor(new AnimatedActor(0f, 0f, EDISON_WIDTH, EDISON_HEIGHT, eddyAni, 0f));
    //Add Edyn
    Animation edynAni = new Animation(EDYN_CYCLE_RATE, atlas.findRegions(AtlasUtil.ANI_TITLE_EDYN));
    menuGroup.addActor(new AnimatedActor(w - EDYN_WIDTH, 0f, EDYN_WIDTH, EDYN_HEIGHT, edynAni, 0f));

    Animation edynEyes = new Animation(EYE_CYCLE_RATE, atlas.findRegions(AtlasUtil.ANI_TITLE_EDYN_EYES));
    AnimatedActor eyes = new AnimatedActor(w - EDYN_WIDTH, 0f, EDYN_WIDTH, EDYN_HEIGHT, edynEyes, 0f);
    eyes.setIsLooping(false);
    eyes.addDecorator(new ActorDecorator() {
        private float secondsBeforeBlink = 0f;
        private float elapsedSeconds = 0f;
        private Random rand = new Random(System.currentTimeMillis());

        @Override
        public void applyAdjustment(Actor actor, float v) {
            AnimatedActor a = ((AnimatedActor) actor);

            if (a.isAnimationComplete()) {
                elapsedSeconds += v;
                if (elapsedSeconds >= secondsBeforeBlink) {
                    a.setState(AnimatedActor.DEFAULT_STATE, true);
                    elapsedSeconds = 0f;
                    secondsBeforeBlink = rand.nextInt(MAX_BLINK_INTERVAL) + MIN_BLINK_INTERVAL;
                }
            }
        }
    });

    menuGroup.addActor(eyes);

    Array<TextureAtlas.AtlasRegion> escapeImgs = atlas.findRegions(AtlasUtil.ANI_TITLE_PLAY_BTN);
    TextureRegionDrawable escapeUp = new TextureRegionDrawable(escapeImgs.get(0));
    TextureRegionDrawable escapeDown = new TextureRegionDrawable(escapeImgs.get(1));

    startGameButton = new ImageButton(escapeUp, escapeDown, escapeDown);
    startGameButton.setSize(PLAY_BTN_WIDTH, PLAY_BTN_HEIGHT);
    startGameButton.addListener(listener);
    //startGameButton.setPosition(buttonX, buttonY);
    startGameButton.setChecked(true);

    startUiContainer = new DecoratedUIContainer(startGameButton);
    startUiContainer.setSize(PLAY_BTN_WIDTH, PLAY_BTN_HEIGHT);
    startUiContainer.setPosition(buttonX, buttonY);
    startUiContainer.addDecorator(checkedMenuOptionDecorator);
    menuGroup.addActor(startUiContainer);

    Array<TextureAtlas.AtlasRegion> optionsImgs = atlas.findRegions(AtlasUtil.ANI_TITLE_OPT_BTN);
    TextureRegionDrawable optionsUp = new TextureRegionDrawable(optionsImgs.get(0));
    TextureRegionDrawable optionsDown = new TextureRegionDrawable(optionsImgs.get(1));
    optionsButton = new ImageButton(optionsUp, optionsDown, optionsDown);
    optionsButton.setSize(OPTS_BTN_WIDTH, OPTS_BTN_HEIGHT);

    //optionsButton.setPosition(buttonX, buttonY - (optionsButton.getHeight()));
    optionsButton.addListener(listener);
    optionsUiContainer = new DecoratedUIContainer(optionsButton);
    optionsUiContainer.setPosition(buttonX, buttonY - (PLAY_BTN_HEIGHT));
    optionsUiContainer.setSize(OPTS_BTN_WIDTH, OPTS_BTN_HEIGHT);
    //optUiContainer.addDecorator(checkedMenuOptionDecorator);
    menuGroup.addActor(optionsUiContainer);

    Array<TextureAtlas.AtlasRegion> hsImgs = atlas.findRegions(AtlasUtil.ANI_TITLE_HIGHSCORE_BTN);
    TextureRegionDrawable hsUp = new TextureRegionDrawable(hsImgs.get(0));
    TextureRegionDrawable hsDown = new TextureRegionDrawable(hsImgs.get(1));

    highScoreButton = new ImageButton(hsUp, hsDown, hsDown);
    highScoreButton.setSize(HS_BTN_WIDTH, HS_BTN_HEIGHT);
    highScoreButton.addListener(listener);

    highScoreUiContainer = new DecoratedUIContainer(highScoreButton);
    highScoreUiContainer.setSize(HS_BTN_WIDTH, HS_BTN_HEIGHT);
    highScoreUiContainer.setPosition(buttonX, optionsUiContainer.getY() - (PLAY_BTN_HEIGHT));
    menuGroup.addActor(highScoreUiContainer);
}

From source file:com.kasetagen.game.bubblerunner.screen.BubbleRunnerMenu.java

License:Creative Commons License

private void assembleHighScoreView(TextureAtlas atlas) {
    GenericActor highScoreScaffold = new GenericActor(0f, 0f, stage.getWidth(), stage.getHeight(),
            atlas.findRegion(AtlasUtil.ANI_HIGH_SCORE_BG), Color.BLACK);
    highScoreGroup.addActor(highScoreScaffold);

    /*//  w  w w  .  ja  va  2 s  .  co  m
     * Add Labels
     */
    Label.LabelStyle style = new Label.LabelStyle();
    style.font = gameProcessor.getAssetManager().get(AssetsUtil.NEUROPOL_64, AssetsUtil.BITMAP_FONT);
    highScoreLabel = new Label("High Score: " + UIUtil.convertIntToDigitsString(GameStats.MAX_SCORE_DIGITS, 0),
            style);
    highComboLabel = new Label("High Combo: " + UIUtil.convertIntToDigitsString(GameStats.MAX_COMBO_DIGITS, 0),
            style);
    adjustHighScores(scoreValue, comboValue);
    highScoreGroup.addActor(highScoreLabel);
    highScoreGroup.addActor(highComboLabel);

    /*
     * Add Clear Button
     */
    TextButton.TextButtonStyle tbStyle = new TextButton.TextButtonStyle();
    tbStyle.font = gameProcessor.getAssetManager().get(AssetsUtil.NEUROPOL_64, AssetsUtil.BITMAP_FONT);
    tbStyle.fontColor = Color.WHITE;
    tbStyle.downFontColor = Color.CYAN;
    float tbXPadding = 100f;
    float tbYPadding = 50f;
    clearScoresButton = new TextButton("Clear Scores", tbStyle);
    clearScoresButton.addListener(new ClickListener() {
        IDataSaver scoreClearer = new IDataSaver() {
            @Override
            public void updatePreferences(Preferences preferences) {
                preferences.putInteger(GameStats.HIGH_SCORE_KEY, 0);
                preferences.putInteger(GameStats.HIGH_COMBO_KEY, 0);
                preferences.putInteger(GameStats.MOST_MISSES_KEY, 0);
            }
        };

        @Override
        public void clicked(InputEvent event, float x, float y) {
            gameProcessor.saveGameData(scoreClearer);
            adjustHighScores(0, 0);
        }
    });
    clearScoresButton.setPosition(tbXPadding, tbYPadding);
    highScoreGroup.addActor(clearScoresButton);

    /*
    * Add Main Menu Button
    */
    Array<TextureAtlas.AtlasRegion> mmImgs = atlas.findRegions(AtlasUtil.ANI_OPTIONS_MAINMENU);
    TextureRegionDrawable mmDown = new TextureRegionDrawable(mmImgs.get(1));
    closeScoresButton = new TextButton("Main Menu", tbStyle);
    //closeScoresButton.setSize(300f, 100f);
    closeScoresButton.setPosition(highScoreGroup.getWidth() - (closeScoresButton.getWidth() + tbXPadding),
            tbYPadding);
    closeScoresButton.addListener(listener);
    highScoreGroup.addActor(closeScoresButton);
}

From source file:com.kasetagen.game.bubblerunner.screen.BubbleRunnerMenu.java

License:Creative Commons License

private void addClouds(TextureAtlas.AtlasRegion cloudRegion, float speed) {
    GenericActor c1 = new GenericActor(0f, 0f, CLOUD_WIDTH, CLOUD_HEIGHT, cloudRegion, Color.BLACK);
    c1.velocity.x = speed;/*www .  j  a v  a2  s  . co m*/
    GenericActor c2 = new GenericActor(c1.getRight(), 0f, CLOUD_WIDTH, CLOUD_HEIGHT, cloudRegion, Color.BLACK);
    c2.velocity.x = speed;
    //--Decorate
    c1.addDecorator(infiniteLeftDecorator);
    c2.addDecorator(infiniteLeftDecorator);
    bgGroup.addActor(c1);
    bgGroup.addActor(c2);
}

From source file:com.kotcrab.vis.ui.widget.color.BasicColorPicker.java

License:Apache License

protected BasicColorPicker(ColorPickerWidgetStyle style, ColorPickerListener listener,
        boolean loadExtendedShaders) {
    this.listener = listener;
    this.style = style;
    this.sizes = VisUI.getSizes();

    oldColor = new Color(Color.BLACK);
    color = new Color(Color.BLACK);

    commons = new PickerCommons(style, sizes, loadExtendedShaders);

    createColorWidgets();//from   w  w  w .  j  a va 2  s .  co m
    createUI();

    updateValuesFromCurrentColor();
    updateUI();
}

From source file:com.laststandstudio.space.Levels.Menus.MainMenu.java

License:Open Source License

public MainMenu(Game game) {
    super(game);/*from  w  w w . j a v  a  2s.  c o m*/
    SpaceShooter.mode = SpaceShooter.GameMode.MENU_MAIN;
    SpaceShooter.logger.logDebug("Main Menu: Creating Main Menu Screen");
    this.batch = new SpriteBatch();
    this.titleFont = super.loadFont("fonts/Gtek_Technology_free.ttf", (Gdx.graphics.getHeight() / 12));
    SpaceShooter.logger.logDebug("Main Menu: Creating Button Tables & Fonts");
    this.menuFont = new BitmapFont();
    this.pixmap = new Pixmap((Gdx.graphics.getWidth() / 2) - (Gdx.graphics.getWidth() / 10),
            (Gdx.graphics.getHeight() / 12), Pixmap.Format.RGB888);
    this.skin = new Skin();
    this.stage = new Stage();
    this.table = new Table();
    this.labelStyle = new Label.LabelStyle(titleFont, Color.BLACK);
    this.textButtonStyle = new TextButton.TextButtonStyle();

    skin.add("default", menuFont);
    pixmap.setColor(Color.MAROON);
    pixmap.fill();
    skin.add("background", new Texture(pixmap));

    SpaceShooter.logger.logDebug("Main Menu: Building Button Style");
    textButtonStyle.up = skin.newDrawable("background", Color.GRAY);
    textButtonStyle.down = skin.newDrawable("background", Color.DARK_GRAY);
    textButtonStyle.checked = skin.newDrawable("background", Color.DARK_GRAY);
    textButtonStyle.over = skin.newDrawable("background", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");

    skin.add("default", textButtonStyle);

    SpaceShooter.logger.logDebug("Main Menu: Building Buttons");
    this.title = new Label("space shooter", labelStyle);
    this.btnSinglePlayer = new TextButton("Single Player", skin);
    this.btnMultiplayer = new TextButton("Multiplayer", skin);
    this.btnOptions = new TextButton("Options", skin);
    this.btnTexturePacks = new TextButton("Texture Packs", skin);
    this.btnMods = new TextButton("Mods", skin);
    this.btnExit = new TextButton("Exit", skin);
}

From source file:com.luongbui.gdx.libpd.pianotest.character.PianoKey.java

License:Apache License

@Override
public void draw(Batch batch, float delta) {

    batch.end();/*from w  w w. j  ava2s  .  co  m*/

    renderer.setProjectionMatrix(batch.getProjectionMatrix());
    renderer.setTransformMatrix(batch.getTransformMatrix());
    renderer.translate(getX(), getY(), 0);

    if (isLight) {
        if (!isPressed)
            renderer.begin(ShapeType.Line);
        else
            renderer.begin(ShapeType.Filled);
    } else {
        if (isPressed)
            renderer.begin(ShapeType.Line);
        else
            renderer.begin(ShapeType.Filled);
    }

    renderer.setColor(Color.BLACK);
    renderer.rect(0, 0, getWidth(), getHeight());
    renderer.end();

    batch.begin();

}

From source file:com.lv99.board_games.reversi.Player.java

public Color getColor() {
    return this == BLACK ? Color.BLACK : Color.WHITE;
}