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


Java ImageButton.setPosition方法代码示例

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


在下文中一共展示了ImageButton.setPosition方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initButtons

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public void initButtons(int score,TextureAtlas buttonAtlas) {
    Skin buttonSkin = new Skin();
    buttonSkin.addRegions(buttonAtlas);

    //TODO FIX THIS SHIT INDENTATION
    //TODO Long-term fix the magic numbers
    ImageButton playButton = new ImageButton(buttonSkin.getDrawable("playbutton"),
    		                                                        buttonSkin.getDrawable("playbutton"));
    playButton.setSize(256, 64);
    playButton.setPosition(screenSize.width/2-playButton.getWidth()/2,
    		               screenSize.height/2-playButton.getHeight()/2+50);
    playButton.addListener(new InputListener() {

    	@Override
    	public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
    		polymorph.setScreen(new GameScreen(polymorph));
    		DeathScreenMusic.stop();
    		return true;
    	}
    });

    stage.addActor(playButton);

}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:25,代码来源:DeathScreen.java

示例2: createButtons

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
/**
 * erstelle ein Zurückbutton. um zurück zur Bilderauswahl gelangen zu können
 * rufe die Methode addListener(...) auf, füge den Button in die zweite
 * Stage
 */
private void createButtons() {
	ImageButton buttonBack = new ImageButton(new TextureRegionDrawable(
			AssetManager.getTextureRegion("ui", "backIcon")));

	buttonBack.setHeight(95);
	buttonBack.setWidth(95);

	buttonBack.setPosition(PuzzleManager.getMyXPos()
			+ getPuzzleManager().getMyWidth() - buttonBack.getWidth(),
			PuzzleManager.getMyYPos() + getPuzzleManager().getMyHeight());

	addListener(buttonBack);

	PuzzleManager.addToStage(PuzzleManager.getSecondstage(), buttonBack);

}
 
开发者ID:PhilippGrulich,项目名称:HAW-SE2-projecthorse,代码行数:22,代码来源:Puzzle.java

示例3: buildStage

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
@Override
public void buildStage() {

    // Adding actors
    Image bg = new Image(txtrBg);
    addActor(bg);

    ImageButton btnPlay = UIFactory.createButton(txtrPlay);
    // btnPlay.setPosition(getWidth() / 2, 120.f, Align.center);
    btnPlay.setPosition(getWidth() / 2, 80.f, Align.center);
    addActor(btnPlay);

    // ImageButton btnExit = UIFactory.createButton(txtrExit);
    // btnExit.setPosition(getWidth() / 2, 60.f, Align.center);
    // addActor(btnExit);

    // Setting listeners
    btnPlay.addListener( UIFactory.createListener(ScreenEnum.LEVEL_SELECT) );

    // btnExit.addListener(
    //         new InputListener() {
    //             @Override
    //             public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
    //                 Gdx.app.exit();
    //                 return false;
    //             }
    //         });
}
 
开发者ID:fr3ndyl33,项目名称:123Dor,代码行数:29,代码来源:MainMenuScreen.java

