Skip to content
Permalink
Browse files

Updated docs and formatting.

  • Loading branch information...
valyard committed Jul 23, 2017
1 parent 06a78ea commit 87c35248266bf1f75fd009a5012278fc3d9780c1
Showing with 965 additions and 415 deletions.
  1. +18 −4 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/CursorManager.cs
  2. +25 −13 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/MouseCursor.cs
  3. +20 −9 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/ObjectCursor.cs
  4. +33 −15 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/PenCursor.cs
  5. +56 −20 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/PointerCursor.cs
  6. +17 −9 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/TouchCursor.cs
  7. +29 −8 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/UI/GradientTexture.cs
  8. +10 −2 Source/Assets/TouchScript/Scripts/Behaviors/Cursors/UI/TextureSwitch.cs
  9. +1 −1 Source/Assets/TouchScript/Scripts/DebuggableMonoBehaviour.cs
  10. +6 −3 Source/Assets/TouchScript/Scripts/Debugging/Filters/IPointerDataFilter.cs
  11. +9 −2 Source/Assets/TouchScript/Scripts/Debugging/Filters/IPointerLogFilter.cs
  12. +14 −7 Source/Assets/TouchScript/Scripts/Debugging/Filters/PointerLogFilter.cs
  13. +40 −2 Source/Assets/TouchScript/Scripts/Debugging/Loggers/IPointerLogger.cs
  14. +28 −5 Source/Assets/TouchScript/Scripts/Debugging/Loggers/PointerLogger.cs
  15. +14 −5 Source/Assets/TouchScript/Scripts/Debugging/TouchScriptDebugger.cs
  16. +6 −4 Source/Assets/TouchScript/Scripts/Devices/Display/DisplayDevice.cs
  17. +4 −5 Source/Assets/TouchScript/Scripts/Devices/Display/GenericDisplayDevice.cs
  18. +11 −4 Source/Assets/TouchScript/Scripts/Devices/Display/IDisplayDevice.cs
  19. +5 −1 Source/Assets/TouchScript/Scripts/GestureManagerInstance.cs
  20. +20 −2 Source/Assets/TouchScript/Scripts/Hit/HitData.cs
  21. +17 −17 Source/Assets/TouchScript/Scripts/Hit/RaycastHitUI.cs
  22. +1 −1 Source/Assets/TouchScript/Scripts/IDebuggable.cs
  23. +45 −2 Source/Assets/TouchScript/Scripts/ILayerManager.cs
  24. +9 −0 Source/Assets/TouchScript/Scripts/ITouchManager.cs
  25. +3 −1 Source/Assets/TouchScript/Scripts/InputSources/IInputSource.cs
  26. +3 −0 Source/Assets/TouchScript/Scripts/InputSources/InputHandlers/MouseHandler.cs
  27. +1 −1 Source/Assets/TouchScript/Scripts/InputSources/InputHandlers/TouchHandler.cs
  28. +20 −4 Source/Assets/TouchScript/Scripts/InputSources/InputHandlers/WindowsPointerHandlers.cs
  29. +5 −7 Source/Assets/TouchScript/Scripts/InputSources/InputSource.cs
  30. +7 −1 Source/Assets/TouchScript/Scripts/LayerManager.cs
  31. +13 −2 Source/Assets/TouchScript/Scripts/LayerManagerInstance.cs
  32. +43 −25 Source/Assets/TouchScript/Scripts/Layers/StandardLayer.cs
  33. +17 −8 Source/Assets/TouchScript/Scripts/Layers/TouchLayer.cs
  34. +70 −50 Source/Assets/TouchScript/Scripts/Layers/UI/TouchScriptInputModule.cs
  35. +13 −0 Source/Assets/TouchScript/Scripts/Pointers/FakePointer.cs
  36. +7 −1 Source/Assets/TouchScript/Scripts/Pointers/IPointer.cs
  37. +5 −1 Source/Assets/TouchScript/Scripts/Pointers/MousePointer.cs
  38. +16 −0 Source/Assets/TouchScript/Scripts/Pointers/ObjectPointer.cs
  39. +16 −0 Source/Assets/TouchScript/Scripts/Pointers/PenPointer.cs
  40. +14 −18 Source/Assets/TouchScript/Scripts/Pointers/Pointer.cs
  41. +1 −3 Source/Assets/TouchScript/Scripts/Pointers/PointerFactory.cs
  42. +16 −0 Source/Assets/TouchScript/Scripts/Pointers/TouchPointer.cs
  43. +67 −54 Source/Assets/TouchScript/Scripts/TouchManager.cs
  44. +8 −3 Source/Assets/TouchScript/Scripts/TouchManagerInstance.cs
  45. +22 −2 Source/Assets/TouchScript/Scripts/Utils/BinaryUtils.cs
  46. +1 −1 Source/Assets/TouchScript/Scripts/Utils/EventHandlerExtensions.cs
  47. +7 −2 Source/Assets/TouchScript/Scripts/Utils/ObjectPool.cs
  48. +25 −20 Source/Assets/TouchScript/Scripts/Utils/Platform/WindowsUtils.cs
  49. +96 −64 Source/Assets/TouchScript/Scripts/Utils/PointerUtils.cs
  50. +31 −6 Source/Assets/TouchScript/Scripts/Utils/TransformUtils.cs
