| Living Silver Desk Project architecture |
|
|
| Scritto da Gene | ||||||||
| luned́ 15 settembre 2008 | ||||||||
|
Living Silver Desk Project has been renamed to MIRIA Project, please refer to the MIRIA Project home page for the latest infos.
In order to let Silverlight2 applications receive input from multitouch devices, the MIG application must be running (Multi Input Gateway).
The MIG application works as a forwarder for UDP packets sent by TouchLib OSC.exe app. UDP packets are forwarded into an HTTP Stream which SL2 app can process trough the TouchListener class available in Living Silver Desk framework. MIG actually runs as a standard application. perhaps it will be implemented as a system service in the next release. The MIG application also includes a socket policy server (http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx).
Multitouch.TouchListener The TUIO HTTP stream is received by the TouchListener class which propagates touch events within a given UIElement (or derived class) and its contained objects.
// we get a reference to the main canvas
In this example, only myCanvas' children implementing the Multitouch.Touchable interface will receive events from TouchListener.
public class TouchableObj : Canvas, MultiTouch.Touchable { [...] public void CursorAdd(String hid, Point p) { [...] } public void CursorUpdate(String hid, Point p) { [...] } public void CursorRemove(string hid) { [...] } }
LivingSilverDesk.MultiTouch.Touchable Interface Reference Public Member Functions : void CursorAdd (string hid, Point p) void CursorUpdate (string hid, Point p) void CursorRemove (string hid)
This interface is implemented in LivingSilverDesk.UIKit.Button, LivingSilverDesk.UIKit.ScrollView, and LivingSilverDesk.UIKit.TCanvas.
A gesture interpreter class is also provided. This class traces and analyzes cursors (fingers) movements received by Touchable elements and raises appropriate gesture events. Each time a cursor is added/updated (see CursorAdd and CursorUpdate from Touchable interface) we pass cursor data to the Gestures.Interpreter.FingerUpdate method. Once a known gesture is detected the Interpreter raise the matching event. In the following example you can also notice the TransformHelper class that will be explained later.
private Animations.TransformHelper transformHelper; private Gestures.Interpreter gesturesInterpreter;
public TouchableObj() { transformHelper = new Animations.TransformHelper(this);
gesturesInterpreter = new Gestures.Interpreter(this); gesturesInterpreter.Translate += GestureTranslate; gesturesInterpreter.Rotate += GestureRotate; gesturesInterpreter.Scale += GestureScale; }
private void GestureTranslate(Point c) { transformHelper.Translate = new Point(transformHelper.Translate.X + c.X, transformHelper.Translate.Y + c.Y); } private void GestureScale(double v) { transformHelper.Scale *= nscale; } private void GestureRotate(double v) { transformHelper.Angle += v; }
public void CursorAdd(String hid, Point p) { gesturesInterpreter.FingerUpdate(hid, p, transformHelper.GetVertexes(), transformHelper.GetCentroid()); } public void CursorUpdate(String hid, Point p) { gesturesInterpreter.FingerUpdate(hid, p, transformHelper.GetVertexes(), transformHelper.GetCentroid()); } public void CursorRemove(string hid) { gesturesInterpreter.FingerRemove(hid); } [...]
The Gestures.Interpreter.FingerUpdate method requires the following arguments:
To easily obtain the last two parameters the TransformHelper class is being used in most cases. In the current release Gestures.Interpreter class recognizes the following gestures:
This class helps you animating your application shapes in a smooth and realistic way. It also gives you useful methods like GetTranslateTransform, GetScaleTransform, GetRotateTransform, mostly useful for storyboard animations.
A particular note for the GetVertexes and GetCentroid methods: [... to be continued =) ...] TransformHelper is still under early development though already working fine. It will support physics (eg. acceleration) in next release.
private Animations.TransformHelper transformHelper;
public TouchableObj() { transformHelper = new Animations.TransformHelper(this); [...] // Translate this shape to coordinates 10,10 transformHelper.Translate = new Point(10, 10); // Set scale factor transformHelper.Scale = 1.2; // Set rotation angle of this shape (45 degrees) transformHelper.Angle = 45; }
Animations.Actions class [... doc to be continued =) stay tuned ...] Please referer to online SDK http://www.generoso.info/gene/livingsilverdesk/docs/html/index.htm
UIKit package: Touch-Ready UI Elements for your Silverlight2 applications [... doc to be continued =) stay tuned ...] Please referer to online SDK http://www.generoso.info/gene/livingsilverdesk/docs/html/index.html
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |
||||||||
| Ultimo aggiornamento ( domenica 26 ottobre 2008 ) | ||||||||
| Pros. > |
|---|