• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ITouchArea类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
    if (pSceneTouchEvent.isActionDown()) {
        this.isTouchDown = true;
    } else if (isTouchDown && pSceneTouchEvent.isActionUp()) {

        if (this.eventListener != null) {
            this.eventListener.onLetterTileClicked(this);
        }
        this.isTouchDown = false;
        return true;
    } else {
        this.isTouchDown = false;
    }
    return false;

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:LetterTile.java


示例2: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
    if (pSceneTouchEvent.isActionDown()) {
        this.isTouchDown = true;
    } else if (isTouchDown && pSceneTouchEvent.isActionUp()) {

        if (this.eventListener != null) {
            this.eventListener.onWordTileClicked(this);
        }
        this.isTouchDown = false;
        return true;
    } else {
        this.isTouchDown = false;
    }
    return false;

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:WordTile.java


示例3: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
    if (pSceneTouchEvent.isActionDown()) {
        this.isTouchDown = true;
    } else if (isTouchDown && pSceneTouchEvent.isActionUp()) {

        if (this.eventListener != null) {
            this.eventListener.onGameTileClicked(this);
        }
        this.isTouchDown = false;
        return true;
    } else {
        this.isTouchDown = false;
    }
    return false;

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:GameTile.java


示例4: Scrollable

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
/**
 * New Scrollable with with the desired width and height.
 * The width and height must be specified because a Scrollable will be smaller than the size
 * needed for all of it's children
 * @param x the X coordinate of the scene to place this Scrollable
 * @param y the Y coordinate of the scene to place this Scrollable
 * @param w the width for this Scrollable
 * @param h the height for this Scrollable
 * @param scroll_lock what directions can be scrolled (default Scrollable.SCROLL_BOTH)
 */