示例4: buildStage

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
@Override
public void buildStage() {

    // Adding actors
    Image bg = new Image(txtrBg);
    bg.setSize(480,360);
    addActor(bg);

    ImageButton btnBack = UIFactory.createButton(txtrBack);
    btnBack.setPosition(260.f, 40.f, Align.center);
    btnBack.setSize(50, 30);
    addActor(btnBack);

    //position is from bottom left ( x from left, y from bottom )
    ImageButton btnClassic = UIFactory.createButton(txtrClassic);
    btnClassic.setPosition(160, 200.f, Align.center);
    btnClassic.setSize(80, 50);
    addActor(btnClassic);

    ImageButton btnFirstto1 = UIFactory.createButton(txtrFirstto1);
    btnFirstto1.setPosition(160, 150.f, Align.center);
    btnFirstto1.setSize(80, 50);
    addActor(btnFirstto1);

    ImageButton btnFirstto3 = UIFactory.createButton(txtrFirstto3);
    btnFirstto3.setPosition(160, 100.f, Align.center);
    btnFirstto3.setSize(80, 50);
    addActor(btnFirstto3);

    ImageButton btnFirstto5 = UIFactory.createButton(txtrFirstto5);
    btnFirstto5.setPosition(160, 50.f, Align.center);
    btnFirstto5.setSize(80, 50);
    addActor(btnFirstto5);

    btnBack.addListener(UIFactory.createListener(ScreenEnum.MAIN_MENU));
    btnClassic.addListener( UIFactory.createListener(ScreenEnum.GAME, GameMode.GameType.CLASSIC) );
    btnFirstto1.addListener( UIFactory.createListener(ScreenEnum.GAME, GameMode.GameType.FIRST_TO_1) );
    btnFirstto3.addListener( UIFactory.createListener(ScreenEnum.GAME, GameMode.GameType.FIRST_TO_3) );
    btnFirstto5.addListener( UIFactory.createListener(ScreenEnum.GAME, GameMode.GameType.FIRST_TO_5) );
}
 
开发者ID:fr3ndyl33,项目名称:123Dor,代码行数:41,代码来源:LevelSelectScreen.java

示例5: show

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
@Override
public void show()
{
    app.camera.setToOrtho(false, Constants.V_WIDTH, Constants.V_HEIGHT);
    app.camera.update();
    player = new Player(atlas.createSprite("paddle"), app);
    String path = app.prefs.getString("BG_PATH", "images/paddlandball/bg-red.png");
    bg = new Sprite(app.assets.get(path, Texture.class));

    overlay = new Sprite(app.assets.get("images/helpScreen/helpscreen.png", Texture.class));
    overlay.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

    bUp = new SpriteDrawable(new Sprite(app.assets.get("images/backButton/back-up.png", Texture.class)));
    bDown = new SpriteDrawable(new Sprite(app.assets.get("images/backButton/back-down.png", Texture.class)));

    bUp.getSprite().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    bDown.getSprite().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

    backButton = new ImageButton(bUp, bDown);
    backButton.addListener(new ClickListener()
    {
        @Override
        public void clicked(InputEvent event, float x, float y)
        {
            backButton.remove();
            app.setScreen(new MenuScreen(app));
        }
    });
    backButton.setPosition(20, Constants.V_HEIGHT - backButton.getHeight() - 20);

    stage = new Stage(app.viewport, app.batch);

    stage.addActor(backButton);

    Gdx.input.setInputProcessor(stage);
}
 
开发者ID:NahroTo,项目名称:Teleport-Ball,代码行数:37,代码来源:HelpScreen.java

