本文整理汇总了C#中Snapshot.CreateInteractor方法的典型用法代码示例。如果您正苦于以下问题:C# Snapshot.CreateInteractor方法的具体用法?C# Snapshot.CreateInteractor怎么用?C# Snapshot.CreateInteractor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snapshot
的用法示例。
在下文中一共展示了Snapshot.CreateInteractor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToSnapshot
/// <summary>
/// Adds the interactor to the given snapshot.
/// </summary>
/// <param name="snapshot">Interaction snapshot.</param>
/// <param name="windowId">ID of the game window.</param>
/// <param name="viewportPosition">Position of the game window in screen coordinates.</param>
public void AddToSnapshot(Snapshot snapshot, string windowId, Vector2 viewportPosition, Vector2 viewportPixelsPerDesktopPixel)
{
using (var interactor = snapshot.CreateInteractor(_id, _parentId, windowId))
{
using (var bounds = interactor.CreateBounds(BoundsType.Rectangular))
{
// Location.rect is in GUI space.
bounds.SetRectangularData(
viewportPosition.x + Location.rect.x / viewportPixelsPerDesktopPixel.x,
viewportPosition.y + Location.rect.y / viewportPixelsPerDesktopPixel.y,
Location.rect.width / viewportPixelsPerDesktopPixel.x,
Location.rect.height / viewportPixelsPerDesktopPixel.y);
}
interactor.Z = Location.relativeZ;
if (Mask != null &&
Mask.Type != EyeXMaskType.None)
{
var mask = interactor.CreateMask(MaskType.Default, Mask.Size, Mask.Size, Mask.MaskData);
mask.Dispose();
}
foreach (var behavior in EyeXBehaviors)
{
behavior.AssignBehavior(interactor);
}
}
}
示例2: AddToSnapshot
/// <summary>
/// Creates an EyeX interactor from the properties and behaviors in
/// this WpfInteractor, and adds it to the provided snapshot.
/// </summary>
/// <param name="snapshot">The <see cref="Snapshot"/> to
/// add the interactor to.</param>
public void AddToSnapshot(Snapshot snapshot)
{
if (!IsQueryable)
{
return;
}
using (var interactor = snapshot.CreateInteractor(Id, ParentId, WindowId.ToString()))
{
var boundsRect = GetElementBoundsInScreenCoordinates(Element);
using (var bounds = interactor.CreateBounds(BoundsType.Rectangular))
{
bounds.SetRectangularData(boundsRect.Left, boundsRect.Top, boundsRect.Width, boundsRect.Height);
}
interactor.Z = Z;
foreach (var behavior in _behaviors)
{
behavior.AssignBehavior(interactor);
}
}
}
示例3: AddToSnapshot
/// <summary>
/// Adds the interactor to a given snapshot.
/// </summary>
/// <param name="snapshot">The snapshot to add the interactor to.</param>
public void AddToSnapshot(Snapshot snapshot)
{
using (var interactor = snapshot.CreateInteractor(Id, ParentId, WindowId))
{
using (var bounds = interactor.CreateBounds(BoundsType.Rectangular))
{
var screenTopLeft = Control.PointToScreen(Point.Empty);
var screenBottomRight = Control.PointToScreen(new Point(Control.Size.Width, Control.Size.Height));
bounds.SetRectangularData(screenTopLeft.X, screenTopLeft.Y, screenBottomRight.X - screenTopLeft.X, screenBottomRight.Y - screenTopLeft.Y);
}
interactor.Z = Z;
foreach (var behavior in _behaviors)
{
behavior.AssignBehavior(interactor);
}
}
}