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


Java Touchable类代码示例

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


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

示例1: GameActor

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public GameActor(TextureRegion actor_region,float x_pos,float y_pos,Color color,float width,float height) {
actor_texture = actor_region;
xpos = x_pos ;
ypos = y_pos ;
width_ =width ;
height_ = height;
actor_Sprite = new Sprite(actor_texture);
actor_Sprite.setX(xpos);
actor_Sprite.setY(ypos);
if(color != null){   
actor_Sprite.setColor(color);}
actor_Sprite.setSize(width_, height_);
actor_Sprite.setOrigin(width_/2, height_/2);
setBounds(xpos, ypos, width_, height_);
this.setTouchable(Touchable.enabled);
}
 
开发者ID:omar6597,项目名称:alquran-alkarem,代码行数:17,代码来源:GameActor.java

示例2: setupRedDiceOption

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
private Table setupRedDiceOption(int diceNumber) {
    Table redDiceOption = new Table();
    redDiceOption.setBackground(redBackground);
    
    redDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    redDiceOption.setTouchable(Touchable.enabled); 
    redDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenRedDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenRedDice = 0;
                enableAllTouchablesRed();
            } else {
                System.out.println("choose " + diceNumber);
                chosenRedDice = diceNumber;
                disableAllTouchablesRed();
                redDiceOption.setTouchable(Touchable.enabled);
                redDiceOption.setBackground(redBackground);
            }
        }
    });
    
    return redDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例3: setupYellowDiceOption

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
private Table setupYellowDiceOption(int diceNumber) {
    Table yellowDiceOption = new Table();
    yellowDiceOption.setBackground(yellowBackground);
    
    yellowDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    yellowDiceOption.setTouchable(Touchable.enabled); 
    yellowDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenYellowDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenYellowDice = 0;
                enableAllTouchablesYellow();
            } else {
                System.out.println("choose " + diceNumber);
                chosenYellowDice = diceNumber;
                disableAllTouchablesYellow();
                yellowDiceOption.setTouchable(Touchable.enabled);
                yellowDiceOption.setBackground(yellowBackground);
            }
        }
    });
    
    return yellowDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例4: setMenuVisible

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public void setMenuVisible(boolean visible){
	if(visible)
		//always make main menu on top when it's visible
		mainMenu.setZIndex(100);
	
	for(Actor actor : getActors()){
		if(actor != mainMenu){
			if(visible)
				actor.setTouchable(Touchable.disabled);
			else
				actor.setTouchable(Touchable.enabled);
		}
		else
		{
			mainMenu.setVisible(visible);
			mainMenu.setTouchable(Touchable.enabled);
			//make the windows in screen center
			float windowX = (Gdx.graphics.getWidth() - mainMenu.getWidth())/2f;
			float windowY = (Gdx.graphics.getHeight() - mainMenu.getHeight())/2f;
			mainMenu.setPosition(windowX, windowY);
		}
	}
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:24,代码来源:UIManager.java

示例5: TabSelector

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public TabSelector(final int slotNum, Texture[] icons, final boolean isVertical, int defaultSlot) {
    if(slotNum != icons.length)
        throw new IllegalArgumentException("Icon array length needs to equal slot quantity");
    setTouchable(Touchable.enabled);
    slot = defaultSlot;
    this.slotNum = slotNum;
    this.isVertical = isVertical;
    this.icons = icons;
    selection = new Texture("theme/basic/ui/SelectionBox.png");
    addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if(isVertical)
                slot = (int)(y / (getHeight() / slotNum));
            else
                slot = (int)(x / (getWidth() / slotNum));
            return true;
        }
    });
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:21,代码来源:TabSelector.java