示例6: initWidget

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void initWidget() {
	//初始化界面控件
	TextureAtlas mBloodAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.PLAY_BLOOD);
	//初始化头像
	mSunAvatar = mBloodAtlas.findRegion("sunAvatar");
	//初始化血槽
	mBloodProgressBG = mBloodAtlas.findRegion("blood_border");
	mBloodProgress = mBloodAtlas.findRegion("blood");
	//初始化mp
	mMPProgressBG = mBloodAtlas.findRegion("blue_border");
	mMPProgress = mBloodAtlas.findRegion("blue");
	//初始化分数
	mScoreFont = new BitmapFont(Gdx.files.internal("font/text48.fnt"));
	mScoreFont.getData().setScale(0.8f, 1f);
	Label.LabelStyle style = new Label.LabelStyle(MyGdxGame.assetManager.getNumFont(), null);
	mScore = new Label("0", style);
	mScore.setPosition(1100, 590);
	//初始化操作杆素材
	TextureAtlas playAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.PLAY_WIDGET);
	//左行动按钮
	mLeftBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("leftBtnUp")),
			new TextureRegionDrawable(playAtlas.findRegion("leftBtnDown")));
	mLeftBtn.setPosition(100, 20);
	//右行动按钮
	mRightBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("rightBtnUp")),
			new TextureRegionDrawable(playAtlas.findRegion("rightBtnDown")));
	mRightBtn.setPosition(260, 20);
	//攻击按钮
	mAttackBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("attackBtnUp")),
			new TextureRegionDrawable(playAtlas.findRegion("attackBtnDown")));
	mAttackBtn.setPosition(1000, 35);
	//火球攻击按钮
	mBallBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("attackBallBtnUp")),
			new TextureRegionDrawable(playAtlas.findRegion("attackBallBtnDown")));
	mBallBtn.getImage().setSize(138, 138);
	mBallBtn.setPosition(850, 35);
	//Unclicked火球
	mUnclickedBallBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("attackBallBtnUnclicked")));
	mUnclickedBallBtn.getImage().setSize(138, 138);
	mUnclickedBallBtn.setPosition(850, 35);
	mUnclickedBallBtn.setVisible(false);
	//升龙斩攻击按钮
	mJumpAttackBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("attackJumpBtnUp")),
			new TextureRegionDrawable(playAtlas.findRegion("attackJumpBtnDown")));
	mJumpAttackBtn.getImage().setSize(138, 138);
	mJumpAttackBtn.setPosition(700, 35);
	//Unclicked升龙斩
	mUnclickedJumpBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("attackJumpBtnUnclicked")));
	mUnclickedJumpBtn.getImage().setSize(138, 138);
	mUnclickedJumpBtn.setPosition(700, 35);
	mUnclickedJumpBtn.setVisible(false);
	//跳跃按钮
	mJumpBtn = new ImageButton(new TextureRegionDrawable(playAtlas.findRegion("jumpBtnUp")),
			new TextureRegionDrawable(playAtlas.findRegion("jumpBtnDown")));
	mJumpBtn.setPosition(1130, 140);

	mStage.addActor(mScore);
	mStage.addActor(mLeftBtn);
	mStage.addActor(mRightBtn);
	mStage.addActor(mAttackBtn);
	mStage.addActor(mJumpBtn);
	mStage.addActor(mBallBtn);
	mStage.addActor(mUnclickedBallBtn);
	mStage.addActor(mJumpAttackBtn);
	mStage.addActor(mUnclickedJumpBtn);
}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:67,代码来源:Play.java

示例7: init

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void init() {
	//开始界面控件初始化
	mAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.START_SETTING);
	mRangeAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.RANGE_WIDGET);
	mStartBtn = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("startBtnUp")),
			new TextureRegionDrawable(mAtlas.findRegion("startBtnDown")));

	mSettingBtn = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("settingBtnUp")),
			new TextureRegionDrawable(mAtlas.findRegion("settingBtnDown")));
	mStartBtn.setSize(280, 100);
	mSettingBtn.setSize(280, 100);
	//输入姓名对话框
	mInputnameDialog = new InputnameDialog(MyGdxGame.VIEW_WIDTH / 2, MyGdxGame.VIEW_HEIGHT / 2);
	//警告对话框
	mWarningDialog = new NameWarningDialog(MyGdxGame.SCREEN_WIDTH / 2, MyGdxGame.SCREEN_HEIGHT / 2);

	//开始界面 - 排行榜
	mRangeBtn = new ImageButton(new TextureRegionDrawable(mRangeAtlas.findRegion("rangeBtnUp")),
			new TextureRegionDrawable(mRangeAtlas.findRegion("rangeBtnDown")));
	mRangeBtn.setSize(280, 100);
	//初始化排行榜对话框
	mRangeDialog = new RankingDialog(MyGdxGame.SCREEN_WIDTH / 2, MyGdxGame.SCREEN_HEIGHT / 2);

	mStartBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 20, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 20);
	mRangeBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 100);
	mSettingBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 180);

	//设置界面初始化 - 是否打开音效
	Drawable checkOn = new TextureRegionDrawable(mAtlas.findRegion("musicBtnOn"));
	Drawable checkOff = new TextureRegionDrawable(mAtlas.findRegion("musicBtnOff"));
	CheckBox.CheckBoxStyle boxStyle = new CheckBox.CheckBoxStyle(checkOff, checkOn,
			MyGdxGame.assetManager.getFont(), Color.BLUE);
	mCheckBox = new CheckBox("", boxStyle);
	mCheckBox.setSize(255, 100);
	mCheckBox.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 38, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 40);
	if (isPlay) {
		mCheckBox.setChecked(true);
	} else {
		mCheckBox.setChecked(false);
	}

	//设置界面初始化 - 关于我们
	mAboutBtn = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("aboutBtnUp")),
			new TextureRegionDrawable(mAtlas.findRegion("aboutBtnDown")));
	mAboutBtn.setSize(280, 100);
	mAboutBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 110);
	mAboutGameDialog = new AboutGameDialog(MyGdxGame.SCREEN_WIDTH / 2, MyGdxGame.SCREEN_HEIGHT / 2);

	//设置界面初始化 - 返回按钮
	mBackButton = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("backStartBtnUp")),
			new TextureRegionDrawable(mAtlas.findRegion("backStartBtnDown")));
	mBackButton.setSize(280, 100);
	mBackButton.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 180);

	//背景音乐
	if (isPlay) {
		MyGdxGame.assetManager.getMusic(Constant.START_BGM).play();
	} else {
		MyGdxGame.assetManager.getMusic(Constant.START_BGM).pause();
	}

	//初始化监听
	initListener();
}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:65,代码来源:Start.java

