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


Java InputEvent类代码示例

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


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

示例1: drag

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
@Override
public void drag(InputEvent event, float x, float y, int pointer) {
    if (pointer == -1) return;
    Actor actor = event.getListenerActor();
    actor.moveBy(x - getTouchDownX(), y - getTouchDownY());
    if (getAllActor().contains(SelectGroup.this.getParent(),false)){
        return;
    }
    for (Actor child : getAllActor()){
        if (child instanceof MainWindow){
            break;
        }else {
            child.moveBy(x-getTouchDownX(),y-getTouchDownY());
        }
    }
    Actor lastActor = selection.getLastSelected();
    if (lastActor!=null){
        EditorManager.getInstance().getEventBus().post(new AttrEvent(lastActor));
        if (getParent() instanceof MainWindow){
            MainWindow mainWindow = (MainWindow) getParent();
            if (mainWindow.getEditorLister()!=null) mainWindow.getEditorLister().change();
        }
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:25,代码来源:SelectGroup.java

示例2: clicked

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
@Override
public void clicked(InputEvent event, float x, float y) {
    if (event.getListenerActor() instanceof FileItem) {
        FileItem item = (FileItem) event.getListenerActor();
        if (getTapCount() == 2) {
            if (item.getFile().isDirectory()) {
                AssetWindow.this.load(item.getFile().path());
            } else if (item.getFile().extension().equals(Config.sceneExtension)) {
                EditorManager.getInstance().getEventBus().post(new LoadSceneEvent(item.getFile()));
            }
        }
        item.setSelected();
        fileNameLabel.setText(item.getFile().path());
    }
    super.clicked(event, x, y);
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:17,代码来源:AssetWindow.java

示例3: ObjectEditor

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
public ObjectEditor(Scene scene, String objectName) {
    this.scene = scene;

    top = new Table();
    top.add(new VisLabel(objectName)).expandX().pad(0, 20, 0, 20);

    VisTextButton deleteObject = new VisTextButton("Delete");
    deleteObject.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            hasDeleteBeenPressed = true;
            delete();
        }
    });
    top.add(deleteObject).pad(0, 20, 0, 20);

    add(top).padTop(80).colspan(4).row();

    bottom = new Table();
}
 
开发者ID:ZKasica,项目名称:Planet-Generator,代码行数:21,代码来源:ObjectEditor.java

示例4: setupRedDiceOption

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的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

示例5: setupYellowDiceOption

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的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

示例6: createSkins

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
/**
 * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
 * It also adds Listeners to the Skins' Buttons.
 *
 * @param table Table where the Skins' Labels and Buttons will be organized.
 */
private void createSkins(Table table) {
    for (int i = 0; i < game.getNumSkins(); ++i) {

        //Adding Buttons and Labels to the Arrays
        skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
        skinLabels.add(new Label("Current", skin1));

        final int j = i; //Needed for Listener initialization
        skinButtons.get(i).addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                setCurrentLabel(j);
            }
        });

        table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
    }
    table.row();

    for (int i = 0; i < game.getNumSkins(); ++i)
        table.add(skinLabels.get(i));

    initializeCurrentSkin();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:31,代码来源:CustomizeMenuScreen.java

示例7: initHUD

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
/**
 * Function used to initialize all the elements of the HUD and add the respective Listeners.
 */
private void initHUD() {
    Table hudTable = new Table();
    hudTable.setFillParent(true);

    Button pauseButton = new Button(new TextureRegionDrawable(
            new TextureRegion(game.getAssetManager().get("pause.png", Texture.class))));

    scoreText = new Label("0:00", skin);
    scoreText.setFontScale(FONT_SCALE, FONT_SCALE);

    pauseButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            model.togglePause();
        }
    });

    hudTable.top();
    hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX()
            .left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD);
    hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill()
            .padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD);

    this.addActor(hudTable);
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:29,代码来源:HudMenu.java

示例8: createAchievementButton

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
/**
 * Adds the Achievements Button to the Networking Menu.
 *
 * @param table The table to where the Achievements button will be added.
 */
private void createAchievementButton(Table table) {
    TextButton achievementsButton = new TextButton("Achievements", skin1);

    achievementsButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            gameServices.showAchievements();

        }
    });
    table.add(achievementsButton).size(BUTTON_WIDTH, DEFAULT_BUTTON_SIZE).pad(BUTTON_EDGE).row();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:18,代码来源:NetworkingMenuScreen.java

