Daikon Forge GUI  v1.0.16
Daikon Forge user interface library for Unity
 All Classes Functions Variables Enumerations Enumerator Properties Events Pages
dfGUIManager Class Reference

The dfGUIManager class is responsible for compiling all control rendering data into a Mesh and rendering that Mesh to the screen. This class is the primary workhorse of the DF-GUI library and in conjunction with dfControl forms the core of this library's functionality. More...

Inheritance diagram for dfGUIManager:
IDFControlHost

Detailed Description

The dfGUIManager class is responsible for compiling all control rendering data into a Mesh and rendering that Mesh to the screen. This class is the primary workhorse of the DF-GUI library and in conjunction with dfControl forms the core of this library's functionality.

Public Member Functions

dfControl AddControl (Type controlType)
 Adds a new control of the specified type to the scene More...
 
void AddControl (dfControl child)
 Adds the child control to the list of child controls for this instance More...
 
AddControl< T > ()
 Adds a new control of the specified type to the scene More...
 
dfControl AddPrefab (GameObject prefab)
 Instantiates a new instance of the specified prefab and adds it to the control hierarchy More...
 
void BringToFront (dfControl control)
 Brings the control to the front so that it will display over any other control within the same container. More...
 
int CompareTo (dfGUIManager other)
 
Plane[] GetClippingPlanes ()
 Returns the set of clipping planes used to clip child controls. Planes are specified in the following order: Left, Right, Top, Bottom More...
 
Vector3[] GetCorners ()
 Returns an array of Vector3 values corresponding to the global positions of this object's bounding box. The corners are specified in the following order: Top Left, Top Right, Bottom Right, Bottom Left More...
 
dfRenderData GetDrawCallBuffer (int drawCallNumber)
 Returns the render data for a specific draw call More...
 
Vector2 GetScreenSize ()
 Returns a Vector2 value representing the width and height of the screen. When the application is running, this value will be the correct size of the screen if PixelPerfectMode is turned off, or the size of the "virtual" screen otherwise. When called in the Editor at design time, this function will return the "design" size of the screen, which is derived from the value of the FixedWidth and FixedHeight properties. More...
 
dfControl HitTest (Vector2 screenPosition)
 Returns the top-most rendered control under the given screen position. NOTE: the screenPosition parameter should be in "screen coordinates", such as the value from Input.mousePosition More...
 
void Invalidate ()
 Invalidates the user interface and requests a refresh, which will be performed on the next frame. More...
 
delegate void ModalPoppedCallback (dfControl control)
 
float PixelsToUnits ()
 Returns a value indicating the size in 3D Units that corresponds to a single on-screen pixel, based on the current value of the FixedHeight property. More...
 
DOXY_IGNORE void Render ()
 Causes the rendering process to be aborted. For internal use only. More...
 
delegate void RenderCallback (dfGUIManager manager)
 
void ResumeRendering ()
 Resumes rendering after a call to SuspendRendering() More...
 
Vector2 ScreenToGui (Vector2 position)
 Converts "screen space" coordinates (y-up with origin at the bottom left corner of the screen) to gui coordinates (y-down with the origin at the top left corner of the screen) More...
 
void SendToBack (dfControl control)
 Brings the control to the front so that it will display behind any other control within the same container. More...
 
void SuspendRendering ()
 Suspends rendering until ResumeRendering is called More...
 
Vector2 WorldPointToGUI (Vector3 worldPoint)
 Returns the GUI coordinates of a point in 3D space More...
 

Static Public Member Functions

static bool ContainsFocus (dfControl control)
 Returns TRUE if the control or any of its descendants currently has input focus, FALSE otherwise. More...
 
static dfControl GetModalControl ()
 Returns a reference to the currently-current modal control, if any. More...
 
static bool HasFocus (dfControl control)
 Returns TRUE if the control currently has input focus, FALSE otherwise. More...
 
static dfControl HitTestAll (Vector2 screenPosition)
 Returns the top-most rendered control under the given screen position. NOTE: the screenPosition parameter should be in "screen coordinates", such as the value from Input.mousePosition More...
 
static void InvalidateAll ()
 Flags all dfGUIManager instances as needing to be re-rendered. The rendering will occur on the next frame rather than immediately. More...
 
static void PopModal ()
 Pop the current modal control from the modal control stack. More...
 
static void PushModal (dfControl control)
 Push a control onto the modal control stack. When a control is modal, only that control and all of its descendants will receive user input events. More...
 