示例8: init

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void init() {

		//初始化标题
		switch (Play.level) {
			case 0:
				titleStr = "南天门";
				break;
			case 1:
				titleStr = "南天王殿";
				break;
			case 2:
				titleStr = "西天王殿";
				break;
			case 3:
				titleStr = "北天王殿";
				break;
			case 4:
				titleStr = "凌霄宝殿";
				break;
		}

		//初始化时间
		timeStr = Utils.changeSecondToHMS(Utils.time);

		//地点样式
		Label.LabelStyle placeStyle = new Label.LabelStyle(MyGdxGame.assetManager.getFont(), Constant.PLACE_COLOR);
		mPlaceLab = new Label(titleStr, placeStyle);
		mPlaceLab.setFontScale(1.3f);
		mPlaceLab.setPosition(390, 425);

		//时间样式
		Label.LabelStyle timeStyle = new Label.LabelStyle(MyGdxGame.assetManager.getFont(), Constant.TIME_COLOR);
		mTimeLab = new Label(timeStr, timeStyle);
		mTimeLab.setPosition(480, 365);

		//五角星与按钮
		mAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.FAILURE_WIDGET);
		mAtlasRegions = new TextureAtlas.AtlasRegion[6];
		mAtlasRegions[0] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("starOff"));
		mAtlasRegions[1] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("starOn"));
		mAtlasRegions[2] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("restartBtnUp"));
		mAtlasRegions[3] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("restartBtnDown"));
		mAtlasRegions[4] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("backBtnUp"));
		mAtlasRegions[5] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("backBtnDown"));

		//初始化返回控件
		mBackBtn = new ImageButton(new TextureRegionDrawable(mAtlasRegions[4]),
				new TextureRegionDrawable(mAtlasRegions[5]));
		mBackBtn.setSize(200, 90);
		mBackBtn.setPosition(450, 100);
		//初始化重新挑战控件
		mRestartBtn = new ImageButton(new TextureRegionDrawable(mAtlasRegions[2]),
				new TextureRegionDrawable(mAtlasRegions[3]));
		mRestartBtn.setSize(200, 90);
		mRestartBtn.setPosition(660, 100);

		//初始化背景音乐
		MyGdxGame.assetManager.getSound(Constant.FAILURE_BGM).play();

		mStage.addActor(mPlaceLab);
		mStage.addActor(mTimeLab);
		mStage.addActor(mBackBtn);
		mStage.addActor(mRestartBtn);

		initListener();
	}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:67,代码来源:Failure.java

