com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CocoStudioUIEditor.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
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);
    }
 
Example #2
Source File: TextureDropModuleWrapper.java    From talos with Apache License 2.0 6 votes vote down vote up
@Override
public void read(Json json, JsonValue jsonData) {
    super.read(json, jsonData);

    filePath = jsonData.getString("filePath", null);
    regionName = jsonData.getString("regionName", null);

    // hack for older version to patch broken files (we should do version transition logic and move it there later)
    if(jsonData.has("fileName")) {
        filePath = jsonData.getString("fileName");
        regionName = filePath;
        if(filePath.contains(".")) {
            regionName =  regionName.substring(0, regionName.lastIndexOf("."));
        } else {
            filePath = filePath + ".png";
        }
    }

    final TalosAssetProvider assetProvider = TalosMain.Instance().TalosProject().getProjectAssetProvider();
    final Sprite textureRegion = assetProvider.findAsset(regionName, Sprite.class);

    setModuleRegion(regionName, textureRegion);
    dropWidget.setDrawable(new TextureRegionDrawable(textureRegion));
}
 
Example #3
Source File: GLTFDemoUI.java    From gdx-gltf with Apache License 2.0 6 votes vote down vote up
public void setEntry(ModelEntry entry, FileHandle rootFolder) 
{
	variantSelector.setSelected(null);
	Array<String> variants = entry.variants.keys().toArray(new Array<String>());
	variants.insert(0, "");
	variantSelector.setItems(variants);
	
	if(entry.variants.size == 1){
		variantSelector.setSelectedIndex(1);
	}else{
		variantSelector.setSelectedIndex(0);
	}
	
	
	if(screenshotsTable.getChildren().size > 0){
		Image imgScreenshot = (Image)screenshotsTable.getChildren().first();
		((TextureRegionDrawable)imgScreenshot.getDrawable()).getRegion().getTexture().dispose();
	}
	screenshotsTable.clear();
}
 
Example #4
Source File: HeaderPanel.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public void toggleCollapse() {
		if (collapsable) {
			if (contentCell.getActor() != null) {
//			if (this.content.isVisible()) {
//				this.content.setVisible(false);
				this.contentCell.clearActor();
				invalidateHierarchy();

				collapseImg.setDrawable(new TextureRegionDrawable(Ctx.assetManager.getIcon("ic_closed")));
			} else {
				this.contentCell.setActor(content);	
//				this.content.setVisible(true);				
				invalidateHierarchy();

				collapseImg.setDrawable(new TextureRegionDrawable(Ctx.assetManager.getIcon("ic_open")));
			}
		}
	}
 
Example #5
Source File: EditToolbar.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public void addToolBarButton(ImageButton button, String icon, String text, String tooltip) {
	
	TextureRegion image = Ctx.assetManager.getIcon(icon);
	TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");
	
	ImageButtonStyle style = new ImageButtonStyle(skin.get("plain", ButtonStyle.class));
	style.imageUp = new TextureRegionDrawable(image);
	
	if(imageDisabled != null)
		style.imageDisabled = new TextureRegionDrawable(imageDisabled);
	button.setStyle(style);
	button.pad(6,3,6,3);
       addActor(button);
       button.setDisabled(true);
       TextTooltip t = new TextTooltip(tooltip, skin);
	button.addListener(t);
}
 
Example #6
Source File: ProjectToolbar.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
private void addToolBarButton(Skin skin, ImageButton button, String icon, String text, String tooltip) {
	ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
	TextureRegion image = Ctx.assetManager.getIcon(icon);
	style.imageUp = new TextureRegionDrawable(image);

	try {
		TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");

		if (imageDisabled != null)
			style.imageDisabled = new TextureRegionDrawable(imageDisabled);
	} catch (Exception e) {

	}

	button.setStyle(style);
	// button.row();
	// button.add(new Label(text, skin));

	add(button);
	button.setDisabled(true);
	TextTooltip t = new TextTooltip(tooltip, skin);
	button.addListener(t);
}
 
Example #7
Source File: GameStage.java    From GdxDemo3D with Apache License 2.0 6 votes vote down vote up
public LayerController(TextureAtlas buttonAtlas) {
	Slider.SliderStyle sliderStyle = new Slider.SliderStyle();
	sliderStyle.knob = new TextureRegionDrawable(buttonAtlas.findRegion("slider-knob-up"));
	sliderStyle.knobDown = new TextureRegionDrawable(buttonAtlas.findRegion("slider-knob-down"));
	sliderStyle.knobOver = new TextureRegionDrawable(buttonAtlas.findRegion("slider-knob-down"));
	sliderStyle.background = new TextureRegionDrawable(buttonAtlas.findRegion("slider-background"));

	slider = new Slider(minLayer, maxLayer, 1, true, sliderStyle);
	slider.setValue(maxLayer);
	slider.setAnimateDuration(0.1f);

	slider.addCaptureListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			setLayer((int) slider.getValue());
		}
	});
	add(slider).height(300);
}
 
