本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener类的典型用法代码示例。如果您正苦于以下问题:Java ActorGestureListener类的具体用法?Java ActorGestureListener怎么用?Java ActorGestureListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActorGestureListener类属于com.badlogic.gdx.scenes.scene2d.utils包,在下文中一共展示了ActorGestureListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMinimizeListener
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
private EventListener createMinimizeListener(final Die die, final Iterable<Die> dice) {
return new ActorGestureListener(){
@Override public void tap(InputEvent event, float x, float y, int count, int button) {
for (Die check : dice) {
DiePane pane = map.get(check);
if (pane == null)
continue;
if (check == die) {
pane.setMinimized(!pane.isMinimized());
} else {
pane.setMinimized(true);
}
}
}
};
}
示例2: setUpGameScreenMenu
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
/**
* Sets the up game screen menu.
*
* @param gameScreen the new up game screen menu
*/
public void setUpGameScreenMenu(final MAGameScreen gameScreen) {
btnPlayStop = MenuCreator.createCustomToggleButton(null,
GameAssets.pause, GameAssets.pause, false, PAUSE_SIZE, PAUSE_SIZE,
true);
btnPlayStop.setPosition(gameScreen.getStage().getWidth() - btnPlayStop.getWidth(),
gameScreen.getStage().getHeight() - btnPlayStop.getHeight());
btnPlayStop.addListener(new ActorGestureListener() {
@Override
public void touchUp(InputEvent event, float x, float y,
int pointer, int button) {
super.touchUp(event, x, y, pointer, button);
//
btnPlayStop.setToggleSwitch();
//
if(btnPlayStop.isToggleActive()){
gameScreen.game_manager.setGameState(GameState.GAME_PAUSED);
showPauseTable(gameScreen);
}
}
});
//
gameScreen.getStage().addActor(btnPlayStop);
}
示例3: SorahTab
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public SorahTab(final int sorah_no) {
this.add(new GozaName(sorah_no)).width(/*sorah_name_width+sorah_tab_book_mark_width*3+tab_no_width*/tab_width).height(tab_height);
this.add(new MakeMadany(sorah_no));
for (int i=1 ;i<=3 ;i++ )
{
this.add(new BookMarks(sorah_no , i));
}
this.add(new Ayat(sorah_no)) ;
this.addListener(new ActorGestureListener(){
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
// TODO Auto-generated method stub
super.tap(event, x, y, count, button);
book.stage_detector=Stages.pages ;
book.config_input_prossesor(Stages.pages);
book.current_page = surah_page[sorah_no-1] ;
book.pages_stage.draw();
book.pages_draw_stage.draw();
book.pages_stage.act(Gdx.graphics.getDeltaTime());
book.pages_scroll_pane.setScrollY((book.current_page-1)*book.screen_height );
book.snab_to =((book.current_page-1)*book.screen_height ) ;
book.update_saved_page_no(book.current_page) ;
}
});
this.row();
if (sorah_no!=book.suar_no) {
this.add(new Pading(sorah_no)).width(tab_width).height(tab_pading_height);
}else{
this.add(new Table()).width(tab_width).height(tab_pading_height);}
}
示例4: GozaTap
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
GozaTap(final int goza_no){
this.add(new GozaName( goza_no)).width(/*gozaname_width+gozatab_book_mark_width*3+tab_no_width*/tab_width).height(tab_height);
this.add(new MakeMadany( goza_no));
for (int i=1 ;i<=3 ;i++ )
{
this.add(new BookMarks( goza_no , i));
}
this.addListener(new ActorGestureListener(){
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
// TODO Auto-generated method stub
super.tap(event, x, y, count, button);
book.stage_detector=Stages.pages ;
book.config_input_prossesor(Stages.pages);
book.current_page = parts_pages[goza_no-1] ;
book.pages_stage.draw();
book.pages_draw_stage.draw();
book.pages_stage.act(Gdx.graphics.getDeltaTime());
book.pages_scroll_pane.setScrollY((book.current_page-1)*book.screen_height );
book.snab_to =((book.current_page-1)*book.screen_height ) ;
book.update_saved_page_no(book.current_page) ;
}
});
this.row();
if ( goza_no!=book.ajzaa_no) {
this.add(new Pading( goza_no)).width(tab_width).height(tab_pading_height);
}else{
this.add(new Table()).width(tab_width).height(tab_pading_height);}
}
示例5: createListener
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
private EventListener createListener(final Creature creature) {
return new ActorGestureListener(20, 0.4f, 0.5f, 0.15f) {
@Override public boolean longPress(Actor actor, float x, float y) {
creatureInfoWindow.show(new CreatureInfoWindow.Params(creature, array.first().world));
return true;
}
};
}
示例6: ingredientListener
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
private EventListener ingredientListener(final Item item) {
return new ActorGestureListener() {
@Override public void tap(InputEvent event, float x, float y, int count, int button) {
ingredients.showIngredientWindow(item);
}
};
}
示例7: initGestureListener
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public void initGestureListener() {
this.addListener(new ActorGestureListener() {
@Override
public void fling(InputEvent event, float velocityX, float velocityY, int button) {
if (Math.abs(velocityX) > Math.abs(velocityY)) {
if (velocityX > 0) {
previousView();
} else {
nextView();
}
}
super.fling(event, velocityX, velocityY, button);
}
});
}
示例8: StageClearScreen
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public StageClearScreen(final ThrowTheMoonGame game) {
this.manager = new AssetManager();
this.stage = new Stage(new StretchViewport(WIDTH, HEIGHT));
manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
manager.load(TEXTURE_FILENAME, Texture.class);
manager.load(MUSIC_FILENAME, Music.class);
manager.finishLoading();
background = manager.get(TEXTURE_FILENAME);
music = manager.get(MUSIC_FILENAME);
Image backgroundImg = new Image(background);
stage.addActor(backgroundImg);
Gdx.input.setInputProcessor(stage);
stage.addListener(new ActorGestureListener() {
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
music.stop();
game.setScreen(new GameScreen(game));
super.tap(event, x, y, count, button);
}
});
music.setLooping(true);
music.play();
}
示例9: show
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public void show() {
AssetLoaderStart.load();
stage = new Stage(new StretchViewport(Constants.WORLD_WIDTH, Constants.WORLD_HEIGHT));
Gdx.input.setInputProcessor(stage);
startScreenTexture = AssetLoaderStart.screen_start;
Image startScreen = new Image(startScreenTexture);
stage.addActor(startScreen);
stage.addListener(new ActorGestureListener() {
@Override
public void tap(InputEvent event, float x, float y, int count,
int button) {
super.tap(event, x, y, count, button);
if (tutorialTexture == null) {
tutorialTexture = AssetLoaderStart.screen_instructions;
Image tutorial = new Image(tutorialTexture);
stage.addActor(tutorial);
} else {
game.setScreen(new com.colim.anglexplore.screens.GameScreen());
dispose();
}
}
});
}
示例10: setUpcredits
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
/**
* Sets the upcredits.
*/
public void setUpcredits() {
credits = MenuCreator.createTable(false, UIAssets.getSkin());
credits.setSize(MAConstants.CREDITS_WIDTH * AppSettings.getWorldSizeRatio(), MAConstants.CREDITS_HEIGHT * AppSettings.getWorldSizeRatio());
credits.setPosition((getStage().getWidth() / 2) - (credits.getWidth() / 2), -credits.getHeight());
//credits.debug();
credits.addAction(Actions.moveTo((getStage().getWidth() / 2) - (credits.getWidth() / 2), (getStage().getHeight() / 2) - (credits.getHeight() / 2), 2.5f));
//level_table.top().left().pad(30, 30, 30, 30);
Drawable background = new TextureRegionDrawable(UIAssets.image_empty_bg);
credits.setBackground(background);
Text credits_text = new Text(UIAssets.cartwheel_font, TEXT_WIDTH, TEXT_HEIGHT, true);
credits_text.setText("Game made by:");
Text credits_text_name = new Text(UIAssets.cartwheel_font, TEXT_WIDTH, TEXT_HEIGHT, true);
credits_text_name.setText("Sawan J. Kapai Harpalani");
credits.add(credits_text).padBottom(50f * AppSettings.getWorldPositionYRatio()).padRight(400f * AppSettings.getWorldPositionXRatio());
credits.row();
credits.add(credits_text_name).padBottom(50f * AppSettings.getWorldPositionYRatio()).padRight(400f * AppSettings.getWorldPositionXRatio());
MathAttackButton home = new MathAttackButton(MAConstants.SMALL_BUTTON_WIDTH, MAConstants.SMALL_BUTTON_HEIGHT, null, true);
home.setTextureRegion(UIAssets.image_home_icon, true);
home.addListener(new ActorGestureListener() {
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
super.touchUp(event, x, y, pointer, button);
getGame().setScreen(new MAMainMenuScreen(getGame(), "Main Menu"));
}
});
credits.row();
credits.add(home);
getStage().addActor(credits);
}
示例11: OwnScrollPane
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
/** @param widget May be null. */
public OwnScrollPane(Actor widget, ScrollPaneStyle style) {
super(widget, style);
//Remove capture listeners
for (EventListener cl : getListeners()) {
if (cl instanceof ActorGestureListener) {
removeListener(cl);
}
}
}
示例12: q
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public q(Compass paramCompass, float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, ActorGestureListener paramActorGestureListener)
{
super(paramFloat3, paramFloat4, paramActorGestureListener);
setX(paramFloat1);
setY(paramFloat2);
setWidth(paramFloat3);
setHeight(paramFloat4);
setColor(Color.WHITE);
this.b = ag.ae;
this.c = ag.af;
this.d = ag.ag;
this.e = new ac(Compass.e(), Compass.f(), Compass.g());
this.e.a(45.0F);
this.f = new Matrix4();
}
示例13: ak
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public ak(float paramFloat1, float paramFloat2, ActorGestureListener paramActorGestureListener)
{
super(ak.class.getSimpleName());
this.a = paramFloat1;
this.b = paramFloat2;
this.d = false;
setColor(Color.BLACK);
if (paramActorGestureListener != null)
addListener(paramActorGestureListener);
}
示例14: PageTap
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public PageTap(final int page_no) {
int surah_no =1 ;
boolean compleat = true ;
for (int i = 0; i < surah_page.length-1; i++) {
if(compleat){
if (page_no == surah_page[i]){
surah_no = i ;
compleat=false;
}else if (page_no>=surah_page[i]&&page_no<surah_page[i+1]){
surah_no = i ;
compleat=false;
}}
}
boolean maky_or_madany = suar_state[surah_no] ;
this.add(new GozaName(surah_no+1 , page_no)).width(/*gozaname_width+gozatab_book_mark_width*3+tab_no_width*/tab_width).height(tab_height);
this.add(new MakeMadany( page_no,maky_or_madany));
for (int i=1 ;i<=3 ;i++ )
{
this.add(new BookMarks( page_no , i));
}
this.addListener(new ActorGestureListener(){
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
// TODO Auto-generated method stub
super.tap(event, x, y, count, button);
book.stage_detector=Stages.pages ;
book.config_input_prossesor(Stages.pages);
book.current_page = page_no ;
book.pages_stage.draw();
book.pages_draw_stage.draw();
book.pages_stage.act(Gdx.graphics.getDeltaTime());
book.pages_scroll_pane.setScrollY((book.current_page-1)*book.screen_height );
book.snab_to =((book.current_page-1)*book.screen_height ) ;
book.update_saved_page_no(book.current_page) ;
}
});
this.row();
if ( page_no!=book.pages_no) {
this.add(new Pading( page_no)).width(tab_width).height(tab_pading_height);
}else{
this.add(new Table()).width(tab_width).height(tab_pading_height);}
}
示例15: MapStateButton
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; //导入依赖的package包/类
public MapStateButton(StateChangedListener stateChangedListener) {
this.style = VisUI.getSkin().get("default", MapStateButtonStyle.class);
if (style.stateCar == null || style.stateFree == null || style.stateLock == null
|| style.stateWaypoint == null || style.stateGps == null) {
throw new RuntimeException("MapStateButtonStyle drawables can not be NULL");
}
clickListener = new DoubleClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
log.debug("button clicked" + event);
if (isLongPressed) {
isLongPressed = false;
return;
}
int intState = CB.mapMode.ordinal();
intState++;
if (intState > mapStateLength - 3) {// last mapMode is Mapstate.Lock. Activated with double click
intState = 0;
}
setMapMode(MapMode.fromOrdinal(intState), new Event());
}
@Override
public void doubleClicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
log.debug("button double clicked" + event);
setMapMode(MapMode.LOCK, false, new Event());
}
};
gestureListener = new ActorGestureListener() {
@Override
public boolean longPress(Actor actor, float x, float y) {
log.debug("button long clicked");
setMapMode(MapMode.CAR, false, new Event());
isLongPressed = true;
return true;
}
};
gestureListener.getGestureDetector().setLongPressSeconds((float) (Config.LongClicktime.getValue() / 1000f));
this.addListener(gestureListener);
this.addListener(clickListener);
this.setTouchable(Touchable.enabled);
this.stateChangedListener = stateChangedListener;
setSize(getPrefWidth(), getPrefHeight());
}