eu.ensam.ii.vrpn
Class VrpnSurface

java.lang.Object
  extended by android.view.SurfaceView
      extended by eu.ensam.ii.vrpn.VrpnSurface

public class VrpnSurface
extends SurfaceView

This SurfaceView updates two Vrpn Analog channels with the coordinates of the Surface point that is touched.

Updates are sent as long astouch events occur within the surface. The X channel range from app:leftX to app:rightX, and the Y channel values range from app:topY to app:bottomY.

In your layout, declare the following (note the app: attributes)

 <eu.ensam.ii.vrpn.VrpnSurface 
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent"
   app:leftX="-1"
   app:rightX="1"
   app:topY="0"
   app:bottomY="1"
   app:vrpnAnalogX="@id/MyVrpnAnalogX"
   app:vrpnAnalogY="@id/MyVrpnAnalogY"
 />
 

The root element of the layout must declare the following line just after the xmlns:android ... line :

   xmlns:app="http://schemas.android.com/apk/res/your.package.name.here"
 

Custom XML attributes :

The app:vrpnAnalogX and app:vrpnAnalogY ids can be literals or a resource Ids. These resource ids may be kept in a separate Vrpn Id list


Constructor Summary
VrpnSurface(Context context)
           
VrpnSurface(Context context, AttributeSet attrs)
           
VrpnSurface(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 boolean onTouch(View v, MotionEvent event)
          Called when a touch event is dispatched to this widget.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VrpnSurface

public VrpnSurface(Context context)

VrpnSurface

public VrpnSurface(Context context,
                   AttributeSet attrs)

VrpnSurface

public VrpnSurface(Context context,
                   AttributeSet attrs,
                   int defStyle)
Method Detail

onTouch

public boolean onTouch(View v,
                       MotionEvent event)
Called when a touch event is dispatched to this widget.

If the touch event occurs within the surface of the view, two analog Vrpn updates are send for the X and y position. Updates are sent when ACTION_DOWN, ACTION_MOVE, and ACTION_UP are received. the event history is ignored.

See Also:
View.OnTouchListener, MotionEvent