static void PushModal (dfControl control, ModalPoppedCallback callback)
 Push a control onto the modal control stack. When a control is modal, only that control and all of its descendants will receive user input events. More...
 
static void RefreshAll ()
 Refresh all dfGUIManager instances and ensure that all dfControl instances are forced to refresh as well. More...
 
static void RefreshAll (bool force)
 Refresh all dfGUIManager instances and ensure that all dfControl instances are forced to refresh as well. More...
 
static void SetFocus (dfControl control)
 Sets input focus to the indicated control More...
 

Public Attributes

List< dfDesignGuide > guides = new List<dfDesignGuide>()
 

Properties

static dfControl ActiveControl [get]
 Returns a reference to the dfControl instance that currently has input focus More...
 
static IEnumerable< dfGUIManagerActiveManagers [get]
 
bool ConsumeMouseEvents [get, set]
 Gets or sets whether mouse events generated on an active control will be "consumed" (unavailable for other in-game processing) More...
 
IList< dfControlControlsRendered [get]
 Returns the list of controls actually rendered in the last render pass More...
 
dfAtlas DefaultAtlas [get, set]
 The default Texture Atlas containing the images used to render controls in this dfGUIManager. New controls added to the scene will use this Atlas by default. More...
 
dfFontBase DefaultFont [get, set]
 The default Bitmapped Font that will be assigned to new controls added to the scene More...
 
IList< int > DrawCallStartIndices [get]
 Returns a list of indices into the ControlsRendered collection where each draw call started More...
 
int FixedHeight [get, set]
 Gets/Sets the height of the target screen size. More...
 
int FixedWidth [get, set]
 Returns the width of the target screen size More...
 
int FramesRendered [get, set]
 Returns the total number of frames this dfGUIManager instance has rendered More...
 
bool GenerateNormals [get, set]
 Gets or sets whether normals and tangents will be generated for the rendered output, which is needed by some shaders. Defaults to FALSE. More...
 
bool MergeMaterials [get, set]
 Gets/Sets a value indicating whether the GUIManager should attempt to consolidate drawcalls that use the same Material instance. This can reduce the number of draw calls in some cases, but depending on scene complexity may also affect control render order. More...
 
int NumControlsRendered [get, set]
 Returns the total number of controls this dfGUIManager instance rendered during the last frame More...
 
bool OverrideCamera [get, set]
 Gets or sets whether user scripts will override the RenderCamera's settins. If set to TRUE, then user scripts will be responsible for all camera settings on the UI camera More...
 
bool PixelPerfectMode [get, set]
 Gets/Sets a value indicating whether controls should be resized at runtime to retain the same pixel dimensions as design time. If this value is set to TRUE, controls will always remain at the same pixel resolution regardless of the resolution of the game. If set to FALSE, controls will be scaled to fit the target resolution. More...
 
Camera RenderCamera [get, set]
 Returns the UnityEngine.Camera that is used to render the dfGUIManager and all of its controls More...
 
int RenderQueueBase [get, set]
 Gets or sets the base value that will be used for the Render Queue More...
 
int TotalDrawCalls [get, set]
 Returns the total number of draw calls required to render this dfGUIManager instance during the last frame More...
 
int TotalTriangles [get, set]
 Returns the total number of triangles this dfGUIManager instance rendered during the last frame More...
 
Vector2 UIOffset [get, set]
 Gets or sets the amount and direction of "offset" for the entire user interface. Useful for "panning" or implementing "shake". More...
 
float UIScale [get, set]
 Gets or sets the multiplier by which the entire UI will be scaled More...
 
bool UIScaleLegacyMode [get, set]
 Gets or sets whether the UIScale property will use Legacy Mode (scales entire UI) More...
 

Events

static RenderCallback AfterRender
 Called after a dfGUIManager instance has finished rendering the user interface More...
 
static RenderCallback BeforeRender
 Called before a dfGUIManager instance begins rendering the user interface More...
 

Member Function Documentation

dfControl dfGUIManager.AddControl ( Type  controlType)

Adds a new control of the specified type to the scene

Parameters
controlTypeThe Type of control to create - Must derive from dfControl
Returns
A reference to the new dfControlinstance

Implements IDFControlHost.

void dfGUIManager.AddControl ( dfControl  child)

Adds the child control to the list of child controls for this instance

Parameters
childThe dfControl instance to add to the list of child controls

Implements IDFControlHost.

Adds a new control of the specified type to the scene

Template Parameters
TThe Type of control to create
Returns
A reference to the new dfControlinstance

