0
我正在使用XNA的Windows應用程序。差異Xna枚舉touchState
其實我成功地移動了我的精靈,但我想添加一個不同的動作,當用戶觸摸精靈但不移動它。我知道TouchlocationState
枚舉exist但我不明白Moved
和Pressed
之間的區別。
現在我使用Released
這就足夠了,我更新了精靈位置,但它沒有被釋放,然後我檢查碰撞。 那麼如何在點擊時添加一種觸摸方式?我的意思是當用戶點擊精靈但不移動它。 一些代碼:
TouchPanelCapabilities touchCap = TouchPanel.GetCapabilities();
if (touchCap.IsConnected)
{
TouchCollection touches = TouchPanel.GetState();
if (touches.Count >= 1)
{
Vector2 PositionTouch = touches[0].Position;
if (touches[0].State == TouchLocationState.Released)
{
// Pause button click and others buttons
Mouseclik((int)PositionTouch.X, (int)PositionTouch.Y);
}
if (!PausePopUp)
{
CheckMoove(PositionTouch);
if (touches[touches.Count - 1].State == TouchLocationState.Released)
{
// this is where i try to add/check if its only "click" on my sprite
if (touches[0].Position == touches[touches.Count - 1].Postion)
{
TempoRectangle = ListSprite[save].ShapeViser;
isclicked = true;
}
我的目標是增加精靈上面一個PictureBox如果在PictureBox的是diplayed的其他精靈被觸摸以隨後顯示的信息,我想提請這些精靈2之間的線路。
感謝您的解釋,我在查找信息時發現_GestureSample_。我想我會改變我所有的移動方式 – Gabson
這可能是一個解決方案,但對你來說,如果你需要使用FreeDrag手勢,你最好知道程序只有在你開始時纔會檢測到它拖動觸摸,不僅可以按下它。使用「Hold」時會發生類似的情況,只會在幾秒鐘後觸發。而'DoubleTap'很難察覺。 – pinckerman