示例9: GameScreen

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public GameScreen(AssetManager manager) {
	super("Splash", manager);
	
	// Create buttons
	mainStage = new Stage(new StretchViewport(GlobalVars.width, GlobalVars.height));
	buttonAtlas = manager.get("gfx/ui/buttons.pack", TextureAtlas.class);
	buttonSkin = new Skin(buttonAtlas);
	Gdx.input.setInputProcessor(mainStage);
	
	ImageButtonStyle imgBtnStyle = new ImageButtonStyle();
	imgBtnStyle.imageUp = buttonSkin.getDrawable("ExitButton");
	
	ImageButton exitButton = new ImageButton(imgBtnStyle);
	exitButton.setPosition(GlobalVars.width - (exitButton.getWidth() + 5f), GlobalVars.height - (exitButton.getHeight() + 5f));
	mainStage.addActor(exitButton);
	exitButton.addListener(new ChangeListener() {
		public void changed(ChangeEvent e, Actor a) {
			setNextScreen("MainMenu");
			setDone(true);
		}
	});
	
	// Setup draw stuff
	camera = new OrthographicCamera(GlobalVars.width, GlobalVars.height);
	camera.position.set(GlobalVars.width / 2, GlobalVars.height / 2, 0f);
	camera.update();
	
	batch = new SpriteBatch();
	spaceshipAtlas = manager.get("gfx/sprites/spaceships.pack", TextureAtlas.class);
	bulletAtlas = manager.get("gfx/sprites/bullets.pack", TextureAtlas.class);
	pickupAtlas = manager.get("gfx/sprites/pickups.pack", TextureAtlas.class);
	font = new BitmapFont();
	font.scale(0.01f);
	
	// Create ship
	if(GlobalVars.ship == 0) {
		player = new Player(spaceshipAtlas.findRegion("bluedestroyer"), 160, 50, 1, 1000, 250, 0.5f);
	} else if(GlobalVars.ship == 1) {
		player = new Player(spaceshipAtlas.findRegion("bluecarrier"), 160, 50, 0, 2000, 250, 0.5f);
	} else {
		player = new Player(spaceshipAtlas.findRegion("bluecruiser"), 160, 50, 0, 1000, 500, 0.5f);
	}
	// Setup enemies
	enemies = new Enemy[NUM_ENEMIES];
	for(int i = 0; i < NUM_ENEMIES; i++) { enemies[i] = null; }
	currentMaxEnemies = 1;
	currentEnemies = 0;
	// Setup bullets
	bullets = new Bullet[NUM_BULLETS];
	for(int i = 0; i < NUM_BULLETS; i++) { bullets[i] = null; }
	
	// Setup pickups
	pickup = null;
	pickupTimer = 0;
	
	rapidTimer = 0;
	speed = false;
	speedTimer = 0;
	invTimer = 0;
	
	// Setup Particle Effects
	ParticleEffect explosionEffect = new ParticleEffect();
	explosionEffect.load(Gdx.files.internal("gfx/particles/Explosion.p"), Gdx.files.internal("gfx/particles/"));
	explosionEffectPool = new ParticleEffectPool(explosionEffect, 1, 2);
	
	// Setup stars
	stars = new Star[NUM_STARS];
	for(int i = 0; i < NUM_STARS; i++) {
		RandomXS128 rand = new RandomXS128();
		stars[i] = new Star(rand.nextFloat() * GlobalVars.width, rand.nextFloat() * GlobalVars.height);
	}
	shapeRenderer = new ShapeRenderer();
	
	// Setup sound
	laserShot = Gdx.audio.newSound(Gdx.files.internal("sfx/laser5.mp3"));
	explode = Gdx.audio.newSound(Gdx.files.internal("sfx/explosion.mp3"));
}
 
