当前位置: 首页>>代码示例>>Java>>正文


Java Drawable类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.Drawable的典型用法代码示例。如果您正苦于以下问题:Java Drawable类的具体用法?Java Drawable怎么用?Java Drawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Drawable类属于com.badlogic.gdx.scenes.scene2d.utils包,在下文中一共展示了Drawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _init

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
public void _init(Drawable[] textures, int depth, Vector2[] bias) {
	if (bias != null && bias.length != textures.length)
		throw new IllegalArgumentException();
	group = new Group();
	images = new Image[textures.length];
	for (int i=0; i<textures.length; i++) {
		Drawable texture = textures[i];
		Image image = new Image(texture);
		images[i] = image;
		image.setBounds(0, 0, texture.getMinWidth(), texture.getMinHeight());
		if (bias != null)
			image.setPosition(bias[i].x, bias[i].y, Align.center);
		else
			image.setPosition(0, 0, Align.center);
		group.addActor(image);
	}
	mDepth = depth;
	biases = bias;
}
 
开发者ID:cn-s3bit,项目名称:TH902,代码行数:20,代码来源:ImageGroupRenderer.java

示例2: drawStageBackground

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
@Override
protected void drawStageBackground(Batch batch, float parentAlpha, float x,
		float y, float width, float height) {
	Drawable background = getStyle().stageBackground;
	float drawableWidth = background.getMinWidth();
	float drawableHeight = background.getMinHeight();
	if (drawableWidth < width || drawableHeight < height) {
		Vector2 tempVector = MathUtil.getVector2();
		Stage stage = getStage();
		x = stage.getWidth()/2 - drawableWidth/2;
		y = stage.getHeight()/2 - drawableHeight/2;
		//stageToLocalCoordinates(tempVector.set(x, y));
		//x = tempVector.x;
		//y = tempVector.y;
		MathUtil.freeVector2(tempVector);
		width = background.getMinWidth();
		height = background.getMinHeight();
	}
	super.drawStageBackground(batch, parentAlpha, x, y, width, height);
	
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:22,代码来源:BorderedWindow.java

示例3: fillRoundedRect

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
@Override
public void fillRoundedRect(float x, float y, float w, float h, int cornerRadius) {
    Drawable drawable = getRoundedRectDrawable(cornerRadius);
    Color originalColor = null;

    ensureSpriteBatchOpen();
    if (brushType == BrushType.COLOR) {
        originalColor = spriteBatch.getColor();
        Color color = getAlphaMultiplied(colorBrush);
        spriteBatch.setColor(color);
        freeColor(color);
    }

    drawable.draw(spriteBatch, x, viewportSize.y - y - h, w, h);

    if (originalColor != null) {
        spriteBatch.setColor(originalColor);
    }
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:20,代码来源:KrLwjgl3Renderer.java

示例4: getRoundedRectDrawable

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
private Drawable getRoundedRectDrawable(int radius) {
    switch (radius) {
        case 1:
        case 2:
            return getDefaultToolkit().getSkin().getDrawable("rounded_rect_2");
        case 3:
            return getDefaultToolkit().getSkin().getDrawable("rounded_rect_3");
        case 4:
            return getDefaultToolkit().getSkin().getDrawable("rounded_rect_4");
        case 5:
            return getDefaultToolkit().getSkin().getDrawable("rounded_rect_5");
        case 6:
            return getDefaultToolkit().getSkin().getDrawable("rounded_rect_6");
        default:
            return getDefaultToolkit().getSkin().getDrawable("rounded_rect_2");
    }
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:18,代码来源:KrLwjgl3Renderer.java

示例5: stylePropertyChanged

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
@Override
public void stylePropertyChanged(StyleProperty styleProperty,
        Actor styleActor) {
    if (styleProperty.type == Drawable.class) {
        dialogFactory.showDialogDrawables(styleProperty);
    } else if (styleProperty.type == Color.class) {
        dialogFactory.showDialogColors(styleProperty);
    } else if (styleProperty.type == BitmapFont.class) {
        dialogFactory.showDialogFonts(styleProperty);
    } else if (styleProperty.type == Float.TYPE) {
        main.getUndoableManager().addUndoable(new UndoableManager.DoubleUndoable(main, styleProperty, ((Spinner) styleActor).getValue()), false);
    } else if (styleProperty.type == ScrollPaneStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == LabelStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == ListStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    }
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:20,代码来源:MainListener.java

示例6: setValue

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
public void setValue(int value) {

        if (value < 0 || value > 10) {
            throw new RuntimeException("value must between 0-10! it was:" + Integer.toString(value));
        }


        Skin skin = VisUI.getSkin();
        Drawable star1 = value >= 2 ? skin.getDrawable("star") : value >= 1 ? skin.getDrawable("star_half") : skin.getDrawable("star0");
        Drawable star2 = value >= 4 ? skin.getDrawable("star") : value >= 3 ? skin.getDrawable("star_half") : skin.getDrawable("star0");
        Drawable star3 = value >= 6 ? skin.getDrawable("star") : value >= 5 ? skin.getDrawable("star_half") : skin.getDrawable("star0");
        Drawable star4 = value >= 8 ? skin.getDrawable("star") : value >= 7 ? skin.getDrawable("star_half") : skin.getDrawable("star0");
        Drawable star5 = value == 10 ? skin.getDrawable("star") : value >= 9 ? skin.getDrawable("star_half") : skin.getDrawable("star0");

        setImage(image1, star1);
        setImage(image2, star2);
        setImage(image3, star3);
        setImage(image4, star4);
        setImage(image5, star5);
        this.invalidateHierarchy();
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:22,代码来源:Stars.java

示例7: findDrawable

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
public Drawable findDrawable(ObjectData option, String name) {

        if (option.isScale9Enable()) {// 九宫格支持
            TextureRegion textureRegion = findTextureRegion(option, name);
            NinePatch np = new NinePatch(textureRegion,
                option.getScale9OriginX(),
                textureRegion.getRegionWidth() - option.getScale9Width() - option.getScale9OriginX(),
                option.getScale9OriginY(),
                textureRegion.getRegionHeight() - option.getScale9Height() - option.getScale9OriginY());

            np.setColor(getColor(option.getCColor(), option.getAlpha()));
            return new NinePatchDrawable(np);
        }

        TextureRegion tr = findTextureRegion(option, name);

        if (tr == null) {
            return null;
        }

        return new TextureRegionDrawable(tr);
    }
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:23,代码来源:CocoStudioUIEditor.java

示例8: getFontIcon

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
private Drawable getFontIcon(FileChooser.FileItem item) {
    FileHandle fileHandle = item.getFile();
    BitmapFont bitmapFont;
    try {
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fileHandle);
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = CB.getScaledInt(50);
        parameter.characters = SkinFont.DEFAULT_CHARACTER;
        parameter.genMipMaps = true;
        parameter.minFilter = Texture.TextureFilter.MipMapNearestNearest;
        bitmapFont = generator.generateFont(parameter);
    } catch (Exception e) {
        return getImageIcon(item);
    }

    Drawable drawable = new BitmapFontDrawable(bitmapFont, item.getFile().nameWithoutExtension());
    return drawable;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:19,代码来源:FontFileIconProvider.java

示例9: ReloadCacheActivity

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
public ReloadCacheActivity() {
        super("CheckStateActivity");
        bCancel = new CharSequenceButton(Translation.get("cancel"));
        gsLogo = new Image(CB.getSkin().getIcon.GC_Live);
        lblTitle = new VisLabel(Translation.get("ReloadCacheAPI"));
        Label.LabelStyle style = new Label.LabelStyle(lblTitle.getStyle());
        style.fontColor.set(Color.WHITE);
        lblTitle.setStyle(style);
        Drawable animationDrawable = VisUI.getSkin().getDrawable("download-animation");
        workAnimation = new Image(animationDrawable);
        progressBar = new VisProgressBar(0, 100, 1, false, "default");

        createOkCancelBtn();
        setWorkAnimationVisible(false);

        this.setStageBackground(new ColorDrawable(VisUI.getSkin().getColor("dialog_background")));
//        this.setDebug(true, true);
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:19,代码来源:ReloadCacheActivity.java

示例10: parse

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
@Override
public Actor parse(CocoStudioUIEditor editor, ObjectData widget) {
    TImage image;
    Drawable tr = editor.findDrawable(widget, widget.getFileData());
    if (tr == null) {
        return new TImage();
    }

    image = new TImage(tr);

    String buttonType = widget.getButtonType();
    if (buttonType != null) {
        switch (buttonType) {
            case "ScaleButton":
                image.isButton();
                break;
            case "ColorButton":
                image.isColorButton();
                break;
            default:
                image.isNoButton();
                break;
        }
    }
    return image;
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:27,代码来源:CCTImageView.java

示例11: parseButton

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
private static void parseButton(Button button, XmlReader.Element element){
    String upPath = element.get("up");
    String downPath = element.get("down");
    String checkPath = element.get("check");
    Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(upPath))));
    Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(downPath))));
    Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(checkPath))));
    Button.ButtonStyle  buttonStyle = new Button.ButtonStyle(up,down,checked);
    button.setStyle(buttonStyle);
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:11,代码来源:XmlUtils.java

