本文整理匯總了Java中com.watabou.input.NoosaInputProcessor.Touch方法的典型用法代碼示例。如果您正苦於以下問題:Java NoosaInputProcessor.Touch方法的具體用法?Java NoosaInputProcessor.Touch怎麽用?Java NoosaInputProcessor.Touch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.watabou.input.NoosaInputProcessor
的用法示例。
在下文中一共展示了NoosaInputProcessor.Touch方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onTouchDown
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onTouchDown( NoosaInputProcessor.Touch t ) {
if (t != touch && another == null) {
if (!touch.down) {
touch = t;
onTouchDown( t );
return;
}
pinching = true;
another = t;
startSpan = PointF.distance( touch.current, another.current );
startZoom = camera.zoom;
dragging = false;
}
}
示例2: onTouchUp
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onTouchUp( NoosaInputProcessor.Touch t ) {
if (pinching && (t == touch || t == another)) {
pinching = false;
int zoom = Math.round( camera.zoom );
camera.zoom( zoom );
PixelDungeon.zoom( (int)(zoom - PixelScene.defaultZoom) );
dragging = true;
if (t == touch) {
touch = another;
}
another = null;
lastPos.set( touch.current );
}
}
示例3: onTouchDown
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onTouchDown( NoosaInputProcessor.Touch t ) {
if (t != touch && another == null) {
if (!touch.down) {
touch = t;
onTouchDown( t );
return;
}
pinching = true;
another = t;
startSpan = PointF.distance( touch.current, another.current );
startZoom = camera.zoom;
dragging = false;
} else if (t != touch) {
reset();
}
}
示例4: onTouchUp
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onTouchUp( NoosaInputProcessor.Touch t ) {
if (pinching && (t == touch || t == another)) {
pinching = false;
zoom(Math.round( camera.zoom ));
dragging = true;
if (t == touch) {
touch = another;
}
another = null;
lastPos.set( touch.current );
}
}
示例5: createChildren
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void createChildren() {
panel = Chrome.get(Chrome.Type.TOAST_TR);
add( panel );
//updateMessage = new BitmapText("Checking Updates", PixelScene.font1x);
updateMessage = PixelScene.createText("Checking Updates", 9);
add(updateMessage);
touchUpdate = new TouchArea( panel ){
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (updateAvailable) {
parent.add(new WndUpdate() );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
}
};
add(touchUpdate);
updateMessage();
}
示例6: createChildren
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void createChildren() {
hotArea = new TouchArea<T>( 0, 0, 0, 0 ) {
@Override
protected void onTouchDown(NoosaInputProcessor.Touch touch) {
pressed = true;
pressTime = 0;
processed = false;
Button.this.onTouchDown();
};
@Override
protected void onTouchUp(NoosaInputProcessor.Touch touch) {
pressed = false;
Button.this.onTouchUp();
};
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (!processed) {
if (NoosaInputProcessor.modifier && onLongClick()) {
// Do nothing
} else {
Button.this.onClick();
}
}
};
@Override
public boolean onKeyDown(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyDown(key);
}
@Override
public boolean onKeyUp(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyUp(key);
}
};
add( hotArea );
}
示例7: onClick
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (dragging) {
dragging = false;
} else {
select( ((DungeonTilemap)target).screenToTile(
(int)touch.current.x,
(int)touch.current.y ) );
}
}
示例8: onDrag
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onDrag( NoosaInputProcessor.Touch t ) {
camera.target = null;
if (pinching) {
float curSpan = PointF.distance( touch.current, another.current );
camera.zoom( GameMath.gate(
PixelScene.minZoom,
startZoom * curSpan / startSpan,
PixelScene.maxZoom ) );
} else {
if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
} else if (dragging) {
camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) );
lastPos.set( t.current );
}
}
}
示例9: createChildren
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void createChildren() {
hotArea = new TouchArea<T>( 0, 0, 0, 0 ) {
@Override
protected void onTouchDown(NoosaInputProcessor.Touch touch) {
pressed = true;
pressTime = 0;
processed = false;
Button.this.onTouchDown();
};
@Override
protected void onTouchUp(NoosaInputProcessor.Touch touch) {
pressed = false;
Button.this.onTouchUp();
};
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (!processed) {
if (NoosaInputProcessor.modifier && onLongClick()) {
// Do nothing
} else {
Button.this.onClick();
}
}
};
@Override
public boolean onKeyDown(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyDown(key);
}
@Override
public boolean onKeyUp(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyUp(key);
}
};
add(hotArea);
}
示例10: touchDown
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
NoosaInputProcessor.Touch touch = new NoosaInputProcessor.Touch(screenX, screenY);
pointers.put(button, touch);
eventTouch.dispatch(touch);
return true;
}
示例11: touchUp
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
NoosaInputProcessor.Touch touch = pointers.remove(button);
if(touch != null) {
eventTouch.dispatch(touch.up());
return true;
}
return false;
}
示例12: touchDragged
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
for (IntMap.Entry<NoosaInputProcessor.Touch> entry : pointers) {
entry.value.update(screenX, screenY);
}
eventTouch.dispatch(null);
return true;
}
示例13: onDrag
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onDrag(NoosaInputProcessor.Touch t) {
if (dragging) {
Camera c = content.camera;
c.scroll.offset(PointF.diff(lastPos, t.current).invScale(c.zoom));
if (c.scroll.x + width > content.width()) {
c.scroll.x = content.width() - width;
}
if (c.scroll.x < 0) {
c.scroll.x = 0;
}
if (c.scroll.y + height > content.height()) {
c.scroll.y = content.height() - height;
}
if (c.scroll.y < 0) {
c.scroll.y = 0;
}
lastPos.set(t.current);
} else if (PointF.distance(t.current, t.start) > dragThreshold) {
dragging = true;
lastPos.set(t.current);
}
}
示例14: onClick
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (dragging) {
dragging = false;
} else {
PointF p = Camera.main.screenToCamera( (int)touch.current.x, (int)touch.current.y );
for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])){
if (mob.sprite != null && mob.sprite.overlapsPoint( p.x, p.y)){
select( mob.pos );
return;
}
}
for (Heap heap : Dungeon.level.heaps.values()){
if (heap.sprite != null && heap.sprite.overlapsPoint( p.x, p.y)){
select( heap.pos );
return;
}
}
select( ((DungeonTilemap)target).screenToTile(
(int)touch.current.x,
(int)touch.current.y,
true ) );
}
}
示例15: onDrag
import com.watabou.input.NoosaInputProcessor; //導入方法依賴的package包/類
@Override
protected void onDrag( NoosaInputProcessor.Touch t ) {
camera.target = null;
if (pinching) {
float curSpan = PointF.distance( touch.current, another.current );
float zoom = (startZoom * curSpan / startSpan);
camera.zoom( GameMath.gate(
PixelScene.minZoom,
zoom - (zoom % 0.1f),
PixelScene.maxZoom ) );
} else {
if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
} else if (dragging) {
camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) );
lastPos.set( t.current );
}
}
}