當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。