//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System;
using System.Runtime.CompilerServices;
namespace BansheeEngine
{
/** @addtogroup GUI_Engine
* @{
*/
///
/// Provides access to a global that renders GUI on the main viewport. Use
/// if you need more control over the placement of GUI, or require it to be rendered to a
/// different viewport.
///
public static class GUI
{
private static GUISkin skin;
private static GUIPanel panel; // Populated by runtime
///
/// Skin used for rendering all the GUI elements.
///
public static GUISkin Skin
{
get { return skin; }
set
{
skin = value;
IntPtr skinPtr = IntPtr.Zero;
if (value != null)
skinPtr = value.GetCachedPtr();
Internal_SetSkin(skinPtr);
}
}
///
/// Container into which all GUI elements should be placed.
///
public static GUIPanel Panel
{
get { return panel; }
}
///
/// Used by the runtime to set the primary panel.
///
/// Primary panel of the widget.
private static void SetPanel(GUIPanel panel)
{
// We can't set this directly through the field because there is an issue with Mono and static fields
GUI.panel = panel;
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetSkin(IntPtr skin);
}
/** @} */
}