Example #8
Source File: HotkeyButton.java    From riiablo with Apache License 2.0 6 votes vote down vote up
public HotkeyButton(final DC dc, final int index, int skillId, Stat chargedSkill) {
  super(new ButtonStyle() {{
    up       = new TextureRegionDrawable(dc.getTexture(index));
    down     = new TextureRegionDrawable(dc.getTexture(index + 1));
    disabled = up;
    pressedOffsetX = pressedOffsetY = -2;
  }});

  this.skillId = skillId;
  this.chargedSkill = chargedSkill;
  add(hotkey = new Label("", Riiablo.fonts.font16, Riiablo.colors.gold)).align(Align.topRight);
  row();
  add().grow();
  row();
  add(charges = new Label(chargedSkill != null ? Integer.toString(chargedSkill.value1()) : "", Riiablo.fonts.font16, Riiablo.colors.blue)).align(Align.bottomLeft);
  pad(2);
  pack();

  setDisabledBlendMode(BlendMode.DARKEN, Riiablo.colors.darkenRed);
}
 
Example #9
Source File: GameSpeedController.java    From GdxDemo3D with Apache License 2.0 6 votes vote down vote up
public GameSpeedController(TextureAtlas buttonAtlas) {
	btnPauseStyle = new ImageButton.ImageButtonStyle();
	btnPauseStyle.up = new TextureRegionDrawable(buttonAtlas.findRegion("pause-up"));
	btnPauseStyle.down = new TextureRegionDrawable(buttonAtlas.findRegion("pause-down"));

	btnPlayStyle = new ImageButton.ImageButtonStyle();
	btnPlayStyle.up = new TextureRegionDrawable(buttonAtlas.findRegion("play-up"));
	btnPlayStyle.down = new TextureRegionDrawable(buttonAtlas.findRegion("play-down"));

	btnSlowStyle = new ImageButton.ImageButtonStyle();
	btnSlowStyle.up = new TextureRegionDrawable(buttonAtlas.findRegion("slow-up"));
	btnSlowStyle.down = new TextureRegionDrawable(buttonAtlas.findRegion("slow-down"));

	imageButton = new ImageButton(btnPauseStyle);

	add(imageButton);

	imageButton.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			setGameSpeed();
			event.cancel();
		}
	});
}
 
Example #10
Source File: SelectScreen.java    From Unlucky with MIT License 6 votes vote down vote up
/**
 * Handles the position and events of the exit button
 */
protected void handleExitButton(final Screen screen) {
    // init exit button
    ImageButton.ImageButtonStyle style = new ImageButton.ImageButtonStyle();
    style.imageUp = new TextureRegionDrawable(rm.menuExitButton[0][0]);
    style.imageDown = new TextureRegionDrawable(rm.menuExitButton[1][0]);
    exitButton = new ImageButton(style);
    exitButton.setSize(18, 18);
    exitButton.setPosition(177, 99);
    stage.addActor(exitButton);

    // fade back to previous screen
    exitButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (!game.player.settings.muteSfx) rm.buttonclick0.play(game.player.settings.sfxVolume);
            game.menuScreen.transitionIn = 0;
            setFadeScreen(screen);
        }
    });
}
 
Example #11
Source File: SourceImage.java    From gdx-texture-packer-gui with Apache License 2.0 6 votes vote down vote up
@Override
protected void setStage(Stage stage) {
    super.setStage(stage);

    if (!initialized && stage != null) {
        initialized = true;
        texture = new Texture(pixmap);
        image.setDrawable(new TextureRegionDrawable(new TextureRegion(texture)));
    }
    if (initialized && stage == null) {
        initialized = false;
        texture.dispose();
        texture = null;
        image.setDrawable(null);
    }
}
 
Example #12
Source File: CCSliderTest.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
@Test
@NeedGL
public void shouldParseSliderBar() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("slideBar/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    Slider slider = group.findActor("Slider_1");
    assertThat(slider.getWidth(), is(200f));
    assertThat(slider.getHeight(), is(14f));
    assertThat(slider.getValue(), is(50f));
    Slider.SliderStyle style = slider.getStyle();
    assertThat(style.knob, instanceOf(TextureRegionDrawable.class));
    assertThat(style.background, instanceOf(TextureRegionDrawable.class));
    assertThat(style.knobBefore, instanceOf(TextureRegionDrawable.class));
    //assertThat(style.disabledKnob, instanceOf(TextureRegionDrawable.class));
   // assertThat(style.knobDown, instanceOf(TextureRegionDrawable.class));
}
 