Implements IDFControlHost.

Type Constraints
T :dfControl 
dfControl dfGUIManager.AddPrefab ( GameObject  prefab)

Instantiates a new instance of the specified prefab and adds it to the control hierarchy

Parameters
prefab
Returns

Implements IDFControlHost.

void dfGUIManager.BringToFront ( dfControl  control)

Brings the control to the front so that it will display over any other control within the same container.

Parameters
controlThe control instance to bring to front
int dfGUIManager.CompareTo ( dfGUIManager  other)
static bool dfGUIManager.ContainsFocus ( dfControl  control)
static

Returns TRUE if the control or any of its descendants currently has input focus, FALSE otherwise.

Parameters
controlThe dfControl instance to test for input focus
Plane [] dfGUIManager.GetClippingPlanes ( )

Returns the set of clipping planes used to clip child controls. Planes are specified in the following order: Left, Right, Top, Bottom

Returns
Returns an array of Plane that enclose the object in world coordinates
Vector3 [] dfGUIManager.GetCorners ( )

Returns an array of Vector3 values corresponding to the global positions of this object's bounding box. The corners are specified in the following order: Top Left, Top Right, Bottom Right, Bottom Left

dfRenderData dfGUIManager.GetDrawCallBuffer ( int  drawCallNumber)

Returns the render data for a specific draw call

Parameters
drawCallNumberThe index of the draw call to retrieve render information for
static dfControl dfGUIManager.GetModalControl ( )
static

Returns a reference to the currently-current modal control, if any.

Returns
A reference to the currently-current modal control if one exists, NULL otherwise
Vector2 dfGUIManager.GetScreenSize ( )

Returns a Vector2 value representing the width and height of the screen. When the application is running, this value will be the correct size of the screen if PixelPerfectMode is turned off, or the size of the "virtual" screen otherwise. When called in the Editor at design time, this function will return the "design" size of the screen, which is derived from the value of the FixedWidth and FixedHeight properties.

static bool dfGUIManager.HasFocus ( dfControl  control)
static

Returns TRUE if the control currently has input focus, FALSE otherwise.

Parameters
controlThe dfControl instance to test for input focus
dfControl dfGUIManager.HitTest ( Vector2  screenPosition)

Returns the top-most rendered control under the given screen position. NOTE: the screenPosition parameter should be in "screen coordinates", such as the value from Input.mousePosition

Parameters
screenPositionThe screen position to check
Returns
static dfControl dfGUIManager.HitTestAll ( Vector2  screenPosition)
static

Returns the top-most rendered control under the given screen position. NOTE: the screenPosition parameter should be in "screen coordinates", such as the value from Input.mousePosition

Parameters
screenPositionThe screen position to check
Returns
void dfGUIManager.Invalidate ( )

Invalidates the user interface and requests a refresh, which will be performed on the next frame.

static void dfGUIManager.InvalidateAll ( )
static

Flags all dfGUIManager instances as needing to be re-rendered. The rendering will occur on the next frame rather than immediately.

delegate void dfGUIManager.ModalPoppedCallback ( dfControl  control)
float dfGUIManager.PixelsToUnits ( )

Returns a value indicating the size in 3D Units that corresponds to a single on-screen pixel, based on the current value of the FixedHeight property.

static void dfGUIManager.PopModal ( )
static

Pop the current modal control from the modal control stack.

static void dfGUIManager.PushModal ( dfControl  control)
static

Push a control onto the modal control stack. When a control is modal, only that control and all of its descendants will receive user input events.

Parameters
controlThe control to make modal
static void dfGUIManager.PushModal ( dfControl  control,
ModalPoppedCallback  callback 
)
static

Push a control onto the modal control stack. When a control is modal, only that control and all of its descendants will receive user input events.

Parameters
controlThe control to make modal
callbackA function that will be called when the control is popped off of the modal stack. Can be null.
static void dfGUIManager.RefreshAll ( )
static

Refresh all dfGUIManager instances and ensure that all dfControl instances are forced to refresh as well.

static void dfGUIManager.RefreshAll ( bool  force)
static

Refresh all dfGUIManager instances and ensure that all dfControl instances are forced to refresh as well.

Parameters
forceSet to TRUE to force each dfGUIManager instance to refresh immediately
DOXY_IGNORE void dfGUIManager.Render ( )

Causes the rendering process to be aborted. For internal use only.

Rebuild the user interface mesh and update the renderer so that the UI will be presented to the user on the next frame. NOTE : This function is automatically called internally and should not be called by user code.

