Example usage for com.badlogic.gdx.scenes.scene2d.utils SpriteDrawable SpriteDrawable

List of usage examples for com.badlogic.gdx.scenes.scene2d.utils SpriteDrawable SpriteDrawable

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.utils SpriteDrawable SpriteDrawable.

Prototype

public SpriteDrawable(SpriteDrawable drawable) 

Source Link

Usage

From source file:CB_UI.GL_UI.Activitys.SearchOverNameOwnerGcCode.java

License:Open Source License

private void createTitleLine() {

    float lineHeight = UI_Size_Base.that.getButtonHeight() * 0.75f;

    gsLogo = new Image(innerWidth - margin - lineHeight,
            this.getHeight() - this.getTopHeight() - lineHeight - margin, lineHeight, lineHeight, "", false);
    gsLogo.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.dayGcLiveIcon.name())));
    this.addChild(gsLogo);

    lblTitle = new Label(this.name + " lblTitle", leftBorder + margin,
            this.getHeight() - this.getTopHeight() - lineHeight - margin,
            innerWidth - (margin * 4) - gsLogo.getWidth(), lineHeight);
    lblTitle.setFont(Fonts.getBig());//from  w ww  .  jav  a2s  .  co m
    lblTitle.setWrappedText(Translation.Get("API_IMPORT_NAME_OWNER_CODE"));
    this.addChild(lblTitle);

}

From source file:CB_UI.GL_UI.Activitys.SearchOverPosition.java

License:Open Source License

private void createTitleLine() {

    float lineHeight = UI_Size_Base.that.getButtonHeight() * 0.75f;

    gsLogo = new Image(innerWidth - margin - lineHeight,
            this.getHeight() - this.getTopHeight() - lineHeight - margin, lineHeight, lineHeight, "", false);
    gsLogo.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.dayGcLiveIcon.name())));
    this.addChild(gsLogo);

    lblTitle = new Label(this.name + " lblTitle", leftBorder + margin,
            this.getHeight() - this.getTopHeight() - lineHeight - margin,
            innerWidth - (margin * 4) - gsLogo.getWidth(), lineHeight);
    lblTitle.setFont(Fonts.getBig());/*from  w w  w .ja v a  2 s .co m*/
    lblTitle.setWrappedText(Translation.Get("importCachesOverPosition"));
    this.addChild(lblTitle);

}

From source file:CB_UI.GL_UI.Controls.API_Button.java

License:Open Source License

public void setImage() {
    if (apiChk != null) {
        Drawable drw;/*w w w. jav a2  s.  c om*/

        boolean Entry = false;

        if (Config.StagingAPI.getValue()) {
            if (!Config.GcAPIStaging.getValue().equals(""))
                Entry = true;
        } else {
            if (!Config.GcAPI.getValue().equals(""))
                Entry = true;
        }

        if (Entry) {
            drw = new SpriteDrawable(Sprites.getSprite("chk-icon"));
        } else {
            drw = new SpriteDrawable(Sprites.getSprite("chk-icon-disable"));
        }

        apiChk.setDrawable(drw);
    }

}

From source file:CB_UI.GL_UI.Controls.MapInfoPanel.java

License:Open Source License

public void setCoordType(CoordType type) {
    if (CoordSymbol == null) {
        // store type in lastCoordType to be initialized later
        lastCoordType = type;/*  w w  w  .ja  v  a 2 s  . c  o  m*/
        return;
    }
    if (lastCoordType != type) {
        lastCoordType = type;
        switch (type) {
        case Cache:
            CoordSymbol.setDrawable(new SpriteDrawable(Sprites.getSprite("cache-icon")));
            break;
        case GPS:
            CoordSymbol.setDrawable(new SpriteDrawable(Sprites.getSprite("satellite")));
            break;
        case Map:
            CoordSymbol.setDrawable(new SpriteDrawable(Sprites.getSprite("map")));
            break;
        case NULL:
            CoordSymbol.setDrawable(null);
            break;
        }
    }
}