Example #13
Source File: PreviewWidget.java    From talos with Apache License 2.0 6 votes vote down vote up
public void addPreviewImage (String[] paths) {
    if (paths.length == 1) {

        String resourcePath = paths[0];
        FileHandle fileHandle = Gdx.files.absolute(resourcePath);

        final String extension = fileHandle.extension();

        if (extension.endsWith("png") || extension.endsWith("jpg")) {
            fileHandle = TalosMain.Instance().ProjectController().findFile(fileHandle);
            if(fileHandle != null && fileHandle.exists()) {
                final TextureRegion textureRegion = new TextureRegion(new Texture(fileHandle));

                if (textureRegion != null) {
                    previewImage.setDrawable(new TextureRegionDrawable(textureRegion));
                    previewController.setImageWidth(10);

                    backgroundImagePath = fileHandle.path();

                    TalosMain.Instance().ProjectController().setDirty();
                }
            }
        }
    }
}
 
Example #14
Source File: MPQViewer.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
public void dispose() {
  if (backgroundTexture != null) backgroundTexture.dispose();
  if (drawable instanceof Disposable) ((Disposable) drawable).dispose();
  else if (drawable instanceof TextureRegionDrawable)
    ((TextureRegionDrawable) drawable).getRegion().getTexture().dispose();
}
 
Example #15
Source File: GameScreen.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public void create() {
    if (created) return;
    created = true;

    isDebug = DEBUG && Gdx.app.getType() == Application.ApplicationType.Desktop;

    if (DEBUG_TOUCHPAD || Gdx.app.getType() == Application.ApplicationType.Android) {
      touchpad = new Touchpad(10, new Touchpad.TouchpadStyle() {{
        //background = new TextureRegionDrawable(Riiablo.assets.get(touchpadBackgroundDescriptor));
        background = null;
        knob = new TextureRegionDrawable(Riiablo.assets.get(touchpadKnobDescriptor));
      }});
      touchpad.setSize(164, 164);
      touchpad.setPosition(0, mobilePanel != null ? mobilePanel.getHeight() : 0);
      stage.addActor(touchpad);
      if (!DEBUG_TOUCHPAD) touchpad.toBack();
    }

    // TODO: sort children based on custom indexes
    controlPanel.toFront();
    output.toFront();
    if (mobilePanel != null) mobilePanel.toFront();
//  if (mobileControls != null) mobileControls.toFront();
    if (touchpad != null) touchpad.toBack();
    input.toFront();
    escapePanel.toFront();

    if (Gdx.app.getType() == Application.ApplicationType.Android
     || Riiablo.defaultViewport.getWorldHeight() == Riiablo.MOBILE_VIEWPORT_HEIGHT) {
      renderer.zoom(Riiablo.MOBILE_VIEWPORT_HEIGHT / (float) Gdx.graphics.getHeight());
    } else {
      renderer.zoom(Riiablo.DESKTOP_VIEWPORT_HEIGHT / (float) Gdx.graphics.getHeight());
    }
    renderer.resize();
  }
 
Example #16
Source File: SplashMenu.java    From Cubes with MIT License 5 votes vote down vote up
public SplashMenu() {
  logo = new Image(new TextureRegionDrawable(Assets.getTextureRegion("core:logo.png")), Scaling.fillY, Align.center);
  text = new Label("Loading " + Branding.DEBUG, new Label.LabelStyle(Fonts.smallHUD, Color.WHITE));

  stage.addActor(logo);
  stage.addActor(text);
}
 
Example #17
Source File: SlotActor.java    From libgdx-utils with MIT License 5 votes vote down vote up
private static ImageButtonStyle createStyle(Skin skin, Slot slot) {
	TextureAtlas icons = LibgdxUtils.assets.get("icons/icons.atlas", TextureAtlas.class);
	TextureRegion image;
	if (slot.getItem() != null) {
		image = icons.findRegion(slot.getItem().getTextureRegion());
	} else {
		image = icons.findRegion("nothing");
	}
	ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
	style.imageUp = new TextureRegionDrawable(image);
	style.imageDown = new TextureRegionDrawable(image);

	return style;
}
 
Example #18
Source File: Droid.java    From flopsydroid with Apache License 2.0 5 votes vote down vote up
@Override
public void act(float delta) {
    super.act(delta);

    if (mDead) {
        return;
    }

    // Update Andy's animation frame
    mDuration += delta;
    mCurrentFrame = mAnimation.getKeyFrame(mDuration, true);
    setDrawable(new TextureRegionDrawable(mCurrentFrame));
}
 
