//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System.Runtime.CompilerServices; namespace BansheeEngine { /** @addtogroup Utility * @{ */ /// /// Allows manipulation of the platform cursor. /// public static class Cursor { /// /// Position of the cursor in screen coordinates. /// public static Vector2I ScreenPosition { get { Vector2I value; Internal_GetScreenPosition(out value); return value; } set { Internal_SetScreenPosition(ref value); } } /// /// Hides the cursor. /// public static void Hide() { Internal_Hide(); } /// /// Shows the cursor. /// public static void Show() { Internal_Show(); } /// /// Clips the cursor to the specified area. Enabled until is called. /// /// Area in screen space to clip the cursor to. public static void ClipToRect(Rect2I area) { Internal_ClipToRect(ref area); } /// /// Disables cursor clipping previously enabled with . /// public static void ClipDisable() { Internal_ClipDisable(); } /// /// Changes the active cursor icon. /// /// Name of the cursor icon, previously registered with /// public static void SetCursor(string name) { Internal_SetCursorStr(name); } /// /// Changes the active cursor icon. /// /// One of the built-in cursor types. public static void SetCursor(CursorType type) { Internal_SetCursor(type); } /// /// Updates the look of a specific cursor icon. /// /// Name of the cursor. /// Pixel data specifying the new look. /// Offset into the icon image that determines where the cursor point is. public static void SetCursorIcon(string name, PixelData iconData, Vector2I hotspot) { Internal_SetCursorIconStr(name, iconData, ref hotspot); } /// /// Updates the look of a specific cursor icon. /// /// One of the built-in cursor types. /// Pixel data specifying the new look. /// Offset into the icon image that determines where the cursor point is. public static void SetCursorIcon(CursorType type, PixelData iconData, Vector2I hotspot) { Internal_SetCursorIcon(type, iconData, ref hotspot); } /// /// Removes a cursor icon. /// /// Name of the cursor. public static void ClearCursorIcon(string name) { Internal_ClearCursorIconStr(name); } /// /// Removes a cursor icon. /// /// One of the built-in cursor types. public static void ClearCursorIcon(CursorType type) { Internal_ClearCursorIcon(type); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_GetScreenPosition(out Vector2I value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetScreenPosition(ref Vector2I value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_Hide(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_Show(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ClipToRect(ref Rect2I value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ClipDisable(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetCursorStr(string name); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetCursor(CursorType cursor); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetCursorIconStr(string name, PixelData iconData, ref Vector2I hotspot); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetCursorIcon(CursorType cursor, PixelData iconData, ref Vector2I hotspot); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ClearCursorIconStr(string name); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ClearCursorIcon(CursorType cursor); } /// /// Built-in cursor types. /// public enum CursorType //Note: Must match C++ enum CursorType { Arrow, ArrowDrag, ArrowLeftRight, Wait, IBeam, SizeNESW, SizeNS, SizeNWSE, SizeWE, Deny, // Keep at the end Count }; /** @} */ }