示例9: createSignInBtn

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
/**
 * Adds the Sign In / Sign Out Button to the Networking Menu.
 *
 * @param table The table to where the button will be added.
 */
private void createSignInBtn(Table table) {
    final TextButton signInButton = new TextButton(
            gameServices.isSignedIn() ? "Sign Out" : "Sign In!", skin1);

    signInButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (gameServices.isSignedIn()) {
                gameServices.signOut();
                signInButton.setText("Sign In!");
            } else {
                gameServices.signIn();
                signInButton.setText("Sign Out");
            }
        }
    });
    table.add(signInButton).size(BUTTON_WIDTH, DEFAULT_BUTTON_SIZE).pad(BUTTON_EDGE).row();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:24,代码来源:NetworkingMenuScreen.java

示例10: addBackBtn

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected TextButton addBackBtn(boolean style) {
    TextButton back = new TextButton("Back", (style ? skin2 : skin1));

    back.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new NetworkingMenuScreen(game));
        }
    });

    return back;
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:17,代码来源:LeaderboardMenuScreen.java

示例11: initBackButton

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
/**
 * Create a back button to return to the game scene
 */
private void initBackButton() {
    TextButtonSceneObject backButton;
    backButton = new TextButtonSceneObject(sceneData.createTextButton("Back", Assets.DICE_CHEATS_TEXT_BUTTON_DESCRIPTOR), null);
    backButton.setBounds(1000, 100, 500, 100);
    backButton.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {

            if (!canRoll) {
                writeRollResult(); // write roll result only now as we're done when we press back
                sceneData.sendMessageFromGui(new EvaluateDiceResultGui());
            }
        }
    });
    addSceneObject(backButton);
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:21,代码来源:DiceRollScene.java

示例12: create

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
@Override
public void create () {
    camera = new OrthographicCamera();
    camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    stage = new Stage();
    stage.addListener(new InputListener(){
        @Override
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button){

            stage.getActors().get(counter).addAction(Actions.moveTo(x-50,y-50,1));
            counter++;
            if(counter==stage.getActors().size) {
                counter=0;
            }
            return true;
        }
    });
    Gdx.input.setInputProcessor(stage);
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:20,代码来源:NoRiskNoFunDrawFigures.java

示例13: addTouchListener

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
public void addTouchListener() {
    this.addListener(new InputListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {

            if (isHighlighted()) {
                setHighlighted(false);
            } else {
                setHighlighted(true);
            }
            event.stop();
            return true;
        }
    });
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:17,代码来源:Figure.java

示例14: initImageButtons

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
private void initImageButtons() {

        if (!sceneData.isGameHost()) {
            return; // player is not hosting - don't offer the player to start the game.
        }

        imageButtonStartGame = new ImageButtonSceneObject(sceneData.createImageButton(Assets.START_GAME_BUTTON_FILENAME), buttonPressedSound);
        imageButtonStartGame.setBounds((Gdx.graphics.getWidth() / 2.0f) - 137.5f, Gdx.graphics.getHeight() / 10.0f, 275f, 240f);
        imageButtonStartGame.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                sceneData.sendMessageFromGui(new StartGameClicked());
            }
        });
        addSceneObject(imageButtonStartGame);
        imageButtonStartGame.setDisabled();
    }
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:18,代码来源:LobbyScene.java

示例15: config_loading_stage

import com.badlogic.gdx.scenes.scene2d.InputEvent; //导入依赖的package包/类
private void config_loading_stage() {
	// TODO Auto-generated method stub
	loading_stage = new Stage(managment_viewport, batch);
	loading_stage.addActor(logo_actor);
	loading_stage.addActor(loading_background_actor);
	loading_stage.addActor(loading_actor);
	loading_stage.addListener(new InputListener(){
		@Override
		public boolean keyDown(InputEvent event, int keycode) {
			// TODO Auto-generated method stub
			if(keycode == Keys.BACK){
			back_button_down();
			}
			return true;
		}
	});
}
 
开发者ID:omar6597,项目名称:alquran-alkarem,代码行数:18,代码来源:book.java


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