From source file:CB_UI.GL_UI.Controls.MapInfoPanel.java

License:Open Source License

@Override
protected void Initial() {
    this.removeChilds();

    setBackground(Sprites.InfoBack);/*from   ww  w .  j a va  2s.  c  o m*/

    // initial Image

    CB_RectF CompassRec = new CB_RectF(0, 0, this.getHeight(), this.getHeight());

    compass_frame = new Image(CompassRec, "Compass_Frame", false);
    compass_frame.setDrawable(Sprites.Compass.get(2));
    compass_frame.setOrigin(CompassRec.getWidth() / 2, CompassRec.getHeight() / 2);
    compass_frame.setScale(0.80f);
    this.addChild(compass_frame);

    compas_scale = new Image(CompassRec, "Compass_Scale", false);
    compas_scale.setDrawable(Sprites.Compass.get(3));
    compas_scale.setOrigin(CompassRec.getWidth() / 2, CompassRec.getHeight() / 2);
    compas_scale.setScale(0.80f);
    this.addChild(compas_scale);

    arrow = new Image(CompassRec, "Compass_Arrow", false);
    setArrowDrawable(true);
    arrow.setOrigin(CompassRec.getWidth() / 2, CompassRec.getHeight() / 2);
    arrow.setScale(0.50f);
    this.addChild(arrow);

    float margin = GL_UISizes.margin;

    lblSpeed = new Label(this.name + " lblSpeed", this.ScaleCenter(0.4f));
    lblSpeed.setFont(Fonts.getSmall());
    lblSpeed.setPos(new Vector2(CompassRec.getWidth() + margin, this.getHeight() * 0.1f));
    lblSpeed.setText("---");
    this.addChild(lblSpeed);

    lblDistance = new Label(this.name + " lblDistance", this.ScaleCenter(0.4f));
    lblDistance.setFont(Fonts.getBig());
    lblDistance.setPos(new Vector2(CompassRec.getWidth() + margin, CompassRec.getWidth() / 2));
    lblDistance.setText("---");
    this.addChild(lblDistance);

    lblLatitude = new Label(this.name + " lblLatitude", this.ScaleCenter(0.4f));
    lblLatitude.setFont(Fonts.getSmall());
    lblLatitude.setPos(
            new Vector2(this.getWidth() - lblLatitude.getWidth() - rightBorder, CompassRec.getWidth() / 2));
    lblLatitude.setText("---");
    this.addChild(lblLatitude);

    lblLongitude = new Label(this.name + " lblLongitude", this.ScaleCenter(0.4f));
    lblLongitude.setFont(Fonts.getSmall());
    lblLongitude.setPos(
            new Vector2(this.getWidth() - lblLongitude.getWidth() - rightBorder, this.getHeight() * 0.1f));
    lblLongitude.setText("---");
    this.addChild(lblLongitude);

    CoordSymbol = new Image((new CB_RectF(0, 0, this.getHeight(), this.getHeight())).ScaleCenter(0.62f),
            "CoordSymbol", false);
    CoordSymbol.setX(this.getWidth() - CoordSymbol.getWidth() - (rightBorder / 3));
    CoordSymbol.setDrawable(new SpriteDrawable(Sprites.getSprite("cache-icon")));
    this.addChild(CoordSymbol);
    CoordType tmp = lastCoordType;
    lastCoordType = CoordType.NULL;
    setCoordType(tmp);
}

From source file:CB_UI.GL_UI.Controls.MapInfoPanel.java

License:Open Source License