public Scrollable(float x, float y, float w, float h, int scroll_lock) {
    super(x, y, w, h);
    this.scroll_lock = scroll_lock;
    this.scrollDetector = new SurfaceScrollDetector(this);

    this.contents = new Entity(w/2, h/2, 0, 0);
    this.childRect.set(0, 0, 0, 0);
    this.touchAreas = new ArrayList<ITouchArea>();

    super.attachChild(this.contents);

    this.scrollbar_color = new Color(0.0f, 0.0f, 0.0f, 0.25f);
    this.vertical_scrollbar = new Rectangle(this.getWidth()-(this.scrollbar_size /2)-2, this.getHeight()/2, scrollbar_size, this.getHeight(), PhoeniciaContext.vboManager);
    this.vertical_scrollbar.setColor(this.scrollbar_color);
    if (this.scroll_lock == SCROLL_HORIZONTAL) this.vertical_scrollbar.setVisible(false);
    this.scroll_y = 0;
    super.attachChild(this.vertical_scrollbar);

    this.horizontal_scrollbar = new Rectangle(this.getWidth()/2, (scrollbar_size/2)+2, this.getWidth(), scrollbar_size, PhoeniciaContext.vboManager);
    this.horizontal_scrollbar.setColor(this.scrollbar_color);
    if (this.scroll_lock == SCROLL_VERTICAL) this.horizontal_scrollbar.setVisible(false);
    this.scroll_x = 0;
    super.attachChild(this.horizontal_scrollbar);

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:36,代码来源:Scrollable.java


示例5: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
@Override
public boolean onAreaTouched(TouchEvent touchEvent, float localTouchX, float localTouchY) {
    final float sceneTouchX = touchEvent.getX();
    final float sceneTouchY = touchEvent.getY();
    for (ITouchArea area: this.touchAreas) {
        if (area.contains(sceneTouchX, sceneTouchY)) {
            final float[] areaTouchCoordinates = area.convertSceneCoordinatesToLocalCoordinates(sceneTouchX, sceneTouchY);
            final float areaTouchX = areaTouchCoordinates[Constants.VERTEX_INDEX_X];
            final float areaTouchY = areaTouchCoordinates[Constants.VERTEX_INDEX_Y];
            final Boolean handled = area.onAreaTouched(touchEvent, areaTouchX, areaTouchY);
            if (handled != null && handled) {
                return true;
            }
        }
    }
    return true;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:18,代码来源:Dialog.java


示例6: stop

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public void stop() {
	for (int i = 0; i < this.getChildCount(); i++) {
		IEntity child = this.getChildByIndex(i);
		if (child instanceof Enemy) {
			((Enemy) child).mState = Enemy.STATE_DEAD;
			child.setTag(TowerDefense.TAG_DETACHABLE);
		} else if (child instanceof SpawnPoint) {
			((SpawnPoint) child).mActive = false;
		} else if (child instanceof Round || child instanceof SelectionWheel || child instanceof Option) {
			child.setTag(TowerDefense.TAG_DETACHABLE);
		} else if (child instanceof BasePoint || child instanceof Tower) {
			this.unregisterTouchArea((ITouchArea) child);
		}
	}
	this.mWaveTimer.mActive = false;
	this.stopMusic();
	this.mEnded = true;
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:19,代码来源:LevelScene.java


示例7: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent, ITouchArea pTouchArea, float pTouchAreaLocalX, float pTouchAreaLocalY) {
    if (pSceneTouchEvent.isActionDown()) {
        mResourceManager.mMenuClickSound.play();
        if ( pTouchArea == mMainScene.mPlayText) {
            startGame(true);
            return true;
        } else if (pTouchArea == mMainScene.mHelpText) {
            GameActivity.this.runOnUiThread(new Runnable() {
                public void run() {
                    GameActivity.this.mHelpDialog.show();
                }
            });
            return true;
        } else if (pTouchArea == mMainScene.mLevelText) {
            mLevel = !(mLevel > 14) ? mLevel += 1 : 1;
            mMainScene.updateLevel(mLevel);
            return true;
        }
    }

    return true;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:24,代码来源:GameActivity.java


示例8: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
    if (pSceneTouchEvent.isActionDown()) {
        this.isTouchDown = true;
    } else if (isTouchDown && pSceneTouchEvent.isActionUp()) {

        this.isTouchDown = false;
        return true;
    } else {
        this.isTouchDown = false;
    }
    return false;

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:DecorationTile.java


示例9: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
@Override
public boolean onAreaTouched(final TouchEvent pTouchEvent, final float touchX, final float touchY) {
    boolean handled = this.scrollDetector.onManagedTouchEvent(pTouchEvent);
    //Debug.d("scrollDetector: "+handled);
    if (this.touch_was_scroll || this.is_scrolling) {
        //Debug.d("Touch was scroll ");
        this.touch_was_scroll = false;
        this.scroll_last = System.currentTimeMillis();
        return true;
    } else  {
        //Debug.d("Touch was not scroll ");
        this.touch_was_scroll = false;
        long delay = System.currentTimeMillis() - this.scroll_last;
        if (delay < this.scroll_timeout) {
            return false;
        }
        final float sceneTouchX = pTouchEvent.getX();
        final float sceneTouchY = pTouchEvent.getY();
        for (ITouchArea area: this.touchAreas) {
            if (area.contains(sceneTouchX, sceneTouchY)) {
                final float[] areaTouchCoordinates = area.convertSceneCoordinatesToLocalCoordinates(sceneTouchX, sceneTouchY);
                final float areaTouchX = areaTouchCoordinates[Constants.VERTEX_INDEX_X];
                final float areaTouchY = areaTouchCoordinates[Constants.VERTEX_INDEX_Y];
                final Boolean ishandled = area.onAreaTouched(pTouchEvent, areaTouchX, areaTouchY);
                if (ishandled != null && ishandled) {
                    return true;
                }
            }
        }
        return false;
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:33,代码来源:Scrollable.java


示例10: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
	final IMenuItem menuItem = ((IMenuItem)pTouchArea);

	switch (pSceneTouchEvent.getAction()) {
		case MotionEvent.ACTION_DOWN:
		case MotionEvent.ACTION_MOVE:
			if ((this.mSelectedMenuItem != null) && (this.mSelectedMenuItem != menuItem)) {
				this.mSelectedMenuItem.onUnselected();
			}
			this.mSelectedMenuItem = menuItem;
			this.mSelectedMenuItem.onSelected();
			break;
		case MotionEvent.ACTION_UP:
			if (this.mOnMenuItemClickListener != null) {
				final boolean handled = this.mOnMenuItemClickListener.onMenuItemClicked(this, menuItem, pTouchAreaLocalX, pTouchAreaLocalY);
				menuItem.onUnselected();
				this.mSelectedMenuItem = null;
				return handled;
			}
			break;
		case MotionEvent.ACTION_CANCEL:
			menuItem.onUnselected();
			this.mSelectedMenuItem = null;
			break;
	}
	return true;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:29,代码来源:MenuScene.java


示例11: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
	final IMenuItem menuItem = ((IMenuItem)pTouchArea);

	switch(pSceneTouchEvent.getAction()) {
		case MotionEvent.ACTION_DOWN:
		case MotionEvent.ACTION_MOVE:
			if(this.mSelectedMenuItem != null && this.mSelectedMenuItem != menuItem) {
				this.mSelectedMenuItem.onUnselected();
			}
			this.mSelectedMenuItem = menuItem;
			this.mSelectedMenuItem.onSelected();
			break;
		case MotionEvent.ACTION_UP:
			if(this.mOnMenuItemClickListener != null) {
				final boolean handled = this.mOnMenuItemClickListener.onMenuItemClicked(this, menuItem, pTouchAreaLocalX, pTouchAreaLocalY);
				menuItem.onUnselected();
				this.mSelectedMenuItem = null;
				return handled;
			}
			break;
		case MotionEvent.ACTION_CANCEL:
			menuItem.onUnselected();
			this.mSelectedMenuItem = null;
			break;
	}
	return true;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:29,代码来源:MenuScene.java


示例12: onAreaTouched

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
		final ITouchArea pTouchArea, float pTouchAreaLocalX,
		float pTouchAreaLocalY) {

	/*
	 * Una de las áreas táctiles que registramos   ha sido tocada :-d
	 */
	
	//si estamos dentro de el rango de multitoque que controlamos
	if (pSceneTouchEvent.isActionDown()
			&& pSceneTouchEvent.getPointerID() < MAX_MULTITOQUE){
		final IEntity entity = (IEntity) pTouchArea;
		
		//si este puntero no tiene asignado ya un enlace/articulación
		if (joints[pSceneTouchEvent.getPointerID()] == null) {
			final Bloque bloque = (Bloque) entity.getUserData();
			//final IPieza pieza = (IPieza) bloque.getPadre();

			// particulas bonitas en el  bloque que hemos agarrado
			entity.attachChild(particulasPuntero[pSceneTouchEvent
					.getPointerID()]);
			particulasPuntero[pSceneTouchEvent
								.getPointerID()].setParticlesSpawnEnabled(true);
			//creamos un enlace con el raton (MouseJoint) 
			joints[pSceneTouchEvent.getPointerID()] = this
					.createMouseJoint(entity, pTouchAreaLocalX,
							pTouchAreaLocalY);
			
		}

		return true;
	}
	return false;

}
 
开发者ID:sprayz,项目名称:Phytris,代码行数:37,代码来源:EscenaJuego.java


示例13: registerTouchArea

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public void registerTouchArea(ITouchArea area) {
    this.touchAreas.add(area);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:4,代码来源:Scrollable.java


示例14: unregisterTouchArea

import org.andengine.entity.scene.ITouchArea; //导入依赖的package包/类
public void unregisterTouchArea(ITouchArea area) {
    if (this.touchAreas.contains(area)) this.touchAreas.remove(area);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:4,代码来源:Scrollable.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContextAccessController类代码示例发布时间:2022-05-22
下一篇:
Java IPacket类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap