//********************************** 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
* @{
*/
///
/// Base class that can be implemented by GUI elements needing to elements along draw a horizontal timeline.
///
[ShowInInspector]
public partial class GUITimeline : GUIElement
{
private GUITimeline(bool __dummy0) { }
protected GUITimeline() { }
/// Determines the range of values to display on the timeline, in seconds.
[ShowInInspector]
[NativeWrapper]
public float Range
{
get { return Internal_getRange(mCachedPtr); }
set { Internal_setRange(mCachedPtr, value); }
}
/// Determines the offset at which the displayed timeline values start at, in seconds.
[ShowInInspector]
[NativeWrapper]
public float Offset
{
get { return Internal_getOffset(mCachedPtr); }
set { Internal_setOffset(mCachedPtr, value); }
}
/// Number of frames per second, used for frame selection and marking.
[ShowInInspector]
[NativeWrapper]
public int FPS
{
get { return Internal_getFPS(mCachedPtr); }
set { Internal_setFPS(mCachedPtr, value); }
}
/// Frame to display the frame marker on. Set to -1 to clear the frame marker.
[ShowInInspector]
[NativeWrapper]
public int MarkedFrame
{
get { return Internal_setMarkedFrame0(mCachedPtr); }
set { Internal_setMarkedFrame(mCachedPtr, value); }
}
/// Sets the size of padding to apply to the left and right sides of the curve drawing, in pixels.
[ShowInInspector]
[NativeWrapper]
public int Padding
{
get { return Internal_getPadding(mCachedPtr); }
set { Internal_setPadding(mCachedPtr, value); }
}
///
/// Uses the assigned FPS, range and physical size to calculate the frame that is under the provided coordinates.
///
/// Coordinates relative to this GUI element.
/// Frame that was clicked on, or -1 if the coordinates are outside of valid bounds.
public int GetFrame(Vector2I pixelCoords)
{
return Internal_getFrame(mCachedPtr, ref pixelCoords);
}
/// Returns the time at the specified pixel value along the timeline.
/// X coordinate to sample at, relative to this GUI element in pixels.
/// Time along the curve at the specified coordinate.
public float GetTime(int pixel)
{
return Internal_getTime(mCachedPtr, pixel);
}
/// Finds the pixel offset relative to the GUI element's origin for the specified time.
/// Time value to return the offset for.
/// Offset in pixels relative to GUI element's origin
public int GetOffset(float time)
{
return Internal_getOffset0(mCachedPtr, time);
}
/// Returns time for a frame with the specified index. Depends on set range and FPS.
/// Index of the frame (not a key-frame) to get the time for.
/// Time of the frame with the provided index.
public float GetTimeForFrame(int index)
{
return Internal_getTimeForFrame(mCachedPtr, index);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setRange(IntPtr thisPtr, float range);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float Internal_getRange(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setOffset(IntPtr thisPtr, float offset);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float Internal_getOffset(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setFPS(IntPtr thisPtr, int FPS);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Internal_getFPS(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setMarkedFrame(IntPtr thisPtr, int index);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Internal_setMarkedFrame0(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Internal_getFrame(IntPtr thisPtr, ref Vector2I pixelCoords);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float Internal_getTime(IntPtr thisPtr, int pixel);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Internal_getOffset0(IntPtr thisPtr, float time);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float Internal_getTimeForFrame(IntPtr thisPtr, int index);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setPadding(IntPtr thisPtr, int padding);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Internal_getPadding(IntPtr thisPtr);
}
/** @} */
}