Example #19
Source File: HeaderPanel.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
public void setCollapsable(boolean c) {
	collapsable = c;

	if (c) {
		collapseImg.setDrawable(new TextureRegionDrawable(Ctx.assetManager.getIcon("ic_open")));
	} else
		collapseImg.setDrawable(null);
}
 
Example #20
Source File: EditSceneDialog.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
private void showBgImage(String r) {
	if (atlas == null || r == null)
		return;

	bgImage.setDrawable(new TextureRegionDrawable(atlas.findRegion(r)));

	infoContainer.prefWidth(250);
	infoContainer.prefHeight(250);
	setInfoWidget(infoContainer);
}
 
Example #21
Source File: GameStage.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
CharacterButton(HumanState state, TextureAtlas buttonAtlas, String up, String down, String checked) {
	super(new TextureRegionDrawable(buttonAtlas.findRegion(up)),
			new TextureRegionDrawable(buttonAtlas.findRegion(down)),
			new TextureRegionDrawable(buttonAtlas.findRegion(checked)));
	this.state = state;
	this.addListener(new ClickListener() {
		@Override
		public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
			if (!CharacterButton.this.isChecked()) {
				if (selectedCharacter instanceof HumanCharacter) {
					HumanCharacter human = (HumanCharacter) selectedCharacter;
					if (CharacterButton.this.state.isMovementState()) {
						HumanState hs = human.stateMachine.getCurrentState();
						if (hs.isMovementState()) {
							human.handleStateCommand(CharacterButton.this.state);
						} else {
							human.moveState = CharacterButton.this.state;
							human.handleStateCommand(CharacterButton.this.state.idleState);
						}
					} else {
						human.handleStateCommand(CharacterButton.this.state);
					}
				}
			}
			return true;
		}
	});
}
 
Example #22
Source File: LogMenu.java    From Cubes with MIT License 5 votes vote down vote up
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();
}
 
Example #23
Source File: CraftingScreen.java    From TerraLegion with MIT License 5 votes vote down vote up
@Override
public void create() {
	camera = new OrthoCamera();
	camera.resize();

	stageSb = new SpriteBatch();
	stage = new Stage(new StretchViewport(Settings.getWidth(), Settings.getHeight()), stageSb);

	//CATEGORY BUTTONS
	stage.addActor(toolCategoryBtn.getImageButton());
	stage.addActor(furnitureCategoryBtn.getImageButton());

	ScrollPane.ScrollPaneStyle paneStyle = new ScrollPane.ScrollPaneStyle();
	paneStyle.background = new TextureRegionDrawable(new TextureRegion(ResourceManager.getInstance().getTexture("invStageBg")));
	//paneStyle.vScrollKnob = new TextureRegionDrawable();
	//paneStyle.hScroll = paneStyle.hScrollKnob = paneStyle.vScroll = paneStyle.vScrollKnob;

	Table craftingContainer = CachePool.getTable();
	usedTablesCache.add(craftingContainer);
	float startX = (Settings.getWidth() / 2) - 255;
	craftingContainer.setBounds(startX, 0, 370, Settings.getHeight() - 61);

	craftingTable = CachePool.getTable();
	stage.addListener(new CraftingButtonClickListener(stage, craftingTable, craftingContainer.getX(), craftingContainer.getY()));
	usedTablesCache.add(craftingTable);

	pane = new ScrollPane(craftingTable, paneStyle);
	craftingContainer.add(pane).width(370).height(Settings.getHeight() - 61);
	craftingContainer.row();
	stage.addActor(craftingContainer);

	itemNameLabel = new Label("", ResourceManager.getInstance().getFont("font"), startX + 370 + 10, Settings.getHeight() - 61 - 35, false);
	itemInfoLabel = new MultilineLabel("", ResourceManager.getInstance().getFont("font"), startX + 370 + 10, Settings.getHeight() - 61 - 85, false);

	populateCraftableItems(toolCategoryBtn.getCategory());

	InputController.getInstance().addInputProcessor(stage);
}
 
Example #24
Source File: Skin.java    From gdx-skineditor with Apache License 2.0 5 votes vote down vote up
/** Returns a copy of the specified drawable. */
public Drawable newDrawable(Drawable drawable) {
	if (drawable instanceof TextureRegionDrawable)
		return new TextureRegionDrawable((TextureRegionDrawable) drawable);
	if (drawable instanceof NinePatchDrawable)
		return new NinePatchDrawable((NinePatchDrawable) drawable);
	if (drawable instanceof SpriteDrawable)
		return new SpriteDrawable((SpriteDrawable) drawable);
	throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass());
}
 