示例6: SlotActor

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public SlotActor(Inventory inventory, int num) {
  super(new ButtonStyle());

  Image image = new Image();
  image.setScaling(Scaling.fit);
  image.setDrawable(new SlotDrawable());
  image.setTouchable(Touchable.disabled);
  add(image);
  setSize(getPrefWidth(), getPrefHeight());

  this.inventory = inventory;
  this.num = num;

  InventoryManager.newSlot(this);
  addListener(new SlotTooltipListener(this));
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:SlotActor.java

示例7: ScrollerPane

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public ScrollerPane(TiledDrawable tiledDrawable, float xSpeed, float ySpeed) {
    this.tiledDrawable = tiledDrawable;
    this.xSpeed = xSpeed;
    this.ySpeed = ySpeed;
    xPosition = 0.0f;
    yPosition = 0.0f;
    
    Image image = new Image(tiledDrawable);
    
    innerTable = new Table();
    innerTable.add(image).width(5000);
    scrollPane = new ScrollPane(innerTable);
    scrollPane.setTouchable(Touchable.disabled);
    scrollPane.setSmoothScrolling(false);
    this.add(scrollPane).grow();
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:17,代码来源:ScrollerPane.java

示例8: disableLayers

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
/**
 * disable all the layers from this state. They no longer receive touch inputs
 * TODO: disable delta//implement pause
 * 
 * @param disable
 */
public void disableLayers(boolean disable) {
	if (disable) {
		this.setTouchable(Touchable.disabled);
		//			uiground.setTouchable(Touchable.disabled);
		//			foreground.setTouchable(Touchable.disabled);
		//			playground.setTouchable(Touchable.disabled);
		//			background.setTouchable(Touchable.disabled);
	} else {
		this.setTouchable(Touchable.enabled);
		//			uiground.setTouchable(Touchable.enabled);
		//			foreground.setTouchable(Touchable.enabled);
		//			playground.setTouchable(Touchable.enabled);
		//			background.setTouchable(Touchable.enabled);
	}
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:22,代码来源:GameState.java

示例9: setBtnDisabled

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
/**
 * 设置当前按钮的点击状态
 *
 * @param disabled true 不能点击 false 可以点击
 */
private void setBtnDisabled(boolean disabled) {
	if (isStart) {
		if (disabled) {
			mStartBtn.setTouchable(Touchable.disabled);
			mRangeBtn.setTouchable(Touchable.disabled);
			mSettingBtn.setTouchable(Touchable.disabled);
		} else {
			mStartBtn.setTouchable(Touchable.enabled);
			mRangeBtn.setTouchable(Touchable.enabled);
			mSettingBtn.setTouchable(Touchable.enabled);
		}
	} else {
		if (disabled) {
			mCheckBox.setTouchable(Touchable.disabled);
			mAboutBtn.setTouchable(Touchable.disabled);
			mBackButton.setTouchable(Touchable.disabled);
		} else {
			mCheckBox.setTouchable(Touchable.enabled);
			mAboutBtn.setTouchable(Touchable.enabled);
			mBackButton.setTouchable(Touchable.enabled);
		}
	}
}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:29,代码来源:Start.java

示例10: touchDown

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
	stage.addAction(actionLoadNextChallengeDelayed());
	choice1.setTouchable(Touchable.disabled);
	choice2.setTouchable(Touchable.disabled);
	// update card with total time it has been on display
	activeCardStats.setTotalShownTime(activeCardStats.getTotalShownTime() + currentElapsed);
	if (correct == 1) {
		choice1.addActor(imgCheckmark);
		ding();
	} else {
		choice1.addActor(imgXmark);
		if (activeCardStats.isCorrect()) {
			activeCardStats.pimsleurSlotDec();
			activeCardStats.triesRemainingInc();
			activeCardStats.setCorrect(false);
		}
		buzz();
	}
	return true;
}
 
开发者ID:CherokeeLanguage,项目名称:cll1-gdx,代码行数:21,代码来源:LearningSession.java

示例11: load

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
private void load(){
        tooltip = new LevelTooltip(this, GDefence.getInstance().assetLoader.get("skins/uiskin.json", Skin.class));
        tooltip.setTouchable(Touchable.disabled);
        //CampainMap.getStage().addActor(tooltip);
//        GDefence.getInstance().getCampainMap().getStage().addActor(tooltip);
        addListener(new TooltipListener(tooltip, true));


        addListener(new InputListener() {
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                if (!isLocked()) {
                    GDefence.getInstance().getLevelPreparationScreen().setLevel(number);
                    GDefence.getInstance().switchScreen(GDefence.getInstance().getLevelPreparationScreen());
                }
                return true;
            }
        });



    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:22,代码来源:LevelButton.java

示例12: setReadyIcon

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
public void setReadyIcon() {
    //Ready , set icon on render Thread
    Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run() {
            if (hasWarn() || hasError()) {
                if (hasError()) {
                    Image errorImage = new Image(game.skin.getRegion("error"));
                    ValidationTask.this.cell.setActor(errorImage);
                } else {
                    Image warnImage = new Image(game.skin.getRegion("warn"));
                    ValidationTask.this.cell.setActor(warnImage);
                }
            } else {
                Image readyImage = new Image(game.skin.getRegion("valid"));
                ValidationTask.this.cell.setActor(readyImage);
            }
            ValidationTask.this.cell.getActor().addListener(clickListener);
            ValidationTask.this.cell.getActor().setTouchable(Touchable.enabled);
            Gdx.graphics.requestRendering();
        }
    });
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:24,代码来源:ValidationTask.java

示例13: place

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
private void place(Creature creature, int x, int y) {
    WorldObjectView spawnView = dieToIconToSpawn.get(creature.description);
    placed.add(creature);
    refreshStartButton();
    world.add(x, y, creature);
    WorldObjectView worldView = world.getController(ViewController.class).getView(creature);
    EventListener listener = createMoveSpawnedListener(creature, worldView, spawnView);
    EventListener prev = moveListeners.remove(worldView);
    if (prev != null) {
        worldView.removeListener(prev);
    }
    moveListeners.put(worldView, listener);
    worldView.addListener(listener);
    spawnView.getColor().a = 0f;
    spawnView.setTouchable(Touchable.disabled);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:17,代码来源:SpawnController.java

示例14: initialize

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
@Override protected void initialize() {
    Table table = new Table(Config.skin);
    table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background"));

    label = new LocLabel("", DieMessageWindow.ACTIVE);
    label.setWrap(true);
    label.setAlignment(Align.center);

    table.setTouchable(Touchable.disabled);

    Label tapToContinue = new LocLabel("tap-to-continue", DieMessageWindow.INACTIVE);
    tapToContinue.setWrap(true);
    tapToContinue.setAlignment(Align.center);

    if (image != null) {
        image.setTouchable(Touchable.disabled);
        table.add(image).padTop(-15 - dy).row();
    }
    final Cell<LocLabel> cell = table.add(label).width(100);
    if (forceLabelHeight) cell.height(labelHeight);
    cell.row();
    table.add(new Image(Config.skin, "ui-tutorial-window-line")).padTop(4).row();
    table.add(tapToContinue).width(80).row();

    this.table.add(table);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:27,代码来源:TutorialMessageWindow.java

示例15: initialize

import com.badlogic.gdx.scenes.scene2d.Touchable; //导入依赖的package包/类
@Override protected void initialize() {
    Table table = new Table(Config.skin);
    table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background"));
    label = new LocLabel("", ACTIVE);
    label.setWrap(true);
    label.setAlignment(Align.center);

    table.setTouchable(Touchable.disabled);

    Label tapToContinue = new LocLabel("tap-to-continue", INACTIVE);
    tapToContinue.setWrap(true);
    tapToContinue.setAlignment(Align.center);

    table.add(imageTable).padTop(6).row();
    table.add(label).width(100).row();
    table.add(new Image(Config.skin, "ui-tutorial-window-line")).padTop(4).row();
    table.add(tapToContinue).width(80).row();

    this.table.add(table);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:21,代码来源:DieMessageWindow.java


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