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); } } } }; }
/** * 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); }
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);} }
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);} }
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; } }; }
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); } }; }
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); } }); }
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(); }
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(); } } }); }
/** * 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); }
/** @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); } } }
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(); }
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); }
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);} }
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()); }
public CardViewSmall(CardshifterClientContext context, CardInfoMessage cardInfo, ZoomCardCallback zoomCallback, boolean zoomedVersion) { this.context = context; this.cardInfo = cardInfo; this.properties = new HashMap<String, Object>(cardInfo.getProperties()); this.id = cardInfo.getId(); this.zoomCallback = zoomCallback; this.screenWidth = CardshifterGame.STAGE_WIDTH; this.screenHeight = CardshifterGame.STAGE_HEIGHT; table = new Table(context.getSkin()); table.setBackground(new NinePatchDrawable(patch)); table.defaults().height(this.screenHeight/30); Gdx.app.log("CardView", "Creating for " + cardInfo.getProperties()); table.defaults().expand(); name = label(context, cardInfo, "name"); table.add(name).colspan(2).width(this.screenWidth/8).left().row(); // table.add(image); //effect = label(context, cardInfo, "effect"); this.namedEffect = new Label(" ", context.getSkin()); String resourceName = this.stringResources(cardInfo); if (resourceName != null && !resourceName.equals("")) { this.namedEffect.setText(this.stringResources(cardInfo)); } //effect.setText(effect.getText() + stringResources(cardInfo)); table.add(namedEffect).colspan(2).width(this.screenWidth/8).left().row(); this.complexEffect = label(context, cardInfo, "effect"); table.add(complexEffect).colspan(2).width(this.screenWidth/8).center().row(); if (zoomedVersion) { Label flavorLabel = label(context, cardInfo, "flavor"); flavorLabel.setWrap(true); table.add(flavorLabel).colspan(2).width(this.screenWidth/8).center().row(); } ResViewFactory rvf = new ResViewFactory(context.getSkin()); cost = rvf.forFormat(rvf.res("MANA_COST"), rvf.res("SCRAP_COST")); table.add(cost.getActor()).colspan(2).right().row(); stats = rvf.forFormat(rvf.coloredRes("ATTACK", properties), rvf.str("/"), rvf.coloredRes("HEALTH", "MAX_HEALTH")); table.add(label(context, cardInfo, "creatureType")).left(); table.add(stats.getActor()).right(); cost.update(properties); stats.update(properties); this.clickListener = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (CardViewSmall.this.dragListener.isDragging()) { return; } if (this.getTapCount() > 1) { CardViewSmall.this.zoomed(); } else { CardViewSmall.this.clicked(); } } }; this.clickListener.setTapCountInterval(0.2f); //i think that the default is 0.4f this.longPressListener = new ActorGestureListener(){ @Override public boolean longPress(Actor actor, float x, float y) { CardViewSmall.this.zoomed(); return true; } }; this.longPressListener.getGestureDetector().setLongPressSeconds(0.3f); this.dragListener = new MyDragListener(this.table); table.addListener(this.clickListener); table.addListener(this.longPressListener); table.addListener(this.dragListener); table.setTouchable(Touchable.enabled); }
@Override public void resize(int width, int height) { Skin skin = game.getResourcesManager().getStyles().skin; game.getProfileManager().getProfile().resetValues(); super.resize(width, height); final List<Level> levels = game.getLevelManager().getLevels(); int size = (int) (350 * ScaleUtil.getSizeRatio()); int pad = (int) (30 * ScaleUtil.getSizeRatio()); for (int i = 0; i < levels.size(); i++) { final ButtonLevel levelButton = new ButtonLevel(game.getResourcesManager()); if (!levels.get(i).isActive()) { levelButton.setTextureLocked(skin.getRegion("gui_candado"), true); } levelButton.setLevelNumber(levels.get(i).getNum(), game.getResourcesManager().getStyles().font2); levelButton.setLevelStars(((TextureAtlas) game.getResourcesManager().get(ResourcesManager.GUI_ATLAS)).findRegion("estrellaZocalo"), skin.getRegion("gui_estrella"), 5, levels.get(i).getAchievements(), size); levelButton.addListener(new ActorGestureListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); Gdx.app.log(Constants.LOG, "Numero de boton presionado: " + levelButton.getLevelNumber()); game.getLevelManager().setCurrentLevel(levels.get(levelButton.getLevelNumber() - 1)); game.setGameState(GameState.GAME_SHOW_GAME); } }); if (i % 5 == 0) { mainTable.row(); } mainTable.add(levelButton).size(size, size).pad(pad).expand(); } mainTable.setFillParent(true); mainTable.row(); mainTable.setBackground(skin.getDrawable("debug")); this.stage.addActor(mainTable); }