//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//************** Copyright (c) 2016-2019 Marko Pintera (marko.pintera@gmail.com). All rights reserved. *******************//
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using bs;
namespace bs.Editor
{
/** @addtogroup GUIEditor
* @{
*/
///
/// Generates a set of locations that can be used for rendering ticks on a graph. As input the class takes valid range,
/// size of the area the ticks will be displayed on, type of ticks and minimum/maximum spacing and outputs a set of
/// coordinates along which ticks should be positioned. Ticks are reported as multiple separate levels with different
/// strengths, depending on how close their distribution is to the upper valid range.
///
[ShowInInspector]
public partial class GUIGraphTicks : ScriptObject
{
private GUIGraphTicks(bool __dummy0) { }
protected GUIGraphTicks() { }
/// Contructs a new tick generating object.
/// Determines how will ticks be distributed.
public GUIGraphTicks(GUITickStepType stepType = GUITickStepType.Generic)
{
Internal_GUIGraphTicks(this, stepType);
}
/// Number of tick levels that will be generated.
[NativeWrapper]
public int NumLevels
{
get { return Internal_getNumLevels(mCachedPtr); }
}
///
/// Sets the range which ticks are to be displayed for, and the range along which the ticks will be displayed.
///
/// Start of the range the ticks are to display.
/// End of the range the ticks are to display.
/// Width or height on which the ticks will be rendered. In pixels.
public void SetRange(float valueRangeStart, float valueRangeEnd, int pixelRange)
{
Internal_setRange(mCachedPtr, valueRangeStart, valueRangeEnd, pixelRange);
}
///
/// Sets valid spacing between two ticks. Tick strength will be determined by how far away are they from either end of
/// this range.
///
/// Minimum spacing between two ticks, in pixels.
/// Maximum spacing between two ticks, in pixels.
public void SetTickSpacing(int minPx, int maxPx)
{
Internal_setTickSpacing(mCachedPtr, minPx, maxPx);
}
///
/// Returns the strength of a particular tick level. Levels are ordered in descending order of strength (level 0 is the
/// strongest).
///
/// Level for which to retrieve the strength. Must not be larger than getNumLevels() - 1.
/// Strength of the ticks at this level, in range [0, 1].
public float GetLevelStrength(int level)
{
return Internal_getLevelStrength(mCachedPtr, level);
}
///
/// Returns positions of all ticks of the provided level. The ticks will be within the range provided to setRange().
///
/// Level for which to retrieve the positions. Must not be larger than getNumLevels() - 1.
/// Positions of all ticks of the provided level.
public float[] GetTicks(int level)
{
return Internal_getTicks(mCachedPtr, level);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_GUIGraphTicks(GUIGraphTicks managedInstance, GUITickStepType stepType);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Internal_getNumLevels(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setRange(IntPtr thisPtr, float valueRangeStart, float valueRangeEnd, int pixelRange);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setTickSpacing(IntPtr thisPtr, int minPx, int maxPx);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float Internal_getLevelStrength(IntPtr thisPtr, int level);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float[] Internal_getTicks(IntPtr thisPtr, int level);
}
/** @} */
}