當前位置: 首頁>>代碼示例>>Java>>正文


Java NoosaInputProcessor.Touch方法代碼示例

本文整理匯總了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;
	}
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:21,代碼來源:CellSelector.java

示例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 );
	}
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:19,代碼來源:CellSelector.java

示例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();
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:23,代碼來源:CellSelector.java

示例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 );
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:17,代碼來源:CellSelector.java

示例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();
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:23,代碼來源:UpdateNotification.java

示例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 );
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:37,代碼來源:Button.java

示例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 ) );
	}
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:14,代碼來源:CellSelector.java

示例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 );	
		}	
	}
	
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:28,代碼來源:CellSelector.java

示例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);
}
 
開發者ID:skynet67,項目名稱:pixel-dungeon-rebirth,代碼行數:38,代碼來源:Button.java

示例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;
}
 
開發者ID:skynet67,項目名稱:pixel-dungeon-rebirth,代碼行數:8,代碼來源:DesktopInputProcessor.java

示例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;
}
 
開發者ID:skynet67,項目名稱:pixel-dungeon-rebirth,代碼行數:11,代碼來源:DesktopInputProcessor.java

示例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;
}
 
開發者ID:skynet67,項目名稱:pixel-dungeon-rebirth,代碼行數:9,代碼來源:DesktopInputProcessor.java

示例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);

    }
}
 
開發者ID:skynet67,項目名稱:pixel-dungeon-rebirth,代碼行數:31,代碼來源:ScrollPane.java

示例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 ) );
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:30,代碼來源:CellSelector.java

示例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 );
		}
	}
	
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:29,代碼來源:CellSelector.java


注:本文中的com.watabou.input.NoosaInputProcessor.Touch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。