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.
protected boolean touchEvent(TouchEvent message)
{
boolean isConsumed = false;
if(_mapField.isClicked())
{
TouchGesture touchGesture = message.getGesture();
if (touchGesture != null)
{
if (touchGesture.getEvent() == TouchGesture.SWIPE)
{
int magnitude = touchGesture.getSwipeMagnitude();
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;
}
isConsumed = true;
}
}
}
return isConsumed;
}
source
share