开发者ID:DeathsbreedGames,项目名称:SpaceRun,代码行数:78,代码来源:GameScreen.java

示例10: init

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
@Override
public void init(){
	
	float w = this.getWidth();
	float h = this.getHeight();
	
	System.out.println(w);
	System.out.println(h);
	
	talking = new Label("???", SkinService.getSkin(), "talking");
	talking.setPosition(0, 9f/10f*h);
	
	textZone = new TextZone("", SkinService.getSkin(), new Vector2((6f/10f)*w,h));
	textZone.pack();
	
	next = new ImageButton(SkinService.getSkin(), "next");
	next.setPosition(w-next.getWidth(), h/2-next.getHeight()/2);
	
	prev = new ImageButton(SkinService.getSkin(), "prev");
	prev.setPosition(0, h/2-next.getHeight()/2);
	
	
	next.addListener(new ClickListener(){
		@Override
		public void clicked(InputEvent event, float x, float y) {
			super.clicked(event, x, y);
			if(state == ACTING){
		      if(action != null){
		    	if(!action.isFinished()){
		    		action.setFinish(true); // Go to the end of the action
		    	} 
		    	else{
		    	  state = READY;
		    	}
		      }
		    }
			else if(state == WAITING){
				state = READY;
			}
			
			// Autorise le script � continuer
			if(state == READY){
				Sequence.getScriptSync().release();
			}
		}
	});
	
}
 
开发者ID:Khopa,项目名称:OneStory_VN_Engine,代码行数:49,代码来源:NovelLayer.java

示例11: defaultApps

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void defaultApps() { // TODO automate this
    Sprite s;
    Color c = new Color(.7f, .7f, .7f, 1f);

    s = linearTextures.createSprite("console0Up");
    s.setColor(c);
    ImageButton terminal0 = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("console0Up")), new SpriteDrawable(s), window.getTerminal0());
    terminal0.setPosition(20, 20);
    desktopApps.add(terminal0);
    desktop.addActor(terminal0);

    s = linearTextures.createSprite("console1Up");
    s.setColor(c);
    ImageButton terminal1 = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("console1Up")), new SpriteDrawable(s), window.getTerminal1());
    terminal1.setPosition(60, 20);
    desktopApps.add(terminal1);
    desktop.addActor(terminal1);

    s = linearTextures.createSprite("console2Up");
    s.setColor(c);
    ImageButton terminal2 = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("console2Up")), new SpriteDrawable(s), window.getTerminal2());
    terminal2.setPosition(100, 20);
    desktopApps.add(terminal2);
    desktop.addActor(terminal2);

    s = linearTextures.createSprite("console3Up");
    s.setColor(c);
    ImageButton terminal3 = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("console3Up")), new SpriteDrawable(s), window.getTerminal3());
    terminal3.setPosition(140, 20);
    desktopApps.add(terminal3);
    desktop.addActor(terminal3);

    s = linearTextures.createSprite("infoUp");
    s.setColor(c);
    ImageButton info = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("infoUp")), new SpriteDrawable(s), window.getInfo());
    info.setPosition(40, 400);
    desktopApps.add(info);
    desktop.addActor(info);

    s = linearTextures.createSprite("shutdownUp");
    s.setColor(c);
    ImageButton shutdown = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("shutdownUp")), new SpriteDrawable(s), window.getShutdown());
    shutdown.setPosition(40, 350);
    desktopApps.add(shutdown);
    desktop.addActor(shutdown);

    s = linearTextures.createSprite("infoUp");
    s.setColor(c);
    ImageButton textEdit = new DesktopAppIcon(new TextureRegionDrawable(linearTextures.findRegion("infoUp")), new SpriteDrawable(s), window.getTextEdit());
    shutdown.setPosition(40, 300);
    desktopApps.add(textEdit);
    desktop.addActor(textEdit);
}
 
开发者ID:Rsgm,项目名称:Hakd,代码行数:54,代码来源:Desktop.java


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