private void setArrowDrawable(boolean forceSet) {
    boolean tmp = Locator.UseMagneticCompass();
    if (!forceSet && tmp == lastUsedCompass)
        return;// no change required
    lastUsedCompass = tmp;/*from  w w  w.  j  a v  a2 s. c om*/
    int arrowId = 0;
    if (lastUsedCompass) {
        arrowId = 0;
    } else {
        arrowId = 2;
    }
    Sprite arrowSprite = new Sprite(Sprites.Arrows.get(arrowId));
    arrowSprite.setRotation(0);// reset rotation
    arrowSprite.setOrigin(0, 0);
    arrow.setDrawable(new SpriteDrawable(arrowSprite));
}

From source file:CB_UI.GL_UI.Controls.PopUps.SearchDialog.java

License:Open Source License

private void setFilterBtnState() {
    if (mTglBtnOnline.getState() == 0) {
        mBtnFilter.clearImage();/*from  w  w w.j a v a  2s .  c  o  m*/
        mBtnFilter.setText(Translation.Get("Filter"));
    } else {

        mBtnFilter.setImage(new SpriteDrawable(Sprites.getSprite(IconName.targetDay.name())));
        mBtnFilter.setText("");
    }
}

From source file:CB_UI.GL_UI.Main.Actions.CB_Action_ShowMap.java

License:Open Source License

private void showMapLayerMenu() {
    Menu icm = new Menu("MapViewShowLayerContextMenu");

    // Sorting (perhaps use an arraylist of layers without the overlay layers) 
    Collections.sort(ManagerBase.Manager.getLayers(), new Comparator<Layer>() {
        @Override/*from w  w  w.  j a  v  a2  s .co m*/
        public int compare(Layer layer1, Layer layer2) {
            return layer1.Name.toLowerCase().compareTo(layer2.Name.toLowerCase());
        }
    });

    int menuID = 0;
    String[] curentLayerNames = MapView.mapTileLoader.getCurrentLayer().getNames();
    for (Layer layer : ManagerBase.Manager.getLayers()) {
        if (!layer.isOverlay()) {
            MenuItem mi = icm.addItem(menuID++, "", layer.Name); // == friendlyName == FileName !!! ohne Translation
            mi.setData(layer);
            mi.setCheckable(true);

            //set icon (Online, Mapsforge or Freizeitkarte) 
            Sprite sprite = null;
            switch (layer.getMapType()) {
            case BITMAP:
                break;
            case FREIZEITKARTE:
                sprite = Sprites.getSprite(IconName.freizeit.name());
                break;
            case MAPSFORGE:
                sprite = Sprites.getSprite(IconName.mapsforge_logo.name());
                break;
            case ONLINE:
                sprite = Sprites.getSprite(IconName.download.name());
                break;
            default:
                break;
            }

            if (sprite != null)
                mi.setIcon(new SpriteDrawable(sprite));

            for (String str : curentLayerNames) {
                if (str.equals(layer.Name)) {
                    mi.setChecked(true);
                    break;
                }
            }
        }
    }

    icm.addOnClickListener(new OnClickListener() {
        @Override
        public boolean onClick(GL_View_Base v, int x, int y, int pointer, int button) {
            final Layer layer = (Layer) ((MenuItem) v).getData();

            // if curent layer a Mapsforge map, it is posible to add the selected Mapsforge map
            // to the current layer. We ask the User!
            if (MapView.mapTileLoader.getCurrentLayer().isMapsForge() && layer.isMapsForge()) {
                GL_MsgBox msgBox = GL_MsgBox.Show("add or change", "Map selection",
                        MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, new OnMsgBoxClickListener() {

                            @Override
                            public boolean onClick(int which, Object data) {

                                switch (which) {
                                case GL_MsgBox.BUTTON_POSITIVE:
                                    // add the selected map to the curent layer
                                    TabMainView.mapView.addToCurrentLayer(layer);
                                    break;
                                case GL_MsgBox.BUTTON_NEUTRAL:
                                    // switch curent layer to selected
                                    TabMainView.mapView.setCurrentLayer(layer);
                                    break;
                                default:
                                    // do nothing
                                }

                                return true;
                            }
                        });
                msgBox.button1.setText("add");
                msgBox.button2.setText("select");
                return true;
            }

            TabMainView.mapView.setCurrentLayer(layer);
            return true;
        }
    });

    icm.Show();
}