示例12: parseButton

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
public static void parseButton(VisImageButton button, XmlReader.Element element){
    String upPath = element.get("up");
    String downPath = element.get("down");
    String checkPath = element.get("check");
    Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(upPath))));
    Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(downPath))));
    Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(checkPath))));
    VisImageButton.VisImageButtonStyle buttonStyle = new VisImageButton.VisImageButtonStyle(
            up,down,checked,up,down,checked
    );
    button.setStyle(buttonStyle);
    attr2Button(button, new String[]{upPath, downPath, checkPath});
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:14,代码来源:XmlUtils.java

示例13: Initialize

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
@Override
public void Initialize(Entity entity) {
	super.Initialize(entity);
	animationDrawable.setAnimation(animationStay);
	existTime = 0;
	entity.AddComponent(mRenderer = new ImageGroupRenderer(new Drawable[] { animationDrawable, playerAnimation }, 0, null));
	mReimuWing1 = new ReimuWing(new Vector2(transform.position.x, transform.position.y + 20), 4f, mType);
	mReimuWing2 = new ReimuWing(new Vector2(transform.position.x, transform.position.y), -4f, mType);
}
 
开发者ID:cn-s3bit,项目名称:TH902,代码行数:10,代码来源:PlayerReimu.java

示例14: LogMenu

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
public LogMenu() {
  label = new Label("", new LabelStyle(Fonts.smallHUD, Color.BLACK));
  label.setWrap(true);
  Drawable background = new TextureRegionDrawable(Assets.getTextureRegion("core:hud/LogBackground.png"));
  scrollPane = new ScrollPane(label, new ScrollPaneStyle(background, null, null, null, null));
  scrollPane.setScrollingDisabled(true, false);
  back = MenuTools.getBackButton(this);
  
  stage.addActor(scrollPane);
  stage.addActor(back);
  
  refresh();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:14,代码来源:LogMenu.java

示例15: BouncingImage

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入依赖的package包/类
/** @param drawable May be null. */
public BouncingImage (Drawable drawable, Scaling scaling, int align) {
	setDrawable(drawable);
	this.scaling = scaling;
	this.align = align;
	setSize(getPrefWidth(), getPrefHeight());
               addBounce();
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:9,代码来源:BouncingImage.java


注:本文中的com.badlogic.gdx.scenes.scene2d.utils.Drawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。