Blackberry Storm Emulator - TouchGesture events do not fire, how to make Swipe work?

Playing with the Storm emulator and 4.7 JDE, I can’t understand how to shoot games with emulators.

The following is the touch event code for the RIM EmbeddedMapDemo sample application. It seems simple enough, but touchGesture.getEvent () == TouchGesture.SWIPE never registers with true.

How can I register swipes in an emulator? Using the mouse, I try to left-click and drag, but this does not work.

/**
* @see Field#touchEvent(TouchEvent)
*/
protected boolean touchEvent(TouchEvent message)
{        
    boolean isConsumed = false;

    if(_mapField.isClicked())
    {
        TouchGesture touchGesture = message.getGesture(); 
        if (touchGesture != null)
        {                
            // If the user has performed a swipe gesture we will 
            // move the map accordingly.
            if (touchGesture.getEvent() == TouchGesture.SWIPE)
            {      
                // Retrieve the swipe magnitude so we know how
                // far to move the map.
                int magnitude = touchGesture.getSwipeMagnitude();

                // Move the map in the direction of the swipe.
                switch(touchGesture.getSwipeDirection())
                {
                    case TouchGesture.SWIPE_NORTH:
                        _mapField.move(0, - magnitude);
                        break;
                    case TouchGesture.SWIPE_SOUTH:
                        _mapField.move(0, magnitude);
                        break;
                    case TouchGesture.SWIPE_EAST:
                        _mapField.move(- magnitude, 0);
                        break;
                    case TouchGesture.SWIPE_WEST:
                        _mapField.move(magnitude, 0);
                        break;                            
                } 
                // We've consumed the touch event.
                isConsumed = true; 
            }
        }     
    }
    return isConsumed;       
}
+3
source share
1 answer

... ( Storm, ) TouchGesture, .

, , , , . , TouchGestures.

, , , .

+4

Source: https://habr.com/ru/post/1713366/


All Articles