From source file:CB_UI.GL_UI.Main.Actions.QuickButton.QuickButtonItem.java

License:Open Source License

/**
 * Constructor/*from   w w w  .ja  v a  2s.  c o  m*/
 * 
 * @param Action
 *            Action Enum
 * @param Icon
 *            Action icon
 * @param Desc
 *            Action Beschreibung
 */
public QuickButtonItem(CB_RectF rec, int Index, CB_Action action, String Desc, QuickActions type) {
    super(rec, Index, action.getName());
    quickActionsEnum = type;
    mAction = action;
    mButtonIcon = new Image(rec.ScaleCenter(0.7f), "QuickListItemImage", false);
    mButtonIcon.setDrawable(new SpriteDrawable(action.getIcon()));
    mButtonIcon.setClickable(false);

    mActionDesc = Desc;

    mButton = new Button(rec, "QuickListItemButton");
    mButton.setButtonSprites(Sprites.QuickButton);
    mButton.setDraggable();
    this.addChild(mButton);
    this.addChild(mButtonIcon);

    mButton.setOnClickListener(new OnClickListener() {

        @Override
        public boolean onClick(GL_View_Base v, int x, int y, int pointer, int button) {
            mAction.CallExecute();
            return true;
        }
    });
}

From source file:CB_UI.GL_UI.Main.Actions.QuickButton.QuickButtonItem.java

License:Open Source License

@Override
protected void render(Batch batch) {
    if (childs.size() == 0) {
        this.addChild(mButton);
        this.addChild(mButtonIcon);
    }//from   w w  w  . j  a va  2  s  . co m

    super.render(batch);

    if (mAction.getId() == MenuID.AID_AUTO_RESORT) {
        if (GlobalCore.getAutoResort() && autoResortState != 1) {
            mButtonIcon.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.autoSortOnIcon.name())));
            autoResortState = 1;
        } else if (!GlobalCore.getAutoResort() && autoResortState != 0) {
            mButtonIcon.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.autoSortOffIcon.name())));
            autoResortState = 0;
        }
    } else if (mAction.getId() == MenuID.AID_SHOW_SPOILER) {
        boolean hasSpoiler = false;
        if (GlobalCore.isSetSelectedCache()) {
            hasSpoiler = GlobalCore.selectedCachehasSpoiler();
        }

        if (hasSpoiler && spoilerState != 1) {
            mButtonIcon.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.imagesIcon.name())));
            spoilerState = 1;
        } else if (!hasSpoiler && spoilerState != 0) {
            Sprite sprite = new Sprite(Sprites.getSprite(IconName.imagesIcon.name()));
            sprite.setColor(DISABLE_COLOR);
            mButtonIcon.setDrawable(new SpriteDrawable(sprite));
            spoilerState = 0;
        }
    } else if (mAction.getId() == MenuID.AID_TORCH) {

        if (PlatformConnector.isTorchOn() && torchState != 1) {
            mButtonIcon.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.TORCHON.name())));
            torchState = 1;
        } else if (!PlatformConnector.isTorchOn() && torchState != 0) {
            mButtonIcon.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.TORCHOFF.name())));
            torchState = 0;
        }
    } else if (mAction.getId() == MenuID.AID_SHOW_HINT) {

        if (mAction.getEnabled() && hintState != 1) {
            mButtonIcon.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.hintIcon.name())));
            hintState = 1;
        } else if (!mAction.getEnabled() && hintState != 0) {
            Sprite sprite = new Sprite(Sprites.getSprite(IconName.hintIcon.name()));
            sprite.setColor(DISABLE_COLOR);
            mButtonIcon.setDrawable(new SpriteDrawable(sprite));
            hintState = 0;
        }
    }
}