//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System;
using System.Runtime.CompilerServices;
using bs;
namespace bs.Editor
{
/** @addtogroup Handles
* @{
*/
///
/// Constraint that determines in which direction can a HandleSlider2D be moved.
///
public enum Slider2DConstraint // Note: Must match C++ enum Slider2DConstraint
{
///
/// Slider can be moved in both dimensions.
///
None,
///
/// Slider can only be moved horizontally.
///
Horizontal,
///
/// Slider can only be moved vertically.
///
Vertical
};
///
/// Handle slider that is positioned in screen-space, and reports 2D movement in screen space (in pixels). When setting
/// the position the Z coordinate will be ignored, and XY coordinates will be interpreted as pixels relative to the
/// camera its viewed through.
///
public sealed class HandleSlider2D : HandleSlider
{
///
/// Creates a new 2D handle slider.
///
/// Handle that the slider belongs to.
/// Width of the area of the slider that can be interacted with, in pixels.
/// Height of the area of the slider that can be interacted with, in pixels.
///
/// Layer that allows filtering of which sliders are interacted with from a specific camera.
///
///
/// Optional constraint that determines in which direction is the slider allowed to be moved in.
///
public HandleSlider2D(Handle parentHandle, int width, int height, Slider2DConstraint constraint, UInt64 layer = 1)
:base(parentHandle)
{
Internal_CreateInstance(this, width, height, constraint, layer);
}
///
/// Returns a delta value that is the result of dragging/sliding the pointer. This changes every frame and will be
/// zero unless the slider is active. The value is in screen space (pixels).
///
public Vector2I Delta
{
get
{
Vector2I value;
Internal_GetDelta(mCachedPtr, out value);
return value;
}
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_CreateInstance(HandleSlider2D instance, int width, int height,
Slider2DConstraint constraint, UInt64 layer);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_GetDelta(IntPtr nativeInstance, out Vector2I value);
}
/** @} */
}