delegate void dfGUIManager.RenderCallback ( dfGUIManager  manager)
void dfGUIManager.ResumeRendering ( )

Resumes rendering after a call to SuspendRendering()

Vector2 dfGUIManager.ScreenToGui ( Vector2  position)

Converts "screen space" coordinates (y-up with origin at the bottom left corner of the screen) to gui coordinates (y-down with the origin at the top left corner of the screen)

Parameters
positionThe screen-space coordinate to convert
void dfGUIManager.SendToBack ( dfControl  control)

Brings the control to the front so that it will display behind any other control within the same container.

Parameters
controlThe control instance to send to back
static void dfGUIManager.SetFocus ( dfControl  control)
static

Sets input focus to the indicated control

Parameters
controlThe control that should receive user input
void dfGUIManager.SuspendRendering ( )

Suspends rendering until ResumeRendering is called

Returns
Vector2 dfGUIManager.WorldPointToGUI ( Vector3  worldPoint)

Returns the GUI coordinates of a point in 3D space

Parameters
worldPoint
Returns

Property Documentation

dfControl dfGUIManager.ActiveControl
staticget

Returns a reference to the dfControl instance that currently has input focus

IEnumerable<dfGUIManager> dfGUIManager.ActiveManagers
staticget
bool dfGUIManager.ConsumeMouseEvents
getset

Gets or sets whether mouse events generated on an active control will be "consumed" (unavailable for other in-game processing)

IList<dfControl> dfGUIManager.ControlsRendered
get

Returns the list of controls actually rendered in the last render pass

dfAtlas dfGUIManager.DefaultAtlas
getset

The default Texture Atlas containing the images used to render controls in this dfGUIManager. New controls added to the scene will use this Atlas by default.

dfFontBase dfGUIManager.DefaultFont
getset

The default Bitmapped Font that will be assigned to new controls added to the scene

IList<int> dfGUIManager.DrawCallStartIndices
get

Returns a list of indices into the ControlsRendered collection where each draw call started

int dfGUIManager.FixedHeight
getset

Gets/Sets the height of the target screen size.

int dfGUIManager.FixedWidth
getset

Returns the width of the target screen size

int dfGUIManager.FramesRendered
getset

Returns the total number of frames this dfGUIManager instance has rendered

bool dfGUIManager.GenerateNormals
getset

Gets or sets whether normals and tangents will be generated for the rendered output, which is needed by some shaders. Defaults to FALSE.

bool dfGUIManager.MergeMaterials
getset

Gets/Sets a value indicating whether the GUIManager should attempt to consolidate drawcalls that use the same Material instance. This can reduce the number of draw calls in some cases, but depending on scene complexity may also affect control render order.

int dfGUIManager.NumControlsRendered
getset

Returns the total number of controls this dfGUIManager instance rendered during the last frame

bool dfGUIManager.OverrideCamera
getset

Gets or sets whether user scripts will override the RenderCamera's settins. If set to TRUE, then user scripts will be responsible for all camera settings on the UI camera

bool dfGUIManager.PixelPerfectMode
getset

Gets/Sets a value indicating whether controls should be resized at runtime to retain the same pixel dimensions as design time. If this value is set to TRUE, controls will always remain at the same pixel resolution regardless of the resolution of the game. If set to FALSE, controls will be scaled to fit the target resolution.

Camera dfGUIManager.RenderCamera
getset

Returns the UnityEngine.Camera that is used to render the dfGUIManager and all of its controls

int dfGUIManager.RenderQueueBase
getset

Gets or sets the base value that will be used for the Render Queue

int dfGUIManager.TotalDrawCalls
getset

Returns the total number of draw calls required to render this dfGUIManager instance during the last frame

int dfGUIManager.TotalTriangles
getset

Returns the total number of triangles this dfGUIManager instance rendered during the last frame

Vector2 dfGUIManager.UIOffset
getset

Gets or sets the amount and direction of "offset" for the entire user interface. Useful for "panning" or implementing "shake".

float dfGUIManager.UIScale
getset

Gets or sets the multiplier by which the entire UI will be scaled

bool dfGUIManager.UIScaleLegacyMode
getset

Gets or sets whether the UIScale property will use Legacy Mode (scales entire UI)

Event Documentation

RenderCallback dfGUIManager.AfterRender
static

Called after a dfGUIManager instance has finished rendering the user interface

RenderCallback dfGUIManager.BeforeRender
static

Called before a dfGUIManager instance begins rendering the user interface