@@ -14,29 +14,40 @@ namespace TouchScript.Behaviors.Cursors
/// <para>Pointer visualizer which shows pointer circles with debug text using Unity UI.</para>
/// <para>The script should be placed on an element with RectTransform or a Canvas. A reference prefab is provided in TouchScript package.</para>
/// </summary>
[HelpURL("http://touchscript.github.io/docs/html/T_TouchScript_Behaviors_Visualizer_TouchVisualizer.htm")]
public class CursorManager : MonoBehaviour
{
#region Public properties

/// <summary>
/// Prefab to use as mouse cursors template.
/// </summary>
public PointerCursor MouseCursor
{
get { return mouseCursor; }
set { mouseCursor = value; }
}

/// <summary>
/// Prefab to use as touch cursors template.
/// </summary>
public PointerCursor TouchCursor
{
get { return touchCursor; }
set { touchCursor = value; }
}

/// <summary>
/// Prefab to use as pen cursors template.
/// </summary>
public PointerCursor PenCursor
{
get { return penCursor; }
set { penCursor = value; }
}

/// <summary>
/// Prefab to use as object cursors template.
/// </summary>
public PointerCursor ObjectCursor
{
get { return objectCursor; }
@@ -71,6 +82,9 @@ public float CursorSize
}
}

/// <summary>
/// Cursor size in pixels.
/// </summary>
public uint CursorPixelSize
{
get { return cursorPixelSize; }
@@ -198,7 +212,7 @@ private void clearProxy(PointerCursor cursor)

private void updateCursorSize()
{
if (useDPI) cursorPixelSize = (uint)(cursorSize * TouchManager.Instance.DotsPerCentimeter);
if (useDPI) cursorPixelSize = (uint) (cursorSize * TouchManager.Instance.DotsPerCentimeter);
}

#endregion
@@ -277,7 +291,7 @@ private void pointersPressedHandler(object sender, PointerEventArgs e)
var pointer = e.Pointers[i];
PointerCursor cursor;
if (!cursors.TryGetValue(pointer.Id, out cursor)) continue;
cursor.SetState(pointer, PointerCursor.ProxyState.Pressed);
cursor.SetState(pointer, PointerCursor.CursorState.Pressed);
}
}

@@ -301,7 +315,7 @@ private void pointersReleasedHandler(object sender, PointerEventArgs e)
var pointer = e.Pointers[i];
PointerCursor cursor;
if (!cursors.TryGetValue(pointer.Id, out cursor)) continue;
cursor.SetState(pointer, PointerCursor.ProxyState.Released);
cursor.SetState(pointer, PointerCursor.CursorState.Released);
}
}