Example #25
Source File: TSlider.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
@Override
public void draw(Batch batch, float parentAlpha) {
    //现在只写了横着的
    float position = 0;
    if (getMinValue() != getMaxValue()) {
        float knobWidthHalf = 0;
        float positionWidth = getWidth();
        float knobWidth = getStyle().knob == null ? 0 : getStyle().knob.getMinWidth();
        float bgLeftWidth = 0;
        if (getStyle().background != null) {
            bgLeftWidth = getStyle().background.getLeftWidth();
            positionWidth -= bgLeftWidth + getStyle().background.getRightWidth();
        }
        if (getStyle().knob == null) {
            knobWidthHalf = getStyle().knobBefore == null ? 0 : getStyle().knobBefore.getMinWidth() * 0.5f;
            position = (positionWidth - knobWidthHalf) * getVisualPercent();
            position = Math.min(positionWidth - knobWidthHalf, position);
        } else {
            knobWidthHalf = knobWidth * 0.5f;
            position = (positionWidth - knobWidth) * getVisualPercent();
            position = Math.min(positionWidth - knobWidth, position) + bgLeftWidth;
        }
        position = Math.max(0, position);
    }
    ((TextureRegionDrawable) getStyle().knobBefore).getRegion().setRegionWidth(
        (int) (position + (getKnobDrawable() == null ? 0 : getKnobDrawable().getMinWidth()) * 0.5f));
    super.draw(batch, parentAlpha);
}
 
Example #26
Source File: TSlider.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
public TSlider(
    float min,
    float max,
    float stepSize,
    boolean vertical,
    TextureRegion background,
    TextureRegion knob,
    TextureRegion knobBefore) {
    super(min, max, stepSize, vertical, new SliderStyle(new TextureRegionDrawable(background), new TextureRegionDrawable(knob)));
    this.getStyle().knobBefore = new TextureRegionDrawable(knobBefore);
}
 
Example #27
Source File: TImage.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
@Override
public void act(float delta) {
    if (animation != null && isPlaying) {
        ((TextureRegionDrawable) getDrawable()).setRegion((TextureRegion) animation.getKeyFrame(stateTime += delta, true));
    }
    super.act(delta);
}
 
Example #28
Source File: TImage.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
public void isAnimate(Animation ani) {
    if (ani == null) {
        return;
    }
    this.animation = ani;
    isAnimate = true;
    ((TextureRegionDrawable) getDrawable()).setRegion((TextureRegion) animation.getKeyFrame(0));
}
 
Example #29
Source File: MainMenuInterface.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
private void setUpSkin() {
	Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
	pixmap.setColor(Color.LIGHT_GRAY);
	pixmap.fill();
	skin.add("grey", new Texture(pixmap));
	titleSprite.setX(TITLE_SPRITE_POS_X);
	titleSprite.setY(TITLE_SPRITE_POS_Y);

	LabelStyle labelStyle = new LabelStyle();
	skin.add("default", finePrint);
	labelStyle.font = skin.getFont("default");
	skin.add("default", labelStyle);

	CheckBoxStyle checkBoxStyle = new CheckBoxStyle();
	checkBoxStyle.checkboxOff = skin.newDrawable("grey", Color.LIGHT_GRAY);
	checkBoxStyle.checkboxOn = skin.newDrawable("grey", Color.LIGHT_GRAY);
	checkBoxStyle.font = skin.getFont("default");
	checkBoxStyle.checkboxOff = new TextureRegionDrawable(unchecked);
	checkBoxStyle.checkboxOn = new TextureRegionDrawable(checked);
	skin.add("default", checkBoxStyle);

	SliderStyle sliderStyle = new SliderStyle();
	sliderStyle.background = new TextureRegionDrawable(background);
	sliderStyle.knob = new TextureRegionDrawable(knob);
	skin.add("default-horizontal", sliderStyle);

	ButtonStyle buttonStyle = new ButtonStyle();
	skin.add("default", buttonStyle);

	TextButtonStyle textButtonStyle = new TextButtonStyle();
	textButtonStyle.font = skin.getFont("default");
	textButtonStyle.up = new NinePatchDrawable(patchBox);
	skin.add("default", textButtonStyle);
}
 
Example #30
Source File: TImage.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
public TImage(String path) {
    Texture texture = new Texture(path);
    texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    setDrawable(new TextureRegionDrawable(new TextureRegion(texture)));
    setSize(texture.getWidth(), texture.getHeight());
    init();
}