@@ -1,43 +1,52 @@
/*
/*
* @author Valentin Simonov / http://va.lent.in/
*/

using System.Text;
using TouchScript.Behaviors.Cursors.UI;
using TouchScript.Pointers;
using TouchScript.Utils;
using UnityEngine;

namespace TouchScript.Behaviors.Cursors
{
/// <summary>
/// Cursor for mouse pointers.
/// </summary>
public class MouseCursor : TextPointerCursor<MousePointer>
{
#region Public properties

/// <summary>
/// Default cursor sub object.
/// </summary>
public TextureSwitch DefaultCursor;

/// <summary>
/// Pressed cursor sub object.
/// </summary>
public TextureSwitch PressedCursor;

/// <summary>
/// Should the value of <see cref="TouchPointer.Buttons"/> be shown on the cursor.
/// </summary>
public bool ShowButtons = false;

#endregion

#region Public methods

#endregion

#region Protected methods

/// <inheritdoc />
protected override void updateOnce(IPointer pointer)
{
switch (state)
{
case ProxyState.Released:
case ProxyState.Over:
case CursorState.Released:
case CursorState.Over:
if (DefaultCursor != null) DefaultCursor.Show();
if (PressedCursor != null) PressedCursor.Hide();
break;
case ProxyState.Pressed:
case ProxyState.OverPressed:
case CursorState.Pressed:
case CursorState.OverPressed:
if (DefaultCursor != null) DefaultCursor.Hide();
if (PressedCursor != null) PressedCursor.Show();
break;
@@ -46,6 +55,7 @@ protected override void updateOnce(IPointer pointer)
base.updateOnce(pointer);
}

/// <inheritdoc />
protected override void generateText(MousePointer pointer, StringBuilder str)
{
base.generateText(pointer, str);
@@ -58,16 +68,18 @@ protected override void generateText(MousePointer pointer, StringBuilder str)
}
}

protected override bool shouldShowText()
/// <inheritdoc />
protected override bool textIsVisible()
{
return base.shouldShowText() || ShowButtons;
return base.textIsVisible() || ShowButtons;
}

/// <inheritdoc />
protected override uint gethash(MousePointer pointer)
{
var hash = base.gethash(pointer);

if (ShowButtons == true) hash += (uint) (pointer.Buttons & Pointer.PointerButtonState.AnyButtonPressed);
if (ShowButtons) hash += (uint) (pointer.Buttons & Pointer.PointerButtonState.AnyButtonPressed);

return hash;
}
@@ -1,4 +1,4 @@
/*
/*
* @author Valentin Simonov / http://va.lent.in/
*/

@@ -7,24 +7,33 @@

namespace TouchScript.Behaviors.Cursors
{
/// <summary>
/// Cursor for object pointers.
/// </summary>
public class ObjectCursor : TextPointerCursor<ObjectPointer>
{
#region Public properties

/// <summary>
/// Should the value of <see cref="ObjectPointer.ObjectId"/> be shown on the cursor.
/// </summary>
public bool ShowObjectId = false;

/// <summary>
/// Should the values of <see cref="ObjectPointer.Width"/> and <see cref="ObjectPointer.Height"/> be shown on the cursor.
/// </summary>
public bool ShowSize = false;

/// <summary>
/// Should the value of <see cref="ObjectPointer.Angle"/> be shown on the cursor.
/// </summary>
public bool ShowAngle = false;

#endregion

#region Public methods

#endregion

#region Protected methods

/// <inheritdoc />
protected override void generateText(ObjectPointer pointer, StringBuilder str)
{
base.generateText(pointer, str);
@@ -51,17 +60,19 @@ protected override void generateText(ObjectPointer pointer, StringBuilder str)
}
}

protected override bool shouldShowText()
/// <inheritdoc />
protected override bool textIsVisible()
{
return base.shouldShowText() || ShowObjectId || ShowSize || ShowAngle;
return base.textIsVisible() || ShowObjectId || ShowSize || ShowAngle;
}

/// <inheritdoc />
protected override uint gethash(ObjectPointer pointer)
{
var hash = base.gethash(pointer);

if (ShowSize == true) hash += (uint) (pointer.Width * 1024 + pointer.Height * 1024 * 1024) << 8;
if (ShowAngle == true) hash += (uint) (pointer.Angle * 1024) << 24;
if (ShowSize) hash += (uint) (pointer.Width * 1024 + pointer.Height * 1024 * 1024) << 8;
if (ShowAngle) hash += (uint) (pointer.Angle * 1024) << 24;

return hash;
}
@@ -1,47 +1,62 @@
/*
/*
* @author Valentin Simonov / http://va.lent.in/
*/

using System.Text;
using TouchScript.Behaviors.Cursors.UI;
using TouchScript.Pointers;
using TouchScript.Utils;
using UnityEngine;

namespace TouchScript.Behaviors.Cursors
{
/// <summary>
/// Cursor for pen pointers.
/// </summary>
public class PenCursor : TextPointerCursor<PenPointer>
{
#region Public properties

/// <summary>
/// Default cursor sub object.
/// </summary>
public TextureSwitch DefaultCursor;

/// <summary>
/// Pressed cursor sub object.
/// </summary>
public TextureSwitch PressedCursor;

/// <summary>
/// Should the value of <see cref="TouchPointer.Buttons"/> be shown on the cursor.
/// </summary>
public bool ShowButtons = false;

/// <summary>
/// Should the value of <see cref="PenPointer.Pressure"/> be shown on the cursor.
/// </summary>
public bool ShowPressure = false;

/// <summary>
/// Should the value of <see cref="PenPointer.Pressure"/> be shown on the cursor.
/// </summary>
public bool ShowRotation = false;

#endregion

#region Public methods

#endregion

#region Protected methods

/// <inheritdoc />
protected override void updateOnce(IPointer pointer)
{
switch (state)
{
case ProxyState.Released:
case ProxyState.Over:
case CursorState.Released:
case CursorState.Over:
if (DefaultCursor != null) DefaultCursor.Show();
if (PressedCursor != null) PressedCursor.Hide();
break;
case ProxyState.Pressed:
case ProxyState.OverPressed:
case CursorState.Pressed:
case CursorState.OverPressed:
if (DefaultCursor != null) DefaultCursor.Hide();
if (PressedCursor != null) PressedCursor.Show();
break;
@@ -50,6 +65,7 @@ protected override void updateOnce(IPointer pointer)
base.updateOnce(pointer);
}

/// <inheritdoc />
protected override void generateText(PenPointer pointer, StringBuilder str)
{
base.generateText(pointer, str);
@@ -74,18 +90,20 @@ protected override void generateText(PenPointer pointer, StringBuilder str)
}
}

protected override bool shouldShowText()
/// <inheritdoc />
protected override bool textIsVisible()
{
return base.shouldShowText() || ShowButtons || ShowPressure || ShowRotation;
return base.textIsVisible() || ShowButtons || ShowPressure || ShowRotation;
}

/// <inheritdoc />
protected override uint gethash(PenPointer pointer)
{
var hash = base.gethash(pointer);

if (ShowButtons == true) hash += (uint) (pointer.Buttons & Pointer.PointerButtonState.AnyButtonPressed);
if (ShowPressure == true) hash += (uint) (pointer.Pressure * 1024) << 8;
if (ShowRotation == true) hash += (uint) (pointer.Rotation * 1024) << 16;
if (ShowButtons) hash += (uint) (pointer.Buttons & Pointer.PointerButtonState.AnyButtonPressed);
if (ShowPressure) hash += (uint) (pointer.Pressure * 1024) << 8;
if (ShowRotation) hash += (uint) (pointer.Rotation * 1024) << 16;

return hash;
}
Oops, something went wrong.

0 comments on commit 87c3524

Please sign in to comment.
You can’t perform that action at this time.